Class: IsoDoc::IEEE::HtmlConvert
- Inherits:
-
HtmlConvert
- Object
- HtmlConvert
- IsoDoc::IEEE::HtmlConvert
show all
- Includes:
- BaseConvert, Init
- Defined in:
- lib/isodoc/ieee/html_convert.rb
Instance Method Summary
collapse
Methods included from Init
#fileloc, #i18n_init, #metadata_init, #std_docid_sdo, #std_docid_semantic, #std_docid_semantic1, #std_docid_semantic_full, #xref_init
#bracket_if_num, #clause_attrs, #example_label, #middle_clause, #note_delim, #note_p_parse, #note_parse1, #omit_docid_prefix, #para_attrs, #scope, #termnote_delim, #top_element_render
Constructor Details
#initialize(options) ⇒ HtmlConvert
Returns a new instance of HtmlConvert.
7
8
9
10
|
# File 'lib/isodoc/ieee/html_convert.rb', line 7
def initialize(options)
@libdir = File.dirname(__FILE__)
super
end
|
Instance Method Details
#affiliation_table(html) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/isodoc/ieee/html_convert.rb', line 48
def affiliation_table(html)
html.xpath("//p[@type = 'officeorgrepmemberhdr']").each do |p|
affiliation_table1(p)
end
html
end
|
#affiliation_table1(para) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/isodoc/ieee/html_convert.rb', line 55
def affiliation_table1(para)
ret = "<table><thead>#{para_to_tr(para)}</thead><tbody>"
n = para.next_element
while n&.name == "p" && n["type"] == "officeorgrepmember"
n1 = n.next_element
ret += para_to_tr(n.remove)
n = n1
end
ret += "</tbody></table>"
para.replace(ret)
end
|
#clausedelimspace(node, out) ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/isodoc/ieee/html_convert.rb', line 76
def clausedelimspace(node, out)
if node.at("./ancestor::xmlns:p[@type = 'officeorgrepmemberhdr' " \
"or @type = 'officeorgrepmember']")
out.tab
else super
end
end
|
#default_file_locations(_options) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/isodoc/ieee/html_convert.rb', line 31
def default_file_locations(_options)
{
htmlstylesheet: html_doc_path("htmlstyle.scss"),
htmlcoverpage: html_doc_path("html_ieee_titlepage.html"),
htmlintropage: html_doc_path("html_ieee_intro.html"),
}
end
|
#default_fonts(options) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/isodoc/ieee/html_convert.rb', line 12
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
|
#html_cleanup(html) ⇒ Object
39
40
41
|
# File 'lib/isodoc/ieee/html_convert.rb', line 39
def html_cleanup(html)
para_type_strip(affiliation_table(super))
end
|
#para_to_tr(para) ⇒ Object
67
68
69
70
71
72
73
74
|
# File 'lib/isodoc/ieee/html_convert.rb', line 67
def para_to_tr(para)
ret = para.children.each_with_object([[]]) do |c, m|
if c.name == "tab" then m << []
else m[-1] << to_xml(c)
end
end.map { |c| "<td>#{c.join}</td>" }
"<tr>#{ret.join}</tr>"
end
|
#para_type_strip(html) ⇒ Object
43
44
45
46
|
# File 'lib/isodoc/ieee/html_convert.rb', line 43
def para_type_strip(html)
html.xpath("//p[@type]").each { |p| p.delete("type") }
html
end
|