Module: IsoDoc::Rsd::BaseConvert

Included in:
HtmlConvert, WordConvert
Defined in:
lib/isodoc/rsd/base_convert.rb

Instance Method Summary collapse

Instance Method Details

#annex_name(annex, name, div) ⇒ Object


8
9
10
11
12
13
# File 'lib/isodoc/rsd/base_convert.rb', line 8

def annex_name(annex, name, div)
  div.h1 **{ class: "Annex" } do |t|
    t << "#{anchor(annex['id'], :label)}<br/><br/>"
    name&.children&.each { |c2| parse(c2, t) }
  end
end

#annex_name_lbl(clause, num) ⇒ Object


15
16
17
18
19
# File 'lib/isodoc/rsd/base_convert.rb', line 15

def annex_name_lbl(clause, num)
  obl = l10n("(#{@inform_annex_lbl})")
  obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
  l10n("#{@annex_lbl} #{num}<br/>#{obl}")
end

#clausedelimObject


41
42
43
# File 'lib/isodoc/rsd/base_convert.rb', line 41

def clausedelim
  ""
end

#executivesummary(docxml, out) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/isodoc/rsd/base_convert.rb', line 21

def executivesummary docxml, out
  f = docxml.at(ns("//executivesummary")) || return
  title_attr = { class: "IntroTitle" }
  page_break(out)
  out.div **{ class: "Section3", id: f["id"] } do |div|
    clause_name(nil, f&.at(ns("./title")), div, title_attr)
    f.elements.each do |e|
      parse(e, div) unless e.name == "title"
    end
  end
end

#initial_anchor_names(d) ⇒ Object


33
34
35
36
37
38
39
# File 'lib/isodoc/rsd/base_convert.rb', line 33

def initial_anchor_names(d)
  preface_names(d.at(ns("//executivesummary")))
  super
  sequential_asset_names(
    d.xpath(ns("//preface/abstract | //foreword | //introduction | "\
               "//preface/clause | //acknowledgements | //executivesummary")))
end

#metadata_init(lang, script, labels) ⇒ Object


4
5
6
# File 'lib/isodoc/rsd/base_convert.rb', line 4

def (lang, script, labels)
  @meta = Metadata.new(lang, script, labels)
end

#section_names1(clause, num, level) ⇒ Object


45
46
47
48
49
50
51
52
53
# File 'lib/isodoc/rsd/base_convert.rb', line 45

def section_names1(clause, num, level)
  @anchors[clause["id"]] =
    { label: num, level: level, xref: num }
  # subclauses are not prefixed with "Clause"
  clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).
    each_with_index do |c, i|
    section_names1(c, "#{num}.#{i + 1}", level + 1)
  end
end