Sha256: fc6e2d6591e76c8a5e6549b6edd4b70b881a92468244e24f5908cb09ac9780c4

Contents?: true

Size: 1.33 KB

Versions: 26

Compression:

Stored size: 1.33 KB

Contents

require "singleton"

module IsoDoc
  module XrefGen
    module Anchor
      class Seen_Anchor
        include Singleton

        def initialize
          @seen = {}
        end

        def seen(elem)
          @seen.has_key?(elem)
        end

        def add(elem)
          @seen[elem] = true
        end
      end

      def initialize
        @anchors = {}
      end

      def get_anchors
        @anchors
      end

      def anchor_struct_label(lbl, elem)
        case elem
        when @labels["appendix"] then l10n("#{elem} #{lbl}")
        else
          lbl.to_s
        end
      end

      def anchor_struct_xref(lbl, elem)
        l10n("#{elem} #{anchor_struct_value(lbl, elem)}")
      end

      def anchor_struct_value(lbl, elem)
        case elem
        when @labels["formula"], @labels["inequality"] then "(#{lbl})"
        else
          lbl
        end
      end

      def anchor_struct(lbl, container, elem, type, unnumb = false)
        ret = {}
        ret[:label] = unnumb == "true" ? nil : anchor_struct_label(lbl, elem)
        ret[:xref] = anchor_struct_xref(unnumb == "true" ? "(??)" : lbl, elem)
        ret[:xref].gsub!(/ $/, "")
        ret[:container] = @klass.get_clause_id(container) unless container.nil?
        ret[:type] = type
        ret[:value] = anchor_struct_value(lbl, elem)
        ret
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
isodoc-2.0.4 lib/isodoc/xref/xref_anchor.rb
isodoc-2.0.3 lib/isodoc/xref/xref_anchor.rb
isodoc-2.0.2 lib/isodoc/xref/xref_anchor.rb
isodoc-2.0.1 lib/isodoc/xref/xref_anchor.rb
isodoc-2.0.0.1 lib/isodoc/xref/xref_anchor.rb
isodoc-2.0.0 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.4 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.3.3 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.3.2 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.3.1 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.3 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.2.2 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.2.1 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.2 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.1 lib/isodoc/xref/xref_anchor.rb
isodoc-1.8.0 lib/isodoc/xref/xref_anchor.rb
isodoc-1.7.7 lib/isodoc/xref/xref_anchor.rb
isodoc-1.7.6.1 lib/isodoc/xref/xref_anchor.rb
isodoc-1.7.6 lib/isodoc/xref/xref_anchor.rb
isodoc-1.7.5 lib/isodoc/xref/xref_anchor.rb