Module: IsoDoc::XrefGen::Anchor

Included in:
IsoDoc::Xref
Defined in:
lib/isodoc/xref/xref_anchor.rb

Defined Under Namespace

Classes: SeenAnchor

Instance Method Summary collapse

Instance Method Details

#anchor_struct(lbl, container, elem, type, unnumb = false) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/isodoc/xref/xref_anchor.rb', line 52

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[:elem] = elem
  ret[:value] = anchor_struct_value(lbl, elem)
  ret
end

#anchor_struct_label(lbl, elem) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/isodoc/xref/xref_anchor.rb', line 32

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

#anchor_struct_value(lbl, elem) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/isodoc/xref/xref_anchor.rb', line 44

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

#anchor_struct_xref(lbl, elem) ⇒ Object



40
41
42
# File 'lib/isodoc/xref/xref_anchor.rb', line 40

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

#get_anchorsObject



28
29
30
# File 'lib/isodoc/xref/xref_anchor.rb', line 28

def get_anchors
  @anchors
end

#initializeObject



24
25
26
# File 'lib/isodoc/xref/xref_anchor.rb', line 24

def initialize
  @anchors = {}
end