Module: IsoDoc::BSI::BaseConvert

Included in:
HtmlConvert
Defined in:
lib/isodoc/bsi/base_convert.rb

Instance Method Summary collapse

Instance Method Details

#admitted_term_parse(node, out) ⇒ Object



62
63
64
65
66
# File 'lib/isodoc/bsi/base_convert.rb', line 62

def admitted_term_parse(node, out)
  out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
    node.children.each { |c| parse(c, p) }
  end
end

#admonition_name_parse(_node, div, name) ⇒ Object



73
74
75
76
77
78
# File 'lib/isodoc/bsi/base_convert.rb', line 73

def admonition_name_parse(_node, div, name)
  div.b do |b|
    name.children.each { |n| parse(n, b) }
  end
  div << ". "
end

#admonition_parse(node, div) ⇒ Object



68
69
70
71
# File 'lib/isodoc/bsi/base_convert.rb', line 68

def admonition_parse(node, div)
  commentary_parse(node, div) if node["type"] == "commentary"
  super
end

#boilerplate(node, out) ⇒ Object



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

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

#bsi_orgname(out) ⇒ Object



27
28
29
30
31
# File 'lib/isodoc/bsi/base_convert.rb', line 27

def bsi_orgname(out)
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << @i18n.get["BSI"] }
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "____________" }
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
end

#commentary_parse(node, div) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/isodoc/bsi/base_convert.rb', line 80

def commentary_parse(node, div)
  name = node&.at(ns("./name"))&.remove
  div.p do |p|
    name and p.span **{ class: "note_label" } do |s|
      name.children.each { |n| parse(n, s) }
    end
  end
  node.element_children.each { |n| parse(n, div) }
end

#deprecated_term_parse(node, out) ⇒ Object



55
56
57
58
59
60
# File 'lib/isodoc/bsi/base_convert.rb', line 55

def deprecated_term_parse(node, out)
  out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
    p << l10n("#{@i18n.deprecated}: ")
    node.children.each { |c| parse(c, p) }
  end
end

#foreword(isoxml, out) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/isodoc/bsi/base_convert.rb', line 11

def foreword(isoxml, out)
  f = isoxml.at(ns("//foreword"))
  b = isoxml.at(ns("//boilerplate/legal-statement"))
  page_break(out)
  bsi_orgname(out)
  middle_title(isoxml, out)
  out.div **attr_code(id: f ? f["id"] : "") do |s|
    s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
    @meta.get[:doctype] == "Amendment" or
      s.div **attr_code(class: "boilerplate_legal") do |s1|
        b&.elements&.each { |e| parse(e, s1) }
      end
    f&.elements&.each { |e| parse(e, s) unless e.name == "title" }
  end
end

#middle_title(_isoxml, out) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/isodoc/bsi/base_convert.rb', line 33

def middle_title(_isoxml, out)
  title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "")
  @meta.get[:doctitleintro] and
    title1 = "#{@meta.get[:doctitleintro]} &mdash; #{title1}"
  if @meta.get[:doctitlepart]
    title1 += " &mdash;"
    title2 = @meta.get[:doctitlepart]&.sub(/\s+$/, "")
    @meta.get[:doctitlepartlabel] and
      title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}"
  end
  out.p(**{ class: "zzSTDTitle1" }) do |p|
    p.b { |b| b << title1 }
  end
  if @meta.get[:doctitlepart]
    out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
    out.p(**{ class: "zzSTDTitle2" }) do |p|
      p.b { |b| b << title2 }
    end
  end
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
end