Class: IsoDoc::ITU::HtmlConvert

Inherits:
HtmlConvert
  • Object
show all
Includes:
BaseConvert, Init
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::FRONT_CLAUSE, BaseConvert::IGNORE_IDS

Instance Method Summary collapse

Methods included from Init

#fileloc, #i18n_init, #metadata_init, #xref_init

Methods included from BaseConvert

#add_parse, #annex, #annex_name, #annex_obligation_subtitle, #biblio_list, #bracket_if_num, #bracket_opt, #clause, #clause_core, #clausedelim, #cleanup, #del_parse, #doctype_title, #error_parse, #info, #middle_title, #middle_title_recommendation, #middle_title_resolution, #middle_title_resolution_subtitle, #multi_bibitem_ref_code, #nonstd_bibitem, #note_delim, #note_p_parse, #note_parse, #note_parse1, #ol_depth, #para_class, #pref_ref_code, #preface, #reference_format, #reference_format_start, #reference_format_title, #refs_cleanup, #render_multi_identifiers, #scope, #std_bibitem_entry, #table_footnote_reference_format, #term_cleanup, #term_cleanup1, #term_cleanup2, #termdef_parse, #termdef_parse1, #termnote_delim, #title_cleanup, #titlecase

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



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

def initialize(options)
  @libdir = File.dirname(__FILE__)
  @hierarchical_assets = options[:hierarchical_assets]
  super
end

Instance Method Details

#authority_cleanup(docxml) ⇒ Object



68
69
70
71
72
73
# File 'lib/isodoc/itu/html_convert.rb', line 68

def authority_cleanup(docxml)
  dest = docxml.at("//div[@id = 'draft-warning-destination']")
  auth = docxml.at("//div[@id = 'draft-warning']")
  dest and auth and dest.replace(auth.remove)
  super
end

#default_file_locations(_options) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/isodoc/itu/html_convert.rb', line 31

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



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/isodoc/itu/html_convert.rb', line 18

def default_fonts(options)
  {
    bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : 
               '"Times New Roman",serif'),
    headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : 
                 '"Times New Roman",serif'),
                 monospacefont: '"Courier New",monospace',
                 normalfontsize: "14px",
                 monospacefontsize: "0.8em",
                 footnotefontsize: "0.9em",
  }
end

#googlefontsObject



40
41
42
43
44
# File 'lib/isodoc/itu/html_convert.rb', line 40

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

#make_body(xml, docxml) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/isodoc/itu/html_convert.rb', line 46

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



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

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