Module: IsoDoc::XrefGen::Anchor

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

Defined Under Namespace

Classes: Seen_Anchor

Instance Method Summary collapse

Instance Method Details

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



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

def anchor_struct(lbl, container, elem, type, unnumbered = false)
  ret = {}
  ret[:label] = unnumbered == "true" ? nil : anchor_struct_label(lbl, elem)
  ret[:xref] = anchor_struct_xref(unnumbered == "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

#anchor_struct_label(lbl, elem) ⇒ Object



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

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



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

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

#anchor_struct_xref(lbl, elem) ⇒ Object



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

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

#get_anchorsObject



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

def get_anchors
  @anchors
end

#initializeObject



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

def initialize()
  @anchors = {}
end