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

Instance Method Summary collapse

Methods included from Init

#bibrenderer, #fileloc, #i18n_init, #metadata_init, #xref_init

Methods included from BaseConvert

#acknowledgements, #annex, #annex_name, #annex_obligation_subtitle, #biblio_list, #bracket_if_num, #bracket_opt, #clause_attrs, #clausedelim, #cleanup, #dl1, #dl2tbody, #dl_parse, #foreword, #info, #introduction, #nonstd_bibitem, #note_delim, #note_p_parse, #note_parse, #note_parse1, #ol_depth, #para_class, #pref_ref_code, #preface_normal, #refs_cleanup, #std_bibitem_entry, #table_footnote_reference_format, #term_cleanup, #term_cleanup1, #term_cleanup2, #termdef_parse, #termdef_parse1, #termnote_delim, #title_cleanup, #unbracket

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



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

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

Instance Method Details

#authority_cleanup(docxml) ⇒ Object



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

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

#clause(node, out) ⇒ Object



67
68
69
70
# File 'lib/isodoc/itu/html_convert.rb', line 67

def clause(node, out)
  node["type"] == "keyword" and return
  super
end

#convert1(docxml, filename, dir) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/isodoc/itu/html_convert.rb', line 72

def convert1(docxml, filename, dir)
  case @doctype
  when "contribution"
    @wordcoverpage = nil
    @wordintropage = nil
  end
  super
end

#default_file_locations(_options) ⇒ Object



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

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"),
  }
end

#default_fonts(options) ⇒ Object



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

def default_fonts(options)
  {
    bodyfont: (if options[:script] == "Hans"
                 '"Source Han Sans",serif'
               else
                 '"Times New Roman",serif'
               end),
    headerfont: (if options[:script] == "Hans"
                   '"Source Han Sans",sans-serif'
                 else
                   '"Times New Roman",serif'
                 end),
    monospacefont: '"Courier New",monospace',
    normalfontsize: "14px",
    monospacefontsize: "0.8em",
    footnotefontsize: "0.9em",
  }
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

#make_body(xml, docxml) ⇒ Object



50
51
52
53
54
55
56
57
58
# 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