Module: IsoDoc::Iec::BaseConvert
- Included in:
- HtmlConvert, WordConvert
- Defined in:
- lib/isodoc/iec/base_convert.rb
Instance Method Summary collapse
- #biblio_list(elem, div, biblio) ⇒ Object
- #bibliography(isoxml, out) ⇒ Object
- #boilerplate(node, out) ⇒ Object
- #foreword(isoxml, out) ⇒ Object
- #foreword1(sect, boilerplate, out) ⇒ Object
- #iec_orgname(out) ⇒ Object
- #middle_title(_isoxml, out) ⇒ Object
- #middle_title_parts(_out) ⇒ Object
- #set_termdomain(termdomain) ⇒ Object
- #terms_parse(node, out) ⇒ Object
Instance Method Details
#biblio_list(elem, div, biblio) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/isodoc/iec/base_convert.rb', line 69 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
65 66 67 |
# File 'lib/isodoc/iec/base_convert.rb', line 65 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 |
#foreword(isoxml, out) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/isodoc/iec/base_convert.rb', line 11 def foreword(isoxml, out) f = isoxml.at(ns("//foreword")) b = isoxml.at(ns("//boilerplate/legal-statement")) page_break(out) iec_orgname(out) middle_title(isoxml, out) foreword1(f, b, out) end |
#foreword1(sect, boilerplate, out) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/isodoc/iec/base_convert.rb', line 20 def foreword1(sect, boilerplate, out) out.div **attr_code(id: sect ? sect["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| boilerplate&.elements&.each { |e| parse(e, s1) } end sect&.elements&.each { |e| parse(e, s) unless e.name == "title" } end end |
#iec_orgname(out) ⇒ Object
31 32 33 34 35 |
# File 'lib/isodoc/iec/base_convert.rb', line 31 def iec_orgname(out) out.p(**{ class: "zzSTDTitle1" }) { |p| p << @i18n.get["IEC"] } out.p(**{ class: "zzSTDTitle1" }) { |p| p << "____________" } out.p(**{ class: "zzSTDTitle1" }) { |p| p << " " } end |
#middle_title(_isoxml, out) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/isodoc/iec/base_convert.rb', line 37 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 << " " } out.p(**{ class: "zzSTDTitle2" }) do |p| p.b { |b| b << title2 } end end out.p(**{ class: "zzSTDTitle1" }) { |p| p << " " } end |
#middle_title_parts(_out) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/isodoc/iec/base_convert.rb', line 51 def middle_title_parts(_out) title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "") @meta.get[:doctitleintro] and title1 = "#{@meta.get[:doctitleintro]} — #{title1}" title2 = nil if @meta.get[:doctitlepart] title1 += " —" title2 = @meta.get[:doctitlepart]&.sub(/\s+$/, "") @meta.get[:doctitlepartlabel] and title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}" end [title1, title2] end |
#set_termdomain(termdomain) ⇒ Object
94 95 96 |
# File 'lib/isodoc/iec/base_convert.rb', line 94 def set_termdomain(termdomain) return super unless @is_iev end |
#terms_parse(node, out) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/isodoc/iec/base_convert.rb', line 77 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 |