Class: IsoDoc::UN::HtmlConvert
- Inherits:
-
HtmlConvert
- Object
- HtmlConvert
- IsoDoc::UN::HtmlConvert
show all
- Includes:
- BaseConvert, Init
- Defined in:
- lib/isodoc/un/html_convert.rb
Overview
A Converter implementation that generates HTML output, and a document schema encapsulation of the document for validation
Instance Method Summary
collapse
Methods included from Init
#fileloc, #i18n_init, #metadata_init, #xref_init
#admonition_parse, #bibliography_xpath, #convert_i18n_init1, #inline_header_title, #middle_clause, #norm_ref, #norm_ref_xpath, #plenary?
Constructor Details
#initialize(options) ⇒ HtmlConvert
Returns a new instance of HtmlConvert.
11
12
13
14
|
# File 'lib/isodoc/un/html_convert.rb', line 11
def initialize(options)
@libdir = File.dirname(__FILE__)
super
end
|
Instance Method Details
#default_file_locations(_options) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/isodoc/un/html_convert.rb', line 38
def default_file_locations(_options)
{
htmlstylesheet: html_doc_path("htmlstyle.scss"),
htmlcoverpage: html_doc_path("html_unece_titlepage.html"),
htmlintropage: html_doc_path("html_unece_intro.html"),
}
end
|
#default_fonts(options) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/isodoc/un/html_convert.rb', line 16
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: "15px",
footnotefontsize: "0.9em",
}
end
|
#foreword(clause, out) ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/isodoc/un/html_convert.rb', line 78
def foreword(clause, out)
page_break(out)
out.div **attr_code(id: clause["id"]) do |s|
clause_name(clause, clause.at(ns("./title")) || @i18n.foreword, s,
class: "ForewordTitle")
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
end
end
|
#googlefonts ⇒ Object
46
47
48
49
50
51
|
# File 'lib/isodoc/un/html_convert.rb', line 46
def googlefonts
<<~HEAD.freeze
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,500,700,900" rel="stylesheet">
HEAD
end
|
#introduction(clause, out) ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/isodoc/un/html_convert.rb', line 68
def introduction(clause, out)
page_break(out)
out.div class: "Section3", id: clause["id"] do |div|
clause_name(clause, clause.at(ns("./title")), div, { class: "IntroTitle" })
clause.elements.each do |e|
parse(e, div) unless e.name == "title"
end
end
end
|
#make_body(xml, docxml) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/isodoc/un/html_convert.rb', line 53
def make_body(xml, docxml)
plenary = plenary?(docxml)
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
"xml:lang": "EN-US", class: "container" }
if plenary &&
@htmlcoverpage == html_doc_path("html_unece_titlepage.html")
@htmlcoverpage = html_doc_path("html_unece_plenary_titlepage.html")
end
xml.body **body_attr do |body|
make_body1(body, docxml)
make_body2(body, docxml)
make_body3(body, docxml)
end
end
|