metanorma-ieee 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/html2doc/ieee_wp/lists.rb +22 -0
- data/lib/html2doc/ieee_wp.rb +6 -0
- data/lib/isodoc/ieee/base_convert.rb +5 -0
- data/lib/isodoc/ieee/html/header_wp.html +348 -0
- data/lib/isodoc/ieee/html/ieee_wp.css +3316 -0
- data/lib/isodoc/ieee/html/ieee_wp.scss +3174 -0
- data/lib/isodoc/ieee/html/word_ieee_colophon_wp.html +129 -0
- data/lib/isodoc/ieee/html/word_ieee_intro_wp.html +142 -0
- data/lib/isodoc/ieee/html/word_ieee_titlepage_wp.html +333 -0
- data/lib/isodoc/ieee/html/wordstyle_wp.css +5795 -0
- data/lib/isodoc/ieee/html/wordstyle_wp.scss +5357 -0
- data/lib/isodoc/ieee/html/wp_image001.emz +0 -0
- data/lib/isodoc/ieee/html/wp_image003.emz +0 -0
- data/lib/isodoc/ieee/html/wp_image008.emz +0 -0
- data/lib/isodoc/ieee/i18n-en.yaml +1 -0
- data/lib/isodoc/ieee/metadata.rb +15 -5
- data/lib/isodoc/ieee/presentation_xml_convert.rb +44 -5
- data/lib/isodoc/ieee/word_authority.rb +14 -13
- data/lib/isodoc/ieee/word_cleanup.rb +43 -20
- data/lib/isodoc/ieee/word_cleanup_blocks.rb +23 -17
- data/lib/isodoc/ieee/word_convert.rb +26 -5
- data/lib/isodoc/ieee/word_wp_cleanup.rb +220 -0
- data/lib/isodoc/ieee/word_wp_convert.rb +115 -0
- data/lib/isodoc/ieee/xref.rb +24 -2
- data/lib/metanorma/ieee/basicdoc.rng +18 -2
- data/lib/metanorma/ieee/biblio.rng +1 -1
- data/lib/metanorma/ieee/boilerplate_wp.adoc +95 -0
- data/lib/metanorma/ieee/cleanup.rb +10 -6
- data/lib/metanorma/ieee/cleanup_ref.rb +8 -0
- data/lib/metanorma/ieee/converter.rb +5 -2
- data/lib/metanorma/ieee/front.rb +13 -12
- data/lib/metanorma/ieee/isodoc.rng +18 -1
- data/lib/metanorma/ieee/validate.rb +5 -5
- data/lib/metanorma/ieee/version.rb +1 -1
- data/lib/metanorma-ieee.rb +1 -0
- data/lib/relaton/render/config.yml +6 -6
- metadata +18 -2
Binary file
|
Binary file
|
Binary file
|
data/lib/isodoc/ieee/metadata.rb
CHANGED
@@ -7,11 +7,21 @@ module IsoDoc
|
|
7
7
|
def initialize(lang, script, i18n, fonts_options = {})
|
8
8
|
super
|
9
9
|
@metadata[:issueddate] = "<Date Approved>"
|
10
|
+
logos
|
11
|
+
end
|
12
|
+
|
13
|
+
def logos
|
14
|
+
here = File.join(File.dirname(__FILE__), "html")
|
15
|
+
%i(wp_image001_emz wp_image003_emz wp_image008_emz)
|
16
|
+
.each do |w|
|
17
|
+
img = w.to_s.sub("_emz", ".emz")
|
18
|
+
set(w, File.expand_path(File.join(here, img)))
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
22
|
def bibdate(isoxml, _out)
|
13
23
|
isoxml.xpath(ns("//bibdata/date[@format = 'ddMMMyyyy']")).each do |d|
|
14
|
-
set("#{d['type'].gsub(
|
24
|
+
set("#{d['type'].gsub('-', '_')}date".to_sym, Common::date_range(d))
|
15
25
|
end
|
16
26
|
draft = isoxml.at(ns("//bibdata/date[@type = 'issued']")) ||
|
17
27
|
isoxml.at(ns("//bibdata/date[@type = 'circulated']")) ||
|
@@ -42,25 +52,25 @@ module IsoDoc
|
|
42
52
|
end
|
43
53
|
|
44
54
|
def society(xml)
|
45
|
-
society = xml.at(ns("//bibdata/ext/editorialgroup/"\
|
55
|
+
society = xml.at(ns("//bibdata/ext/editorialgroup/" \
|
46
56
|
"society"))&.text || "<Society>"
|
47
57
|
set(:society, society)
|
48
58
|
end
|
49
59
|
|
50
60
|
def tc(xml)
|
51
|
-
tc = xml.at(ns("//bibdata/ext/editorialgroup/"\
|
61
|
+
tc = xml.at(ns("//bibdata/ext/editorialgroup/" \
|
52
62
|
"committee"))&.text || "<Committee Name>"
|
53
63
|
set(:technical_committee, tc)
|
54
64
|
end
|
55
65
|
|
56
66
|
def wg(xml)
|
57
|
-
wg = xml.at(ns("//bibdata/ext/editorialgroup/"\
|
67
|
+
wg = xml.at(ns("//bibdata/ext/editorialgroup/" \
|
58
68
|
"working-group")) or return nil
|
59
69
|
set(:working_group, wg.text)
|
60
70
|
end
|
61
71
|
|
62
72
|
def bg(xml)
|
63
|
-
bg = xml.at(ns("//bibdata/ext/editorialgroup/"\
|
73
|
+
bg = xml.at(ns("//bibdata/ext/editorialgroup/" \
|
64
74
|
"balloting-group")) or return nil
|
65
75
|
set(:balloting_group, bg.text)
|
66
76
|
set(:balloting_group_type, bg["type"])
|
@@ -39,9 +39,8 @@ module IsoDoc
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def eref_localities1(opt)
|
42
|
-
|
43
|
-
|
44
|
-
opt[:type] = opt[:type].downcase
|
42
|
+
opt[:type] == "anchor" and return nil
|
43
|
+
opt[:type].downcase!
|
45
44
|
opt[:lang] == "zh" and return l10n(eref_localities1_zh(opt))
|
46
45
|
ret = ""
|
47
46
|
opt[:node]["droploc"] != "true" &&
|
@@ -80,6 +79,23 @@ module IsoDoc
|
|
80
79
|
end
|
81
80
|
|
82
81
|
def annex1(elem)
|
82
|
+
if @doctype == "whitepaper"
|
83
|
+
annex1_whitepaper(elem)
|
84
|
+
else
|
85
|
+
annex1_default(elem)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def annex1_whitepaper(elem)
|
90
|
+
lbl = @xrefs.anchor(elem["id"], :label)
|
91
|
+
if t = elem.at(ns("./title"))
|
92
|
+
t.name = "variant-title"
|
93
|
+
t["type"] = "sub"
|
94
|
+
end
|
95
|
+
elem.children.first.previous = "<title>#{lbl}</title>"
|
96
|
+
end
|
97
|
+
|
98
|
+
def annex1_default(elem)
|
83
99
|
lbl = @xrefs.anchor(elem["id"], :label)
|
84
100
|
if t = elem.at(ns("./title"))
|
85
101
|
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
@@ -164,14 +180,37 @@ module IsoDoc
|
|
164
180
|
end
|
165
181
|
|
166
182
|
def middle_title(docxml)
|
167
|
-
s = docxml
|
183
|
+
s = middle_title_insert(docxml) or return
|
184
|
+
s.previous = middle_title_body
|
185
|
+
end
|
186
|
+
|
187
|
+
def middle_title_body
|
168
188
|
ret = "<p class='zzSTDTitle1'>#{@meta.get[:full_doctitle]}"
|
169
189
|
@meta.get[:amd] || @meta.get[:corr] and ret += "<br/>"
|
170
190
|
@meta.get[:amd] and ret += "Amendment #{@meta.get[:amd]}"
|
171
191
|
@meta.get[:amd] && @meta.get[:corr] and ret += " "
|
172
192
|
@meta.get[:corr] and ret += "Corrigenda #{@meta.get[:corr]}"
|
173
193
|
ret += "</p>"
|
174
|
-
|
194
|
+
ret
|
195
|
+
end
|
196
|
+
|
197
|
+
def middle_title_insert(docxml)
|
198
|
+
s = docxml.at(ns("//sections")) or return
|
199
|
+
s.children.first
|
200
|
+
end
|
201
|
+
|
202
|
+
def preface_rearrange(doc)
|
203
|
+
move_abstract(doc)
|
204
|
+
super
|
205
|
+
end
|
206
|
+
|
207
|
+
def move_abstract(doc)
|
208
|
+
doc.at(ns("//bibdata/ext/doctype"))&.text == "whitepaper" or return
|
209
|
+
source = doc.at(ns("//preface/abstract")) or return
|
210
|
+
dest = doc.at(ns("//sections")) ||
|
211
|
+
doc.at(ns("//preface")).after("<sections> </sections>").next_element
|
212
|
+
dest.children.empty? and dest.children = " "
|
213
|
+
dest.children.first.next = source
|
175
214
|
end
|
176
215
|
|
177
216
|
include Init
|
@@ -71,7 +71,7 @@ module IsoDoc
|
|
71
71
|
def officemember_style(docxml)
|
72
72
|
docxml.xpath("//p[@type = 'officemember' or @type = 'officeorgmember']")
|
73
73
|
.each do |p|
|
74
|
-
p["class"] =
|
74
|
+
p["class"] = stylesmap[:nameslist]
|
75
75
|
end
|
76
76
|
docxml.xpath("//p[@type = 'emeritus_sign']").each do |p|
|
77
77
|
p["class"] = "IEEEStdsParaMemEmeritus"
|
@@ -80,20 +80,19 @@ module IsoDoc
|
|
80
80
|
|
81
81
|
def officeorgrep_style(docxml)
|
82
82
|
docxml.xpath("//p[@type = 'officeorgrepmemberhdr']").each do |p|
|
83
|
-
p["class"] =
|
83
|
+
p["class"] = stylesmap[:nameslist]
|
84
84
|
p["style"] =
|
85
85
|
"margin-bottom:6.0pt;tab-stops:right 432.0pt;"
|
86
86
|
end
|
87
87
|
docxml.xpath("//p[@type = 'officeorgrepmember']").each do |p|
|
88
|
-
p["class"] =
|
88
|
+
p["class"] = stylesmap[:nameslist]
|
89
89
|
p["style"] =
|
90
90
|
"margin-top:6.0pt;tab-stops:right dotted 432.0pt;"
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
def three_column_officemembers(div)
|
95
|
-
|
96
|
-
|
95
|
+
div or return
|
97
96
|
ret = three_column_officemembers_split(div)
|
98
97
|
three_column_officemembers_render(div, ret)
|
99
98
|
end
|
@@ -128,6 +127,7 @@ module IsoDoc
|
|
128
127
|
end
|
129
128
|
end
|
130
129
|
|
130
|
+
# STYLE
|
131
131
|
def feedback_table1(trow)
|
132
132
|
trow.name = "p"
|
133
133
|
trow["class"] = "IEEEStdsCRTextReg"
|
@@ -149,6 +149,7 @@ module IsoDoc
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
+
# STYLE
|
152
153
|
def feedback_style1(div, idx)
|
153
154
|
div.xpath(".//p").each_with_index do |p, j|
|
154
155
|
p["class"] = idx == 4 ? "IEEEStdsCRTextItal" : "IEEEStdsCRTextReg"
|
@@ -160,7 +161,7 @@ module IsoDoc
|
|
160
161
|
|
161
162
|
def authority_cleanup1(docxml, klass)
|
162
163
|
dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
|
163
|
-
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' "\
|
164
|
+
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' " \
|
164
165
|
"or @class = 'boilerplate-#{klass}']")
|
165
166
|
auth&.xpath(".//h1[not(text())] | .//h2[not(text())]")&.each(&:remove)
|
166
167
|
authority_cleanup_hdr(auth)
|
@@ -171,7 +172,7 @@ module IsoDoc
|
|
171
172
|
(1..2).each do |i|
|
172
173
|
auth&.xpath(".//h#{i}")&.each do |h|
|
173
174
|
h.name = "p"
|
174
|
-
h["class"] = "
|
175
|
+
h["class"] = "level#{i}frontmatter"
|
175
176
|
end
|
176
177
|
end
|
177
178
|
end
|
@@ -191,18 +192,18 @@ module IsoDoc
|
|
191
192
|
def abstract_cleanup1(source, dest)
|
192
193
|
source.elements.reject { |e| %w(h1 h2).include?(e.name) }.each do |e|
|
193
194
|
e1 = e.dup
|
194
|
-
e1.xpath(".//p").each do |p|
|
195
|
+
e1.xpath("self::p | .//p").each do |p|
|
196
|
+
p["class"] = stylesmap[:abstract]
|
195
197
|
p["style"] ||= ""
|
196
|
-
p["style"] =
|
198
|
+
p["style"] = "font-family: 'Arial', sans-serif;#{p['style']}"
|
197
199
|
end
|
198
|
-
|
199
|
-
dest << e1
|
200
|
+
dest and dest << e1
|
200
201
|
end
|
201
202
|
end
|
202
203
|
|
203
204
|
def abstract_header(dest)
|
204
205
|
dest.elements.first.children.first.previous =
|
205
|
-
"<span class='IEEEStdsAbstractHeader'><span lang='EN-US'>"\
|
206
|
+
"<span class='IEEEStdsAbstractHeader'><span lang='EN-US'>" \
|
206
207
|
"Abstract:</span></span> "
|
207
208
|
end
|
208
209
|
|
@@ -221,7 +222,7 @@ module IsoDoc
|
|
221
222
|
dest.replace(intro.remove)
|
222
223
|
i = docxml.at("//h1[@class = 'IntroTitle']")
|
223
224
|
if i.next_element.name == "div" &&
|
224
|
-
i.next_element["class"] ==
|
225
|
+
i.next_element["class"] == stylesmap[:intro]
|
225
226
|
i.next_element.name = "p"
|
226
227
|
end
|
227
228
|
end
|
@@ -3,7 +3,7 @@ module IsoDoc
|
|
3
3
|
class WordConvert < IsoDoc::WordConvert
|
4
4
|
def toWord(result, filename, dir, header)
|
5
5
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
6
|
-
.gsub(
|
6
|
+
.gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
|
7
7
|
@wordstylesheet = wordstylesheet_update
|
8
8
|
::Html2Doc::IEEE.new(
|
9
9
|
filename: filename,
|
@@ -18,7 +18,7 @@ module IsoDoc
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def sourcecode_style
|
21
|
-
|
21
|
+
stylesmap[:Sourcecode]
|
22
22
|
end
|
23
23
|
|
24
24
|
def word_cleanup(docxml)
|
@@ -75,10 +75,10 @@ module IsoDoc
|
|
75
75
|
hdr["style"] = "mso-list:l13 level#{idx} lfo33;"
|
76
76
|
elsif hdr.at("./ancestor::div[@class = 'Section3' or @class = 'WordSectionContents']")
|
77
77
|
hdr.name = "p"
|
78
|
-
hdr["class"] = "
|
78
|
+
hdr["class"] = stylesmap["level#{idx}frontmatter".to_sym]
|
79
79
|
else
|
80
80
|
hdr.name = "p"
|
81
|
-
hdr["class"] = "
|
81
|
+
hdr["class"] = stylesmap["level#{idx}header".to_sym]
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -89,6 +89,7 @@ module IsoDoc
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
# STYLE
|
92
93
|
def div_cleanup(docxml)
|
93
94
|
d = docxml.at("//div[@class = 'WordSection2']" \
|
94
95
|
"[div[@class = 'WordSection2']]") and
|
@@ -102,36 +103,58 @@ module IsoDoc
|
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
106
|
+
def stylesmap
|
107
|
+
{
|
108
|
+
example: "IEEEStdsParagraph",
|
109
|
+
MsoNormal: "IEEEStdsParagraph",
|
110
|
+
NormRef: "IEEEStdsParagraph",
|
111
|
+
Biblio: "IEEEStdsBibliographicEntry",
|
112
|
+
figure: "IEEEStdsImage",
|
113
|
+
formula: "IEEEStdsEquation",
|
114
|
+
Sourcecode: "IEEEStdsComputerCode",
|
115
|
+
TableTitle: "IEEEStdsRegularTableCaption",
|
116
|
+
FigureTitle: "IEEEStdsRegularFigureCaption",
|
117
|
+
admonition: "IEEEStdsWarning",
|
118
|
+
abstract: "IEEEStdsAbstractBody",
|
119
|
+
AbstractTitle: "AbstractTitle",
|
120
|
+
level1frontmatter: "IEEEStdsLevel1frontmatter",
|
121
|
+
level2frontmatter: "IEEEStdsLevel2frontmatter",
|
122
|
+
level3frontmatter: "IEEEStdsLevel3frontmatter",
|
123
|
+
level1header: "IEEEStdsLevel1Header",
|
124
|
+
level2header: "IEEEStdsLevel2Header",
|
125
|
+
level3header: "IEEEStdsLevel3Header",
|
126
|
+
level4header: "IEEEStdsLevel4Header",
|
127
|
+
level5header: "IEEEStdsLevel5Header",
|
128
|
+
level6header: "IEEEStdsLevel6Header",
|
129
|
+
zzSTDTitle1: "IEEEStdsTitle",
|
130
|
+
tabledata_center: "IEEEStdsTableData-Center",
|
131
|
+
tabledata_left: "IEEEStdsTableData-Left",
|
132
|
+
table_head: "IEEEStdsTableLineHead",
|
133
|
+
table_subhead: "IEEEStdsTableLineSubhead",
|
134
|
+
table_columnhead: "IEEEStdsTableColumnHead",
|
135
|
+
nameslist: "IEEEStdsNamesList",
|
136
|
+
intro: "IEEEStdsIntroduction",
|
137
|
+
}
|
138
|
+
end
|
116
139
|
|
117
140
|
def table_toc_class
|
118
|
-
|
141
|
+
[stylesmap[:TableTitle], "TableTitle", "tabletitle"]
|
119
142
|
end
|
120
143
|
|
121
144
|
def figure_toc_class
|
122
|
-
|
145
|
+
[stylesmap[:FigureTitle], "FigureTitle", "figuretitle"]
|
123
146
|
end
|
124
147
|
|
125
148
|
def style_cleanup(docxml)
|
126
149
|
note_style_cleanup(docxml)
|
127
150
|
docxml.xpath("//div[@class = 'formula']/p").each do |p|
|
128
|
-
p["class"] =
|
151
|
+
p["class"] = stylesmap[:formula]
|
129
152
|
end
|
130
|
-
|
153
|
+
stylesmap.each do |k, v|
|
131
154
|
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
132
155
|
end
|
133
156
|
docxml.xpath("//p[not(@class)]").each do |p|
|
134
|
-
p["class"] =
|
157
|
+
p["class"] = stylesmap[:MsoNormal]
|
135
158
|
end
|
136
159
|
end
|
137
160
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module IEEE
|
3
3
|
class WordConvert < IsoDoc::WordConvert
|
4
|
+
# STYLE
|
4
5
|
def admonition_cleanup(docxml)
|
5
6
|
super
|
6
7
|
docxml.xpath("//div[@class = 'zzHelp']").each do |d|
|
7
8
|
d.xpath(".//p").each do |p|
|
8
|
-
|
9
|
-
!p["class"] or next
|
10
|
-
|
9
|
+
[stylesmap[:admonition], stylesmap[:MsoNormal]]
|
10
|
+
.include?(p["class"]) || !p["class"] or next
|
11
11
|
p["class"] = "zzHelp"
|
12
12
|
end
|
13
13
|
end
|
@@ -22,15 +22,20 @@ module IsoDoc
|
|
22
22
|
def thead_cleanup(docxml)
|
23
23
|
docxml.xpath("//thead").each do |h|
|
24
24
|
h.xpath(".//td | .//th").each do |t|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
thead_cell_cleanup(t)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def thead_cell_cleanup(cell)
|
31
|
+
s = stylesmap[:table_columnhead]
|
32
|
+
if cell.at("./p")
|
33
|
+
cell.xpath("./p").each do |p|
|
34
|
+
p["class"] = s
|
33
35
|
end
|
36
|
+
else
|
37
|
+
cell.children =
|
38
|
+
"<p class='#{s}'>#{to_xml(cell.children)}</p>"
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
@@ -63,12 +68,12 @@ module IsoDoc
|
|
63
68
|
end
|
64
69
|
|
65
70
|
def td_style(cell, idx)
|
66
|
-
if cell.name == "th" && idx.zero? then
|
67
|
-
elsif cell.name == "th" then
|
71
|
+
if cell.name == "th" && idx.zero? then stylesmap[:table_head]
|
72
|
+
elsif cell.name == "th" then stylesmap[:table_subhead]
|
68
73
|
elsif cell["align"] == "center" ||
|
69
|
-
|
70
|
-
|
71
|
-
else
|
74
|
+
cell["style"].include?("text-align:center")
|
75
|
+
stylesmap[:tabledata_center]
|
76
|
+
else stylesmap[:tabledata_left]
|
72
77
|
end
|
73
78
|
end
|
74
79
|
|
@@ -95,7 +100,7 @@ module IsoDoc
|
|
95
100
|
def example_caption(docxml)
|
96
101
|
docxml.xpath("//p[@class = 'example-title']").each do |s|
|
97
102
|
s.children = "<em>#{to_xml(s.children)}</em>"
|
98
|
-
s["class"] =
|
103
|
+
s["class"] = stylesmap[:MsoNormal]
|
99
104
|
end
|
100
105
|
end
|
101
106
|
|
@@ -135,6 +140,7 @@ module IsoDoc
|
|
135
140
|
end
|
136
141
|
|
137
142
|
# hardcoded list style for notes
|
143
|
+
# STYLE
|
138
144
|
def note_style_cleanup1(multi, div, seq)
|
139
145
|
div.xpath(".//p[@class = 'Note' or not(@class)]")
|
140
146
|
.each_with_index do |p, i|
|
@@ -3,6 +3,7 @@ require_relative "init"
|
|
3
3
|
require_relative "word_cleanup"
|
4
4
|
require_relative "word_cleanup_blocks"
|
5
5
|
require_relative "word_authority"
|
6
|
+
require_relative "word_wp_convert"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module IEEE
|
@@ -10,6 +11,11 @@ module IsoDoc
|
|
10
11
|
def initialize(options)
|
11
12
|
@libdir = File.dirname(__FILE__)
|
12
13
|
super
|
14
|
+
init_wp(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def init_wp(options)
|
18
|
+
@wp = ::IsoDoc::IEEE::WordWPConvert.new(options)
|
13
19
|
end
|
14
20
|
|
15
21
|
def convert1(docxml, filename, dir)
|
@@ -19,6 +25,18 @@ module IsoDoc
|
|
19
25
|
super
|
20
26
|
end
|
21
27
|
|
28
|
+
def convert(input_filename, file = nil, debug = false,
|
29
|
+
output_filename = nil)
|
30
|
+
file ||= File.read(input_filename, encoding: "utf-8")
|
31
|
+
docxml = Nokogiri::XML(file) { |config| config.huge }
|
32
|
+
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
33
|
+
if @wp && doctype == "whitepaper"
|
34
|
+
@wp.convert(input_filename, file, debug, output_filename)
|
35
|
+
else
|
36
|
+
super
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
22
40
|
def default_fonts(options)
|
23
41
|
{ bodyfont: (if options[:script] == "Hans"
|
24
42
|
'"Source Han Sans",serif'
|
@@ -50,7 +68,7 @@ module IsoDoc
|
|
50
68
|
page_break(out)
|
51
69
|
out.div **attr_code(id: clause["id"], class: "abstract") do |s|
|
52
70
|
clause_name(clause, clause.at(ns("./title")), s,
|
53
|
-
{ class:
|
71
|
+
{ class: stylesmap[:AbstractTitle] })
|
54
72
|
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
|
55
73
|
end
|
56
74
|
end
|
@@ -75,13 +93,14 @@ module IsoDoc
|
|
75
93
|
|
76
94
|
def middle_title_ieee(docxml, out)
|
77
95
|
title = docxml.at(ns("//p[@class = 'zzSTDTitle1']")) or return
|
78
|
-
out.p(class:
|
96
|
+
out.p(class: stylesmap[:zzSTDTitle1],
|
97
|
+
style: "margin-left:0cm;margin-top:70.0pt") do |p|
|
79
98
|
title.children.each { |n| parse(n, p) }
|
80
99
|
end
|
81
100
|
end
|
82
101
|
|
83
102
|
def admonition_name_parse(_node, div, name)
|
84
|
-
div.p class:
|
103
|
+
div.p class: stylesmap[:admonition], style: "text-align:center;" do |p|
|
85
104
|
p.b do |b|
|
86
105
|
name.children.each { |n| parse(n, b) }
|
87
106
|
end
|
@@ -91,8 +110,8 @@ module IsoDoc
|
|
91
110
|
def admonition_class(node)
|
92
111
|
if node["type"] == "editorial" then "zzHelp"
|
93
112
|
elsif node.ancestors("introduction").empty?
|
94
|
-
|
95
|
-
else
|
113
|
+
stylesmap[:admonition]
|
114
|
+
else stylesmap[:intro]
|
96
115
|
end
|
97
116
|
end
|
98
117
|
|
@@ -120,6 +139,7 @@ module IsoDoc
|
|
120
139
|
end
|
121
140
|
end
|
122
141
|
|
142
|
+
# STYLE
|
123
143
|
def formula_where1(out, dterm, ddefn)
|
124
144
|
out.p class: "IEEEStdsEquationVariableList" do |p|
|
125
145
|
dterm.children.each { |n| parse(n, p) }
|
@@ -175,6 +195,7 @@ module IsoDoc
|
|
175
195
|
end
|
176
196
|
end
|
177
197
|
|
198
|
+
# STYLE
|
178
199
|
def table_of_contents(clause, out)
|
179
200
|
out.div class: "WordSectionContents" do |div|
|
180
201
|
clause_name(clause, clause.at(ns("./title")), div,
|