Class: IsoDoc::Iso::HtmlConvert

Inherits:
HtmlConvert
  • Object
show all
Includes:
BaseConvert
Defined in:
lib/isodoc/iso/html_convert.rb

Instance Method Summary collapse

Methods included from BaseConvert

#annex_names, #annex_names1, #appendix_names, #boilerplate, #clausedelim, #eref_localities1, #eref_localities1_zh, #error_parse, #example_p_parse, #example_parse, #example_parse1, #example_span_label, #foreword, #implicit_reference, #initial_anchor_names, #introduction, #introduction_names, #metadata_init, #node_begins_with_para, #prefix_container, #section_names1, #term_parse, #termexamples_before_termnotes

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



8
9
10
11
# File 'lib/isodoc/iso/html_convert.rb', line 8

def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
end

Instance Method Details

#authority_cleanup(docxml) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/isodoc/iso/html_convert.rb', line 61

def authority_cleanup(docxml)
  dest = docxml.at("//div[@id = 'copyright']")
  auth = docxml.at("//div[@class = 'copyright']")
  auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
  dest and auth and dest.replace(auth.remove)
  dest = docxml.at("//div[@id = 'license']")
  auth = docxml.at("//div[@class = 'license']")
  auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
  dest and auth and dest.replace(auth.remove)
end

#default_file_locations(options) ⇒ Object



24
25
26
27
28
29
30
31
32
# 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) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/isodoc/iso/html_convert.rb', line 13

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

#html_preface(docxml) ⇒ Object



55
56
57
58
59
# File 'lib/isodoc/iso/html_convert.rb', line 55

def html_preface(docxml)
  super
  authority_cleanup(docxml)
  docxml
end

#insertall_after_here(node, insert, name) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/isodoc/iso/html_convert.rb', line 34

def insertall_after_here(node, insert, name)
  node.children.each do |n|
    next unless n.name == name
    insert.next = n.remove
    insert = n
  end
  insert
end

#make_body3(body, docxml) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/isodoc/iso/html_convert.rb', line 43

def make_body3(body, docxml)
  body.div **{ class: "main-section" } do |div3|
    boilerplate docxml, div3
    abstract docxml, div3
    foreword docxml, div3
    introduction docxml, div3
    middle docxml, div3
    footnotes div3
    comments div3
  end
end