Class: IsoDoc::IHO::Xref
- Inherits:
-
Generic::Xref
- Object
- Generic::Xref
- IsoDoc::IHO::Xref
- Defined in:
- lib/isodoc/iho/xref.rb
Instance Method Summary collapse
- #annex_name_lbl(clause, num) ⇒ Object
- #annex_names(clause, num) ⇒ Object
- #annex_names1(clause, num, level) ⇒ Object
- #annexlbl(cond) ⇒ Object
- #appendix_names(clause, _num) ⇒ Object
- #back_anchor_names(docxml) ⇒ Object
- #section_names1(clause, num, level) ⇒ Object
Instance Method Details
#annex_name_lbl(clause, num) ⇒ Object
13 14 15 16 |
# File 'lib/isodoc/iho/xref.rb', line 13 def annex_name_lbl(clause, num) lbl = annexlbl(clause["obligation"] == "informative") l10n("<strong>#{lbl} #{num}</strong>") end |
#annex_names(clause, num) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/isodoc/iho/xref.rb', line 18 def annex_names(clause, num) appendix_names(clause, num) lbl = annexlbl(clause["obligation"] == "informative") @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause", elem: lbl, xref: l10n("#{lbl} #{num}"), level: 1, value: num } if a = single_annex_special_section(clause) annex_names1(a, num.to_s, 1) else i = Counter.new clause.xpath(ns("./clause | ./references | ./terms | ./definitions")) .each do |c| i.increment(c) annex_names1(c, "#{num}.#{i.print}", 2) end end hierarchical_asset_names(clause, num) end |
#annex_names1(clause, num, level) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/isodoc/iho/xref.rb', line 53 def annex_names1(clause, num, level) lbl = annexlbl(clause.at("./ancestor::xmlns:annex/@obligation") .text == "informative") @anchors[clause["id"]] = { label: num, xref: l10n("#{lbl} #{num}"), level: level, type: "clause" } i = Counter.new clause.xpath(ns("./clause | ./references | ./terms | ./definitions")) .each do |c| i.increment(c) annex_names1(c, "#{num}.#{i.print}", level + 1) end end |
#annexlbl(cond) ⇒ Object
9 10 11 |
# File 'lib/isodoc/iho/xref.rb', line 9 def annexlbl(cond) cond ? @labels["appendix"] : @labels["annex"] end |
#appendix_names(clause, _num) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/isodoc/iho/xref.rb', line 67 def appendix_names(clause, _num) i = Counter.new clause.xpath(ns("./appendix")).each do |c| i.increment(c) @anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"], "clause") @anchors[c["id"]][:level] = 2 @anchors[c["id"]][:container] = clause["id"] end end |
#back_anchor_names(docxml) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/isodoc/iho/xref.rb', line 37 def back_anchor_names(docxml) super i = Counter.new docxml.xpath(ns("//annex[@obligation = 'informative']")) .each do |c| i.increment(c) annex_names(c, i.print) end i = Counter.new("@", skip_i: true) docxml.xpath(ns("//annex[not(@obligation = 'informative')]")) .each do |c| i.increment(c) annex_names(c, i.print) end end |
#section_names1(clause, num, level) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/isodoc/iho/xref.rb', line 78 def section_names1(clause, num, level) @anchors[clause["id"]] = { label: num, level: level, xref: l10n("#{@labels['subclause']} #{num}"), type: "clause", elem: @labels["subclause"] } i = Counter.new clause.xpath(ns(SUBCLAUSES)).each do |c| i.increment(c) section_names1(c, "#{num}.#{i.print}", level + 1) end end |