Class: IsoDoc::Iec::Xref
- Inherits:
-
IsoDoc::Iso::Xref
- Object
- IsoDoc::Iso::Xref
- IsoDoc::Iec::Xref
- Defined in:
- lib/isodoc/iec/xref.rb
Instance Method Summary collapse
- #annex_name_lbl(clause, num) ⇒ Object
- #initial_anchor_names(d) ⇒ Object
- #introduction_names(clause) ⇒ Object
- #parse(docxml) ⇒ Object
- #terms_iev_names(d) ⇒ Object
Instance Method Details
#annex_name_lbl(clause, num) ⇒ Object
38 39 40 41 42 |
# File 'lib/isodoc/iec/xref.rb', line 38 def annex_name_lbl(clause, num) obl = l10n("(#{@labels["inform_annex"]})") obl = l10n("(#{@labels["norm_annex"]})") if clause["obligation"] == "normative" l10n("<strong>#{@labels["annex"]} #{num}</strong><br/>#{obl}") end |
#initial_anchor_names(d) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/isodoc/iec/xref.rb', line 16 def initial_anchor_names(d) super return unless @is_iev terms_iev_names(d) middle_section_asset_names(d) termnote_anchor_names(d) termexample_anchor_names(d) end |
#introduction_names(clause) ⇒ Object
12 13 14 |
# File 'lib/isodoc/iec/xref.rb', line 12 def introduction_names(clause) return super unless @is_iev end |
#parse(docxml) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/isodoc/iec/xref.rb', line 4 def parse(docxml) id = docxml&.at(ns("//bibdata/docnumber"))&.text @is_iev = id == "60050" id = docxml&.at(ns("//bibdata/docidentifier[@type = 'ISO']"))&.text m = /60050-(\d+)/.match(id) and @iev_part = m[1] super end |
#terms_iev_names(d) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/isodoc/iec/xref.rb', line 25 def terms_iev_names(d) d.xpath(ns("//sections/clause/terms")).each_with_index do |t, i| num = "#{@iev_part}-%02d" % [i+1] @anchors[t["id"]] = { label: num, xref: l10n("#{@labels["section_iev"]}-#{num}"), level: 2, type: "clause" } t.xpath(ns("./term")).each_with_index do |c, i| num2 = "%02d" % [i+1] section_names1(c, "#{num}-#{num2}", 3) end end end |