class IsoDoc::Iso::HtmlConvert
Public Class Methods
new(options)
click to toggle source
Calls superclass method
# File lib/isodoc/iso/html_convert.rb, line 11 def initialize(options) @libdir = File.dirname(__FILE__) super end
Public Instance Methods
annex_names(clause, num)
click to toggle source
Calls superclass method
# File lib/isodoc/iso/html_convert.rb, line 87 def annex_names(clause, num) appendix_names(clause, num) super end
annex_names1(clause, num, level)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 110 def annex_names1(clause, num, level) @anchors[clause["id"]] = { label: num, xref: num, level: level } clause.xpath(ns(".//clause")).each_with_index do |c, i| annex_names1(c, "#{num}.#{i + 1}", level + 1) end end
appendix_names(clause, num)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 92 def appendix_names(clause, num) clause.xpath(ns("./appendix")).each_with_index do |c, i| @anchors[c["id"]] = anchor_struct(i + 1, nil, @appendix_lbl) @anchors[c["id"]][:level] = 2 @anchors[c["id"]][:container] = clause["id"] end end
default_file_locations(options)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 24 def default_file_locations(options) { htmlstylesheet: options[:alt] ? html_doc_path("style-human.scss") : html_doc_path("style-iso.scss"), htmlcoverpage: html_doc_path("html_iso_titlepage.html"), htmlintropage: html_doc_path("html_iso_intro.html"), scripts: html_doc_path("scripts.html"), } end
default_fonts(options)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 16 def default_fonts(options) { bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'), headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'), monospacefont: (options[:alt] ? '"Space Mono",monospace' : '"Courier New",monospace'), } end
error_parse(node, out)
click to toggle source
terms not defined in standoc
Calls superclass method
# File lib/isodoc/iso/html_convert.rb, line 79 def error_parse(node, out) case node.name when "appendix" then clause_parse(node, out) else super end end
foreword(isoxml, out)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 56 def foreword(isoxml, out) f = isoxml.at(ns("//foreword")) || return page_break(out) out.div **attr_code(id: f["id"]) do |s| s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl } f.elements.each { |e| parse(e, s) unless e.name == "title" } end end
implicit_reference(b)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 33 def implicit_reference(b) isocode = b.at(ns("./docidentifier")).text isocode == "IEV" end
initial_anchor_names(d)
click to toggle source
Calls superclass method
# File lib/isodoc/iso/html_convert.rb, line 65 def initial_anchor_names(d) super introduction_names(d.at(ns("//introduction"))) end
introduction(isoxml, out)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 38 def introduction(isoxml, out) f = isoxml.at(ns("//introduction")) || return num = f.at(ns(".//clause")) ? "0" : nil title_attr = { class: "IntroTitle" } page_break(out) out.div **{ class: "Section3", id: f["id"] } do |div| # div.h1 "Introduction", **attr_code(title_attr) clause_name(num, @introduction_lbl, div, title_attr) f.elements.each do |e| if e.name == "patent-notice" e.elements.each { |e1| parse(e1, div) } else parse(e, div) unless e.name == "title" end end end end
introduction_names(clause)
click to toggle source
we can reference 0-number clauses in introduction
# File lib/isodoc/iso/html_convert.rb, line 71 def introduction_names(clause) return if clause.nil? clause.xpath(ns("./clause")).each_with_index do |c, i| section_names1(c, "0.#{i + 1}", 2) end end
metadata_init(lang, script, labels)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 7 def metadata_init(lang, script, labels) @meta = Metadata.new(lang, script, labels) end
section_names1(clause, num, level)
click to toggle source
# File lib/isodoc/iso/html_convert.rb, line 100 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")). each_with_index do |c, i| section_names1(c, "#{num}.#{i + 1}", level + 1) end end