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



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

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



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

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

#anchor_struct_value(lbl, elem) ⇒ Object



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

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



38
39
40
# File 'lib/isodoc/xref/xref_anchor.rb', line 38

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

#get_anchorsObject



26
27
28
# File 'lib/isodoc/xref/xref_anchor.rb', line 26

def get_anchors
  @anchors
end

#initializeObject



22
23
24
# File 'lib/isodoc/xref/xref_anchor.rb', line 22

def initialize
  @anchors = {}
end