isodoc 1.0.14 → 1.0.15
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/isodoc/function/inline.rb +60 -0
- data/lib/isodoc/function/references.rb +2 -3
- data/lib/isodoc/function/section.rb +24 -0
- data/lib/isodoc/function/to_word_html.rb +18 -60
- data/lib/isodoc/function/xref_counter.rb +15 -7
- data/lib/isodoc/function/xref_gen.rb +12 -23
- data/lib/isodoc/html_function/html.rb +2 -1
- data/lib/isodoc/html_function/postprocess.rb +14 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -15
- data/lib/isodoc/word_function/postprocess.rb +17 -0
- data/spec/isodoc/blocks_spec.rb +7 -4
- data/spec/isodoc/cleanup_spec.rb +0 -1
- data/spec/isodoc/postproc_spec.rb +83 -1
- data/spec/isodoc/ref_spec.rb +2 -1
- data/spec/isodoc/section_spec.rb +88 -0
- data/spec/isodoc/xref_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a664c3da9b6df6b4e533371a17c3a407423cafaeb043eacc92a14ff0282113b
|
4
|
+
data.tar.gz: a01075ddc20896c5347367c296379a2ade09177804f37631b386ea92046fd740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901a72db1d909f98dc6e2813ddb5d6ad7eec9feb870f0545d473fd5fc58e9c3e0d065f99c82dac964d06398af988c68b5c0743b19e51bf339ca085bcb7574125
|
7
|
+
data.tar.gz: fb8143ee5d1f5fb2a49c40f1218eeaa0e36a6c9fb9ba0c1abda1ca10154f0816aa0ac76072a2bd58e539c255d6dc85ca28888385a7407992a6502a988a511d03
|
@@ -136,6 +136,66 @@ module IsoDoc::Function
|
|
136
136
|
image_title_parse(out, caption)
|
137
137
|
end
|
138
138
|
|
139
|
+
def smallcap_parse(node, xml)
|
140
|
+
xml.span **{ style: "font-variant:small-caps;" } do |s|
|
141
|
+
node.children.each { |n| parse(n, s) }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def text_parse(node, out)
|
146
|
+
return if node.nil? || node.text.nil?
|
147
|
+
text = node.to_s
|
148
|
+
text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/> ").
|
149
|
+
gsub(/[ ](?=[ ])/, " ") if in_sourcecode
|
150
|
+
out << text
|
151
|
+
end
|
152
|
+
|
153
|
+
def bookmark_parse(node, out)
|
154
|
+
out.a **attr_code(id: node["id"])
|
155
|
+
end
|
156
|
+
|
157
|
+
def keyword_parse(node, out)
|
158
|
+
out.span **{ class: "keyword" } do |s|
|
159
|
+
node.children.each { |n| parse(n, s) }
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def em_parse(node, out)
|
164
|
+
out.i do |e|
|
165
|
+
node.children.each { |n| parse(n, e) }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def strong_parse(node, out)
|
170
|
+
out.b do |e|
|
171
|
+
node.children.each { |n| parse(n, e) }
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def sup_parse(node, out)
|
176
|
+
out.sup do |e|
|
177
|
+
node.children.each { |n| parse(n, e) }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def sub_parse(node, out)
|
182
|
+
out.sub do |e|
|
183
|
+
node.children.each { |n| parse(n, e) }
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def tt_parse(node, out)
|
188
|
+
out.tt do |e|
|
189
|
+
node.children.each { |n| parse(n, e) }
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def strike_parse(node, out)
|
194
|
+
out.s do |e|
|
195
|
+
node.children.each { |n| parse(n, e) }
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
139
199
|
def error_parse(node, out)
|
140
200
|
text = node.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
141
201
|
out.para do |p|
|
@@ -47,10 +47,9 @@ module IsoDoc::Function
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def bibitem_ref_code(b)
|
50
|
-
id = b.at(ns("./docidentifier[
|
50
|
+
id = b.at(ns("./docidentifier[@type = 'metanorma']"))
|
51
|
+
id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
51
52
|
"or @type = 'ISSN' or @type = 'ISBN')]"))
|
52
|
-
id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'ISSN' or "\
|
53
|
-
"@type = 'ISBN')]"))
|
54
53
|
id ||= b.at(ns("./docidentifier"))
|
55
54
|
return id if id
|
56
55
|
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
@@ -180,5 +180,29 @@ module IsoDoc::Function
|
|
180
180
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
181
181
|
end
|
182
182
|
end
|
183
|
+
|
184
|
+
def copyright_parse(node, out)
|
185
|
+
out.div **{class: "boilerplate-copyright"} do |div|
|
186
|
+
node.children.each { |n| parse(n, div) }
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def license_parse(node, out)
|
191
|
+
out.div **{class: "boilerplate-license"} do |div|
|
192
|
+
node.children.each { |n| parse(n, div) }
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def legal_parse(node, out)
|
197
|
+
out.div **{class: "boilerplate-legal"} do |div|
|
198
|
+
node.children.each { |n| parse(n, div) }
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def feedback_parse(node, out)
|
203
|
+
out.div **{class: "boilerplate-feedback"} do |div|
|
204
|
+
node.children.each { |n| parse(n, div) }
|
205
|
+
end
|
206
|
+
end
|
183
207
|
end
|
184
208
|
end
|
@@ -80,6 +80,7 @@ module IsoDoc::Function
|
|
80
80
|
|
81
81
|
def make_body3(body, docxml)
|
82
82
|
body.div **{ class: "main-section" } do |div3|
|
83
|
+
boilerplate docxml, div3
|
83
84
|
abstract docxml, div3
|
84
85
|
foreword docxml, div3
|
85
86
|
introduction docxml, div3
|
@@ -118,67 +119,20 @@ module IsoDoc::Function
|
|
118
119
|
bibliography isoxml, out
|
119
120
|
end
|
120
121
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
def bookmark_parse(node, out)
|
137
|
-
out.a **attr_code(id: node["id"])
|
138
|
-
end
|
139
|
-
|
140
|
-
def keyword_parse(node, out)
|
141
|
-
out.span **{ class: "keyword" } do |s|
|
142
|
-
#s << node.inner_html
|
143
|
-
node.children.each { |n| parse(n, s) }
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def em_parse(node, out)
|
148
|
-
out.i do |e|
|
149
|
-
node.children.each { |n| parse(n, e) }
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def strong_parse(node, out)
|
154
|
-
out.b do |e|
|
155
|
-
node.children.each { |n| parse(n, e) }
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def sup_parse(node, out)
|
160
|
-
out.sup do |e|
|
161
|
-
node.children.each { |n| parse(n, e) }
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def sub_parse(node, out)
|
166
|
-
out.sub do |e|
|
167
|
-
node.children.each { |n| parse(n, e) }
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
def tt_parse(node, out)
|
172
|
-
out.tt do |e|
|
173
|
-
node.children.each { |n| parse(n, e) }
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
def strike_parse(node, out)
|
178
|
-
out.s do |e|
|
179
|
-
node.children.each { |n| parse(n, e) }
|
122
|
+
def boilerplate(node, out)
|
123
|
+
boilerplate = node.at(ns("//boilerplate")) or return
|
124
|
+
out.div **{class: "authority"} do |s|
|
125
|
+
boilerplate.children.each do |n|
|
126
|
+
if n.name == "title"
|
127
|
+
s.h1 do |h|
|
128
|
+
n.children.each { |nn| parse(nn, h) }
|
129
|
+
end
|
130
|
+
else
|
131
|
+
parse(n, s)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
180
135
|
end
|
181
|
-
end
|
182
136
|
|
183
137
|
def parse(node, out)
|
184
138
|
if node.text?
|
@@ -251,6 +205,10 @@ module IsoDoc::Function
|
|
251
205
|
when "index" then index_parse(node, out)
|
252
206
|
when "concept" then concept_parse(node, out)
|
253
207
|
when "termref" then termrefelem_parse(node, out)
|
208
|
+
when "copyright-statement" then copyright_parse(node, out)
|
209
|
+
when "license-statement" then license_parse(node, out)
|
210
|
+
when "legal-statement" then legal_parse(node, out)
|
211
|
+
when "feedback-statement" then feedback_parse(node, out)
|
254
212
|
else
|
255
213
|
error_parse(node, out)
|
256
214
|
end
|
@@ -2,6 +2,14 @@ require "roman-numerals"
|
|
2
2
|
|
3
3
|
module IsoDoc::Function
|
4
4
|
module XrefGen
|
5
|
+
def hiersep
|
6
|
+
"."
|
7
|
+
end
|
8
|
+
|
9
|
+
def hierfigsep
|
10
|
+
"-"
|
11
|
+
end
|
12
|
+
|
5
13
|
class Counter
|
6
14
|
def initialize
|
7
15
|
@num = 0
|
@@ -30,13 +38,13 @@ module IsoDoc::Function
|
|
30
38
|
end
|
31
39
|
|
32
40
|
def listlabel(depth)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
return @num.to_s if [2, 7].include? depth
|
42
|
+
return (96 + @num).chr.to_s if [1, 6].include? depth
|
43
|
+
return (64 + @num).chr.to_s if [4, 9].include? depth
|
44
|
+
return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
|
45
|
+
return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
|
46
|
+
return @num.to_s
|
47
|
+
end
|
40
48
|
end
|
41
49
|
end
|
42
50
|
end
|
@@ -32,7 +32,7 @@ module IsoDoc::Function
|
|
32
32
|
@anchors[n["id"]] = {
|
33
33
|
type: "termexample", label: idx,
|
34
34
|
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
35
|
-
|
35
|
+
"#{@example_xref_lbl} #{c.print}") }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -169,23 +169,23 @@ module IsoDoc::Function
|
|
169
169
|
next if t["id"].nil? || t["id"].empty?
|
170
170
|
id = c.increment(t).print
|
171
171
|
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
172
|
-
|
173
|
-
sequential_permission_names1(t, id, "requirement", @requirement_lbl)
|
174
|
-
sequential_permission_names1(t, id, "recommendation",
|
175
|
-
@recommendation_lbl)
|
172
|
+
sequential_permission_names2(t, id)
|
176
173
|
end
|
177
174
|
end
|
178
175
|
|
176
|
+
def sequential_permission_names2(t, id)
|
177
|
+
sequential_permission_names1(t, id, "permission", @permission_lbl)
|
178
|
+
sequential_permission_names1(t, id, "requirement", @requirement_lbl)
|
179
|
+
sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
|
180
|
+
end
|
181
|
+
|
179
182
|
def sequential_permission_names1(block, lbl, klass, label)
|
180
183
|
c = Counter.new
|
181
184
|
block.xpath(ns("./#{klass}")).each do |t|
|
182
185
|
next if t["id"].nil? || t["id"].empty?
|
183
186
|
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
184
187
|
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
185
|
-
|
186
|
-
sequential_permission_names1(t, id, "requirement", @requirement_lbl)
|
187
|
-
sequential_permission_names1(t, id, "recommendation",
|
188
|
-
@recommendation_lbl)
|
188
|
+
sequential_permission_names2(t, id)
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
@@ -198,14 +198,6 @@ module IsoDoc::Function
|
|
198
198
|
sequential_permission_names(clause, "recommendation", @recommendation_lbl)
|
199
199
|
end
|
200
200
|
|
201
|
-
def hiersep
|
202
|
-
"."
|
203
|
-
end
|
204
|
-
|
205
|
-
def hierfigsep
|
206
|
-
"-"
|
207
|
-
end
|
208
|
-
|
209
201
|
def hierarchical_figure_names(clause, num)
|
210
202
|
c = Counter.new
|
211
203
|
j = 0
|
@@ -259,12 +251,9 @@ module IsoDoc::Function
|
|
259
251
|
c = Counter.new
|
260
252
|
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
261
253
|
next if t["id"].nil? || t["id"].empty?
|
262
|
-
|
263
|
-
@anchors[t["id"]] = anchor_struct(
|
264
|
-
|
265
|
-
sequential_permission_names1(t, lbl, "requirement", @requirement_lbl)
|
266
|
-
sequential_permission_names1(t, lbl, "recommendation",
|
267
|
-
@recommendation_lbl)
|
254
|
+
id = "#{num}#{hiersep}#{c.increment(t).print}"
|
255
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
256
|
+
sequential_permission_names2(t, id)
|
268
257
|
end
|
269
258
|
end
|
270
259
|
end
|
@@ -19,6 +19,7 @@ module IsoDoc::HtmlFunction
|
|
19
19
|
|
20
20
|
def make_body3(body, docxml)
|
21
21
|
body.div **{ class: "main-section" } do |div3|
|
22
|
+
boilerplate docxml, div3
|
22
23
|
abstract docxml, div3
|
23
24
|
foreword docxml, div3
|
24
25
|
introduction docxml, div3
|
@@ -91,8 +92,8 @@ module IsoDoc::HtmlFunction
|
|
91
92
|
@sourcecode = true
|
92
93
|
node.children.each { |n| parse(n, div) unless n.name == "name" }
|
93
94
|
@sourcecode = false
|
94
|
-
sourcecode_name_parse(node, div, name) if name
|
95
95
|
end
|
96
|
+
sourcecode_name_parse(node, out, name)
|
96
97
|
end
|
97
98
|
end
|
98
99
|
end
|
@@ -55,9 +55,23 @@ module IsoDoc::HtmlFunction
|
|
55
55
|
docxml.at("//body") << mathjax(@openmathdelim, @closemathdelim)
|
56
56
|
docxml.at("//body") << sourcecode_highlighter
|
57
57
|
html_main(docxml)
|
58
|
+
authority_cleanup(docxml)
|
58
59
|
docxml
|
59
60
|
end
|
60
61
|
|
62
|
+
def authority_cleanup1(docxml, klass)
|
63
|
+
dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
|
64
|
+
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or @class = 'boilerplate-#{klass}']")
|
65
|
+
auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
|
66
|
+
dest and auth and dest.replace(auth.remove)
|
67
|
+
end
|
68
|
+
|
69
|
+
def authority_cleanup(docxml)
|
70
|
+
%w(copyright license legal feedback).each do |t|
|
71
|
+
authority_cleanup1(docxml, t)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
61
75
|
def html_cover(docxml)
|
62
76
|
doc = to_xhtml_fragment(File.read(@htmlcoverpage, encoding: "UTF-8"))
|
63
77
|
d = docxml.at('//div[@class="title-section"]')
|
data/lib/isodoc/version.rb
CHANGED
@@ -10,21 +10,6 @@ module IsoDoc::WordFunction
|
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
|
-
=begin
|
14
|
-
def anchor_names(docxml)
|
15
|
-
super
|
16
|
-
renumber_footnotes(docxml)
|
17
|
-
end
|
18
|
-
|
19
|
-
# undo merger of seen footnotes
|
20
|
-
def renumber_footnotes(docxml)
|
21
|
-
docxml.xpath(ns("//fn[not(ancestor::table or "\
|
22
|
-
"ancestor::figure)]")).each_with_index do |f, i|
|
23
|
-
f["reference"] = (i + 1).to_s
|
24
|
-
end
|
25
|
-
end
|
26
|
-
=end
|
27
|
-
|
28
13
|
def body_attr
|
29
14
|
{ lang: "EN-US", link: "blue", vlink: "#954F72" }
|
30
15
|
end
|
@@ -40,6 +25,7 @@ module IsoDoc::WordFunction
|
|
40
25
|
|
41
26
|
def make_body2(body, docxml)
|
42
27
|
body.div **{ class: "WordSection2" } do |div2|
|
28
|
+
boilerplate docxml, div2
|
43
29
|
abstract docxml, div2
|
44
30
|
foreword docxml, div2
|
45
31
|
introduction docxml, div2
|
@@ -65,9 +65,26 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
65
65
|
word_example_cleanup(docxml)
|
66
66
|
word_pseudocode_cleanup(docxml)
|
67
67
|
word_image_caption(docxml)
|
68
|
+
authority_cleanup(docxml)
|
68
69
|
docxml
|
69
70
|
end
|
70
71
|
|
72
|
+
def authority_cleanup1(docxml, klass)
|
73
|
+
dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
|
74
|
+
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or @class = 'boilerplate-#{klass}']")
|
75
|
+
auth&.xpath(".//h1 | .//h2")&.each do |h|
|
76
|
+
h.name = "p"
|
77
|
+
h["class"] = "TitlePageSubhead"
|
78
|
+
end
|
79
|
+
dest and auth and dest.replace(auth.remove)
|
80
|
+
end
|
81
|
+
|
82
|
+
def authority_cleanup(docxml)
|
83
|
+
%w(copyright license legal feedback).each do |t|
|
84
|
+
authority_cleanup1(docxml, t)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
71
88
|
def style_update(node, css)
|
72
89
|
return unless node
|
73
90
|
node["style"] = node["style"] ? node["style"].sub(/;?$/, ";#{css}") : css
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -369,8 +369,8 @@ B</pre>
|
|
369
369
|
 
