Module: IsoDoc::Iec::BaseConvert

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

Instance Method Summary collapse

Instance Method Details

#biblio_list(elem, div, biblio) ⇒ Object



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

def biblio_list(elem, div, biblio)
  return super unless @is_iev

  elem.children.each do |b|
    parse(b, div) unless %w(title bibitem).include? b.name
  end
end

#bibliography(isoxml, out) ⇒ Object



46
47
48
# File 'lib/isodoc/iec/base_convert.rb', line 46

def bibliography(isoxml, out)
  return super unless @is_iev
end

#boilerplate(node, out) ⇒ Object



7
8
9
# File 'lib/isodoc/iec/base_convert.rb', line 7

def boilerplate(node, out)
  # processed in foreword instead
end

#clause_attrs(node) ⇒ Object



86
87
88
89
90
# File 'lib/isodoc/iec/base_convert.rb', line 86

def clause_attrs(node)
  ret = super
  node["type"] == "boilerplate_legal" and ret["class"] = "boilerplate_legal"
  ret
end

#foreword(sect, out) ⇒ Object



11
12
13
14
15
16
# File 'lib/isodoc/iec/base_convert.rb', line 11

def foreword(sect, out)
  out.div **attr_code(id: sect ? sect["id"] : "") do |s|
    s.h1(class: "ForewordTitle") { |h1| h1 << @i18n.foreword }
    sect&.elements&.each { |e| parse(e, s) unless e.name == "title" }
  end
end

#middle_title(_isoxml, out) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/isodoc/iec/base_convert.rb', line 18

def middle_title(_isoxml, out)
  title1, title2 = middle_title_parts(out)
  out.p(class: "zzSTDTitle1") do |p|
    p.b { |b| b << title1 }
  end
  if title2
    out.p(class: "zzSTDTitle1") { |p| p << "&#xa0;" }
    out.p(class: "zzSTDTitle2") do |p|
      p.b { |b| b << title2 }
    end
  end
  out.p(class: "zzSTDTitle1") { |p| p << "&#xa0;" }
end

#middle_title_parts(_out) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/isodoc/iec/base_convert.rb', line 32

def middle_title_parts(_out)
  title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "")
  @meta.get[:doctitleintro] and
    title1 = "#{@meta.get[:doctitleintro]} &#x2014; #{title1}"
  title2 = nil
  if @meta.get[:doctitlepart]
    title1 += " &#x2014;"
    title2 = @meta.get[:doctitlepart]&.sub(/\s+$/, "")
    @meta.get[:doctitlepartlabel] and
      title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}"
  end
  [title1, title2]
end

#para_class(node) ⇒ Object



79
80
81
82
83
84
# File 'lib/isodoc/iec/base_convert.rb', line 79

def para_class(node)
  case node["class"]
  when "zzSTDTitle1", "zzSTDTitle2" then "zzSTDTitle1"
  else super
  end
end

#set_termdomain(termdomain) ⇒ Object



75
76
77
# File 'lib/isodoc/iec/base_convert.rb', line 75

def set_termdomain(termdomain)
  return super unless @is_iev
end

#terms_parse(node, out) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/isodoc/iec/base_convert.rb', line 58

def terms_parse(node, out)
  return super unless @is_iev

  page_break(out)
  out.div **attr_code(id: node["id"]) do |div|
    depth = clause_title_depth(node, nil)
    out.send "h#{depth}", class: "zzSTDTitle2" do |p|
      p.b do |b|
        node&.at(ns("./title"))&.children&.each { |c2| parse(c2, b) }
      end
    end
    node.children.reject { |c1| c1.name == "title" }.each do |c1|
      parse(c1, div)
    end
  end
end