Class: IsoDoc::Iec::Xref

Inherits:
IsoDoc::Iso::Xref
  • Object
show all
Defined in:
lib/isodoc/iec/xref.rb

Instance Method Summary collapse

Instance Method Details

#annex_name_lbl(clause, num) ⇒ Object



38
39
40
41
42
43
# File 'lib/isodoc/iec/xref.rb', line 38

def annex_name_lbl(clause, num)
  obl = l10n("(#{@labels['inform_annex']})")
  clause["obligation"] == "normative" and
    obl = l10n("(#{@labels['norm_annex']})")
  l10n("<strong>#{@labels['annex']} #{num}</strong><br/>#{obl}")
end

#initial_anchor_names(docxml) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/isodoc/iec/xref.rb', line 16

def initial_anchor_names(docxml)
  super
  return unless @is_iev

  if @parse_settings.empty? || @parse_settings[:clauses]
    terms_iev_names(docxml)
  end
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(docxml) ⇒ 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(docxml)
  docxml.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", elem: @labels["section_iev"] }
    t.xpath(ns("./term")).each_with_index do |c, j|
      num2 = "%02d" % [j + 1]
      section_names1(c, "#{num}-#{num2}", 3)
    end
  end
end