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



49
50
51
52
53
54
55
56
# File 'lib/isodoc/iec/xref.rb', line 49

def annex_name_lbl(clause, num)
  obl = l10n("(#{@labels['inform_annex']})")
  clause["obligation"] == "normative" and
    obl = l10n("(#{@labels['norm_annex']})")
  obl = "<span class='fmt-obligation'>#{l10n obl}</fmt>"
  s = labelled_autonum(@labels['annex'], num)
  l10n("<strong><span class='fmt-caption-label'>#{s}</span></strong><br/>#{obl}")
end

#clausesepObject



43
44
45
46
47
# File 'lib/isodoc/iec/xref.rb', line 43

def clausesep
  if @terms_iev_names then "-"
  else super
  end
end

#initial_anchor_names(docxml) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# 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 = true
    terms_iev_names(docxml)
    @terms_iev_names = false
  end
end

#introduction_names(clause) ⇒ Object



12
13
14
# File 'lib/isodoc/iec/xref.rb', line 12

def introduction_names(clause)
  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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/isodoc/iec/xref.rb', line 27

def terms_iev_names(docxml)
  docxml.xpath(ns("//sections/clause/terms")).each_with_index do |t, i|
    num = semx(t, "#{@iev_part}-%02d" % [i + 1])
    @anchors[t["id"]] =
      { label: num, 
        #xref: l10n("#{@labels['section_iev']} #{num}"),
        xref: labelled_autonum(@labels['section_iev'], num),
        level: 2, type: "clause", elem: @labels["section_iev"] }
    t.xpath(ns("./term")).each_with_index do |c, j|
      num2 = semx(c, "%02d" % [j + 1])
      #section_names1(c, "#{num}#{delim_wrap("-")}#{num2}", 3)
      section_names1(c, num, num2, 3)
    end
  end
end