Module: IsoDoc::XrefGen::Anchor
- Includes:
- Util
- Included in:
- IsoDoc::Xref
- Defined in:
- lib/isodoc/xref/xref_anchor.rb
Defined Under Namespace
Classes: SeenAnchor
Constant Summary
Constants included
from Util
Util::CHILD_SECTIONS, Util::SECTIONS_XPATH
Instance Method Summary
collapse
-
#anchor_struct(lbl, node, elem_name, type, opt = {}) ⇒ Object
def anchor_struct(lbl, container, elem, type, unnumb = false).
-
#anchor_struct_label(lbl, node, elem) ⇒ Object
-
#anchor_struct_value(lbl, elem) ⇒ Object
-
#anchor_struct_xref(lbl, node, elem) ⇒ Object
-
#get_anchors ⇒ Object
-
#initialize ⇒ Object
Methods included from Util
#blank?, #child_asset_path, #child_sections, #delim_wrap, #hiersemx, #labelled_autonum, #noblank, #sections_xpath, #semx, #stripsemx
Instance Method Details
#anchor_struct(lbl, node, elem_name, type, opt = {}) ⇒ Object
def anchor_struct(lbl, container, elem, type, unnumb = false)
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 65
def anchor_struct(lbl, node, elem_name, type, opt = {})
ret = { type: type, elem: elem_name, label: nil }
opt[:unnumb] != "true" and
ret[:label] = anchor_struct_label(lbl, node, elem_name)
ret[:xref] =
anchor_struct_xref(opt[:unnumb] == "true" ? "(??)" : lbl, node,
elem_name)
ret[:container] = @klass.get_clause_id(node) if opt[:container]
ret[:value] = stripsemx(lbl)
ret
end
|
#anchor_struct_label(lbl, node, elem) ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 33
def anchor_struct_label(lbl, node, elem)
case elem
when @labels["appendix"]
s = "<semx element='autonum' source='#{node['id'] || node[:id]}'>" \
"#{lbl}</semx>"
"<span class='fmt-element-name'>#{elem}</span> #{s}"
else
anchor_struct_value(lbl, elem)
end
end
|
#anchor_struct_value(lbl, elem) ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 53
def anchor_struct_value(lbl, elem)
case elem
when @labels["formula"], @labels["inequality"] then <<~SPAN.strip
#{delim_wrap('(')}#{lbl}#{delim_wrap(')')}
SPAN
else
lbl.to_s
end
end
|
#anchor_struct_xref(lbl, node, elem) ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 44
def anchor_struct_xref(lbl, node, elem)
unless lbl.blank?
lbl = semx(node, lbl)
s = " #{anchor_struct_value(lbl, elem)}"
end
l10n("<span class='fmt-element-name'>#{elem}</span>#{s}")
.gsub(/ $/, "")
end
|
#get_anchors ⇒ Object
29
30
31
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 29
def get_anchors
@anchors
end
|
#initialize ⇒ Object
25
26
27
|
# File 'lib/isodoc/xref/xref_anchor.rb', line 25
def initialize
@anchors = {}
end
|