Class: IsoDoc::ITU::HtmlConvert

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

Overview

A Converter implementation that generates HTML output, and a document schema encapsulation of the document for validation

Constant Summary

Constants included from BaseConvert

BaseConvert::ELSEWHERE_TERMS, BaseConvert::FRONT_CLAUSE, BaseConvert::HERE_TERMS

Instance Method Summary collapse

Methods included from BaseConvert

#annex_name, #biblio_list, #cleanup, #eref_parse, #fileloc, #get_eref_linkend, #i18n_init, #info, #initial_anchor_names, #load_yaml, #metadata_init, #noniso_bibitem_entry, #norm_ref, #norm_ref_preface, #preface, #split_bibitems, #term_cleanup, #term_defs_boilerplate, #termdef_parse, #termdef_parse1, #terms_parse

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



12
13
14
15
# File 'lib/isodoc/itu/html_convert.rb', line 12

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

Instance Method Details

#convert1(docxml, filename, dir) ⇒ Object



17
18
19
20
21
# File 'lib/isodoc/itu/html_convert.rb', line 17

def convert1(docxml, filename, dir)
  FileUtils.cp html_doc_path('Logo_ITU.jpg'), "#{@localdir}/Logo_ITU.jpg"
  @files_to_delete << "#{@localdir}/Logo_ITU.jpg"
  super
end

#default_file_locations(_options) ⇒ Object



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

def default_file_locations(_options)
  {
    htmlstylesheet: html_doc_path("htmlstyle.scss"),
    htmlcoverpage: html_doc_path("html_itu_titlepage.html"),
    htmlintropage: html_doc_path("html_itu_intro.html"),
    scripts: html_doc_path("scripts.html"),
  }
end

#default_fonts(options) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/isodoc/itu/html_convert.rb', line 27

def default_fonts(options)
  {
    bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Open Sans",sans-serif'),
    headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Open Sans",sans-serif'),
    monospacefont: '"Space Mono",monospace'
  }
end

#googlefontsObject



44
45
46
47
48
# File 'lib/isodoc/itu/html_convert.rb', line 44

def googlefonts
  <<~HEAD.freeze
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,800|Space+Mono:400,700" rel="stylesheet">
  HEAD
end

#html_toc(docxml) ⇒ Object



23
24
25
# File 'lib/isodoc/itu/html_convert.rb', line 23

def html_toc(docxml)
  docxml
end

#make_body(xml, docxml) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/isodoc/itu/html_convert.rb', line 50

def make_body(xml, docxml)
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
  xml.body **body_attr do |body|
    make_body1(body, docxml)
    make_body2(body, docxml)
    make_body3(body, docxml)
  end
end

#make_body3(body, docxml) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/isodoc/itu/html_convert.rb', line 59

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