|
370
370
|
<br/>
|
371
371
|
 
|
372
|
-
<p class='SourceTitle' style='text-align:center;'>Sample</p>
|
373
372
|
</pre>
|
373
|
+
<p class='SourceTitle' style='text-align:center;'>Sample</p>
|
374
374
|
</div>
|
375
375
|
</div>
|
376
376
|
<p class="zzSTDTitle1"/>
|
@@ -440,7 +440,8 @@ Que?
|
|
440
440
|
<br/>
|
441
441
|
<div>
|
442
442
|
<h1 class="ForewordTitle">Foreword</h1>
|
443
|
-
<pre id="samplecode" class="prettyprint lang-rb"><br/>    <br/>  puts x<br
|
443
|
+
<pre id="samplecode" class="prettyprint lang-rb"><br/>    <br/>  puts x<br/></pre>
|
444
|
+
<p class="SourceTitle" style="text-align:center;">Figure 1 — Ruby <i>code</i></p>
|
444
445
|
<pre class='prettyprint '>
|
445
446
|
<br/>
|
446
447
|
Que?
|
@@ -518,7 +519,8 @@ Que?
|
|
518
519
|
<br/>
|
519
520
|
<div>
|
520
521
|
<h1 class="ForewordTitle">Foreword</h1>
|
521
|
-
<pre id="samplecode" class="prettyprint "><br/>    <br/>  <xml><br
|
522
|
+
<pre id="samplecode" class="prettyprint "><br/>    <br/>  <xml><br/></pre>
|
523
|
+
<p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
522
524
|
</div>
|
523
525
|
<p class="zzSTDTitle1"/>
|
524
526
|
</div>
|
@@ -547,6 +549,7 @@ Que?
|
|
547
549
|
<div>
|
548
550
|
<h1 class="ForewordTitle">Foreword</h1>
|
549
551
|
<pre id="_" class="prettyprint ">puts "Hello, world." <1><br/>   %w{a b c}.each do |x|<br/>     puts x <2><br/>   end<br/><br/><1> This is one callout<br/><2> This is another callout</pre>
|
552
|
+
<p class='SourceTitle' style='text-align:center;'>Figure 1</p>
|
550
553
|
</div>
|
551
554
|
<p class="zzSTDTitle1"/>
|
552
555
|
</div>
|
@@ -1106,8 +1109,8 @@ INPUT
|
|
1106
1109
|
<p class='example-title'>EXAMPLE</p>
|
1107
1110
|
<pre id='B' class='prettyprint '>
|
1108
1111
|
A B C
|
1109
|
-
<p class='SourceTitle' style='text-align:center;'>Label</p>
|
1110
1112
|
</pre>
|
1113
|
+
<p class='SourceTitle' style='text-align:center;'>Label</p>
|
1111
1114
|
<div id='A' class='pseudocode'>
|
1112
1115
|
<p id='_'>
|
1113
1116
|
  
