Module: IsoDoc::IHO::BaseConvert
- Included in:
- HtmlConvert, WordConvert
- Defined in:
- lib/isodoc/iho/base_convert.rb
Instance Method Summary collapse
- #annex_name_lbl(clause, num) ⇒ Object
- #annex_names(clause, num) ⇒ Object
- #annex_names1(clause, num, level) ⇒ Object
- #appendix_names(clause, num) ⇒ Object
- #back_anchor_names(docxml) ⇒ Object
-
#error_parse(node, out) ⇒ Object
terms not defined in standoc.
- #info(isoxml, out) ⇒ Object
- #metadata_init(lang, script, labels) ⇒ Object
Instance Method Details
#annex_name_lbl(clause, num) ⇒ Object
8 9 10 11 |
# File 'lib/isodoc/iho/base_convert.rb', line 8 def annex_name_lbl(clause, num) lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl l10n("<b>#{lbl} #{num}</b>") end |
#annex_names(clause, num) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/isodoc/iho/base_convert.rb', line 13 def annex_names(clause, num) appendix_names(clause, num) lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause", xref: "#{lbl} #{num}", level: 1 } if a = single_annex_special_section(clause) annex_names1(a, "#{num}", 1) else clause.xpath(ns("./clause | ./references | ./terms | ./definitions")). each_with_index do |c, i| annex_names1(c, "#{num}.#{i + 1}", 2) end end hierarchical_asset_names(clause, num) end |
#annex_names1(clause, num, level) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/isodoc/iho/base_convert.rb', line 40 def annex_names1(clause, num, level) lbl = clause.at("./ancestor::xmlns:annex/@obligation").text == "informative" ? @appendix_lbl : @annex_lbl @anchors[clause["id"]] = { label: num, xref: "#{lbl} #{num}", level: level, type: "clause" } clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).each_with_index do |c, i| annex_names1(c, "#{num}.#{i + 1}", level + 1) end end |
#appendix_names(clause, num) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/isodoc/iho/base_convert.rb', line 59 def appendix_names(clause, num) clause.xpath(ns("./appendix")).each_with_index do |c, i| @anchors[c["id"]] = anchor_struct(i + 1, nil, @appendix_lbl, "clause") @anchors[c["id"]][:level] = 2 @anchors[c["id"]][:container] = clause["id"] end end |
#back_anchor_names(docxml) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/isodoc/iho/base_convert.rb', line 30 def back_anchor_names(docxml) super docxml.xpath(ns("//annex[@obligation = 'informative']")).each_with_index do |c, i| annex_names(c, i + 1) end docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).each_with_index do |c, i| annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s) end end |
#error_parse(node, out) ⇒ Object
terms not defined in standoc
51 52 53 54 55 56 57 |
# File 'lib/isodoc/iho/base_convert.rb', line 51 def error_parse(node, out) case node.name when "appendix" then clause_parse(node, out) else super end end |
#info(isoxml, out) ⇒ Object
67 68 69 70 71 |
# File 'lib/isodoc/iho/base_convert.rb', line 67 def info(isoxml, out) .series isoxml, out .commentperiod isoxml, out super end |
#metadata_init(lang, script, labels) ⇒ Object
4 5 6 |
# File 'lib/isodoc/iho/base_convert.rb', line 4 def (lang, script, labels) = Metadata.new(lang, script, labels) end |