|
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -925,7 +925,9 @@ TOCLEVEL
|
|
925
925
|
<br />
|
926
926
|
<div>
|
927
927
|
<h1 class="ForewordTitle">Foreword</h1>
|
928
|
-
<pre id="samplecode" class="prettyprint "><br />    <br />  <xml> &<br
|
928
|
+
<pre id="samplecode" class="prettyprint "><br />    <br />  <xml> &<br />
|
929
|
+
</pre>
|
930
|
+
<p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
929
931
|
</div>
|
930
932
|
<p class="zzSTDTitle1"></p>
|
931
933
|
</main>
|
@@ -1139,4 +1141,84 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
|
|
1139
1141
|
OUTPUT
|
1140
1142
|
end
|
1141
1143
|
|
1144
|
+
it "cleans up boilerplate" do
|
1145
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).html_preface(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1146
|
+
<html>
|
1147
|
+
<head/>
|
1148
|
+
<body>
|
1149
|
+
<div class="main-section">
|
1150
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1151
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1152
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1153
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1154
|
+
<hr/>
|
1155
|
+
<div id="boilerplate-feedback-destination"/>
|
1156
|
+
<div id="boilerplate-legal-destination"/>
|
1157
|
+
<div id="boilerplate-license-destination"/>
|
1158
|
+
<div id="boilerplate-copyright-destination"/>
|
1159
|
+
</div>
|
1160
|
+
</body>
|
1161
|
+
</html>
|
1162
|
+
INPUT
|
1163
|
+
<main class='main-section'>
|
1164
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1165
|
+
<hr/>
|
1166
|
+
<div id='boilerplate-feedback'>
|
1167
|
+
<h1 class='IntroTitle'>Feedback</h1>
|
1168
|
+
</div>
|
1169
|
+
<div id='boilerplate-legal'>
|
1170
|
+
<h1 class='IntroTitle'>Legal</h1>
|
1171
|
+
</div>
|
1172
|
+
<div id='boilerplate-license'>
|
1173
|
+
<h1 class='IntroTitle'>License</h1>
|
1174
|
+
</div>
|
1175
|
+
<div id='boilerplate-copyright'>
|
1176
|
+
<h1 class='IntroTitle'>Copyright</h1>
|
1177
|
+
</div>
|
1178
|
+
</main>
|
1179
|
+
OUTPUT
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
it "cleans up boilerplate (Word)" do
|
1183
|
+
expect(xmlpp(IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1184
|
+
<html>
|
1185
|
+
<head/>
|
1186
|
+
<body>
|
1187
|
+
<div class="main-section">
|
1188
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1189
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1190
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1191
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1192
|
+
<hr/>
|
1193
|
+
<div id="boilerplate-feedback-destination"/>
|
1194
|
+
<div id="boilerplate-legal-destination"/>
|
1195
|
+
<div id="boilerplate-license-destination"/>
|
1196
|
+
<div id="boilerplate-copyright-destination"/>
|
1197
|
+
</div>
|
1198
|
+
</body>
|
1199
|
+
</html>
|
1200
|
+
INPUT
|
1201
|
+
<html>
|
1202
|
+
<head/>
|
1203
|
+
<body>
|
1204
|
+
<div class='main-section'>
|
1205
|
+
<hr/>
|
1206
|
+
<div id='boilerplate-feedback'>
|
1207
|
+
<p class='TitlePageSubhead'>Feedback</p>
|
1208
|
+
</div>
|
1209
|
+
<div id='boilerplate-legal'>
|
1210
|
+
<p class='TitlePageSubhead'>Legal</p>
|
1211
|
+
</div>
|
1212
|
+
<div id='boilerplate-license'>
|
1213
|
+
<p class='TitlePageSubhead'>License</p>
|
1214
|
+
</div>
|
1215
|
+
<div id='boilerplate-copyright'>
|
1216
|
+
<p class='TitlePageSubhead'>Copyright</p>
|
1217
|
+
</div>
|
1218
|
+
</div>
|
1219
|
+
</body>
|
1220
|
+
</html>
|
1221
|
+
OUTPUT
|
1222
|
+
end
|
1223
|
+
|
1142
1224
|
end
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -112,6 +112,7 @@ RSpec.describe IsoDoc do
|
|
112
112
|
<bibitem id="ref12">
|
113
113
|
<formattedref format="application/x-isodoc+xml">CitationWorks. 2019. <em>How to cite a reference</em>.</formattedref>
|
114
114
|
<docidentifier type="metanorma">[Citn]</docidentifier>
|
115
|
+
<docidentifier type="IETF">RFC 20</docidentifier>
|
115
116
|
</bibitem>
|
116
117
|
|
117
118
|
|
@@ -159,7 +160,7 @@ RSpec.describe IsoDoc do
|
|
159
160
|
<p id="ISO3696" class="Biblio">[3]  ISO 3696, <i>Water for analytical laboratory use</i></p>
|
160
161
|
<p id="ref10" class="Biblio">[10]  <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
|
161
162
|
<p id="ref11" class="Biblio">[5]  IETF RFC 10, <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
|
162
|
-
<p id="ref12" class="Biblio">[
|
163
|
+
<p id="ref12" class="Biblio">[6]  Citn, CitationWorks. 2019. <i>How to cite a reference</i>.</p>
|
163
164
|
</div>
|
164
165
|
<aside id="fn:1" class="footnote">
|
165
166
|
<p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -30,6 +30,28 @@ RSpec.describe IsoDoc do
|
|
30
30
|
it "processes section names" do
|
31
31
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
32
32
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
33
|
+
<boilerplate>
|
34
|
+
<copyright-statement>
|
35
|
+
<clause>
|
36
|
+
<title>Copyright</title>
|
37
|
+
</clause>
|
38
|
+
</copyright-statement>
|
39
|
+
<license-statement>
|
40
|
+
<clause>
|
41
|
+
<title>License</title>
|
42
|
+
</clause>
|
43
|
+
</license-statement>
|
44
|
+
<legal-statement>
|
45
|
+
<clause>
|
46
|
+
<title>Legal</title>
|
47
|
+
</clause>
|
48
|
+
</legal-statement>
|
49
|
+
<feedback-statement>
|
50
|
+
<clause>
|
51
|
+
<title>Feedback</title>
|
52
|
+
</clause>
|
53
|
+
</feedback-statement>
|
54
|
+
</boilerplate>
|
33
55
|
<preface>
|
34
56
|
<abstract obligation="informative">
|
35
57
|
<title>Foreword</title>
|
@@ -98,6 +120,28 @@ RSpec.describe IsoDoc do
|
|
98
120
|
</iso-standard>
|
99
121
|
INPUT
|
100
122
|
#{HTML_HDR}
|
123
|
+
<div class='authority'>
|
124
|
+
<div class='boilerplate-copyright'>
|
125
|
+
<div>
|
126
|
+
<h1>Copyright</h1>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<div class='boilerplate-license'>
|
130
|
+
<div>
|
131
|
+
<h1>License</h1>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
<div class='boilerplate-legal'>
|
135
|
+
<div>
|
136
|
+
<h1>Legal</h1>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<div class='boilerplate-feedback'>
|
140
|
+
<div>
|
141
|
+
<h1>Feedback</h1>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
</div>
|
101
145
|
<br/>
|
102
146
|
<div>
|
103
147
|
<h1 class="AbstractTitle">Abstract</h1>
|
@@ -181,6 +225,28 @@ OUTPUT
|
|
181
225
|
it "processes section names (Word)" do
|
182
226
|
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
183
227
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
228
|
+
<boilerplate>
|
229
|
+
<copyright-statement>
|
230
|
+
<clause>
|
231
|
+
<title>Copyright</title>
|
232
|
+
</clause>
|
233
|
+
</copyright-statement>
|
234
|
+
<license-statement>
|
235
|
+
<clause>
|
236
|
+
<title>License</title>
|
237
|
+
</clause>
|
238
|
+
</license-statement>
|
239
|
+
<legal-statement>
|
240
|
+
<clause>
|
241
|
+
<title>Legal</title>
|
242
|
+
</clause>
|
243
|
+
</legal-statement>
|
244
|
+
<feedback-statement>
|
245
|
+
<clause>
|
246
|
+
<title>Feedback</title>
|
247
|
+
</clause>
|
248
|
+
</feedback-statement>
|
249
|
+
</boilerplate>
|
184
250
|
<preface>
|
185
251
|
<abstract obligation="informative">
|
186
252
|
<title>Foreword</title>
|
@@ -254,6 +320,28 @@ OUTPUT
|
|
254
320
|
</div>
|
255
321
|
<p><br clear="all" class="section"/></p>
|
256
322
|
<div class="WordSection2">
|
323
|
+
<div class='authority'>
|
324
|
+
<div class='boilerplate-copyright'>
|
325
|
+
<div>
|
326
|
+
<h1>Copyright</h1>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
<div class='boilerplate-license'>
|
330
|
+
<div>
|
331
|
+
<h1>License</h1>
|
332
|
+
</div>
|
333
|
+
</div>
|
334
|
+
<div class='boilerplate-legal'>
|
335
|
+
<div>
|
336
|
+
<h1>Legal</h1>
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
<div class='boilerplate-feedback'>
|
340
|
+
<div>
|
341
|
+
<h1>Feedback</h1>
|
342
|
+
</div>
|
343
|
+
</div>
|
344
|
+
</div>
|
257
345
|
<p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
258
346
|
<div>
|
259
347
|
<h1 class="AbstractTitle">Abstract</h1>
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -344,8 +344,8 @@ RSpec.describe IsoDoc do
|
|
344
344
|
  A B C
|
345
345
|
<br/>
|
346
346
|
 
|
347
|
-
<p class='SourceTitle' style='text-align:center;'>Figure 5 — Source! Code!</p>
|
348
347
|
</pre>
|
348
|
+
<p class='SourceTitle' style='text-align:center;'>Figure 5 — Source! Code!</p>
|
349
349
|
<div id='note5' class='example'>
|
350
350
|
<p class='example-title'>EXAMPLE</p>
|
351
351
|
<pre id='note51' class='prettyprint '>
|
@@ -385,8 +385,8 @@ RSpec.describe IsoDoc do
|
|
385
385
|
  A B C
|
386
386
|
<br/>
|
387
387
|
 
|
388
|
-
<p class='SourceTitle' style='text-align:center;'>Figure A.3 — Source! Code!</p>
|
389
388
|
</pre>
|
389
|
+
<p class='SourceTitle' style='text-align:center;'>Figure A.3 — Source! Code!</p>
|
390
390
|
</div>
|
391
391
|
</div>
|
392
392
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|