isodoc 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/function/section.rb +30 -5
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +2 -0
- data/lib/isodoc/function/xref_gen.rb +2 -1
- data/lib/isodoc/function/xref_sect_gen.rb +35 -15
- data/lib/isodoc/html_function/html.rb +2 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +13 -0
- data/spec/isodoc/blocks_spec.rb +91 -0
- data/spec/isodoc/section_spec.rb +333 -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: 9fa741392b5d89abbcf094f509b027de84b74d1bc543d8395a587b7a556db543
|
4
|
+
data.tar.gz: 4e9b4445b54e495a5cbfbecfa43ccde77b28923b5a569dc8ccbe464f672b05c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb34c6d612f0a0b814df38a0851831fdfbaece00e05532af45445db8e07851aefff9e4cea8af3d7ebb0e48ae6d6a809b6a5c5f03571982e21099eb993ee3a7c1
|
7
|
+
data.tar.gz: 21b9ca3ed5740d82f8f41a26897ed76e5a7b6c6603c79c71db5467b2e9220315cd876b12b78709b9a2415357aa861399cd78000e4050d15fe5c736bd6d1de0a0
|
@@ -9,14 +9,13 @@ module IsoDoc::Function
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def inline_header_title(out, node, c1)
|
12
|
-
title = c1&.content || ""
|
13
12
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
14
13
|
s.b do |b|
|
15
14
|
if anchor(node['id'], :label, false) && !@suppressheadingnumbers
|
16
15
|
b << "#{anchor(node['id'], :label)}#{clausedelim}"
|
17
16
|
clausedelimspace(out)
|
18
17
|
end
|
19
|
-
b
|
18
|
+
c1&.children&.each { |c2| parse(c2, b) }
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -50,7 +49,8 @@ module IsoDoc::Function
|
|
50
49
|
h1 << "#{num}#{clausedelim}"
|
51
50
|
clausedelimspace(h1)
|
52
51
|
end
|
53
|
-
h1 << title
|
52
|
+
title.is_a?(String) ? h1 << title :
|
53
|
+
title&.children&.each { |c2| parse(c2, h1) }
|
54
54
|
end
|
55
55
|
div.parent.at(".//h1")
|
56
56
|
end
|
@@ -63,7 +63,7 @@ module IsoDoc::Function
|
|
63
63
|
isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c|
|
64
64
|
out.div **attr_code(id: c["id"]) do |s|
|
65
65
|
clause_name(anchor(c['id'], :label),
|
66
|
-
c&.at(ns("./title"))
|
66
|
+
c&.at(ns("./title")), s, nil)
|
67
67
|
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
68
68
|
parse(c1, s)
|
69
69
|
end
|
@@ -136,7 +136,7 @@ module IsoDoc::Function
|
|
136
136
|
f = isoxml.at(ns("//sections/definitions")) or return num
|
137
137
|
out.div **attr_code(id: f["id"], class: "Symbols") do |div|
|
138
138
|
num = num + 1
|
139
|
-
clause_name(num, f&.at(ns("./title"))
|
139
|
+
clause_name(num, f&.at(ns("./title")) || @symbols_lbl, div, nil)
|
140
140
|
f.elements.each do |e|
|
141
141
|
parse(e, div) unless e.name == "title"
|
142
142
|
end
|
@@ -172,6 +172,18 @@ module IsoDoc::Function
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
+
def acknowledgements(isoxml, out)
|
176
|
+
f = isoxml.at(ns("//acknowledgements")) || return
|
177
|
+
title_attr = { class: "IntroTitle" }
|
178
|
+
page_break(out)
|
179
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
180
|
+
clause_name(nil, f&.at(ns("./title")), div, title_attr)
|
181
|
+
f.elements.each do |e|
|
182
|
+
parse(e, div) unless e.name == "title"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
175
187
|
def abstract(isoxml, out)
|
176
188
|
f = isoxml.at(ns("//preface/abstract")) || return
|
177
189
|
page_break(out)
|
@@ -181,6 +193,19 @@ module IsoDoc::Function
|
|
181
193
|
end
|
182
194
|
end
|
183
195
|
|
196
|
+
def preface(isoxml, out)
|
197
|
+
title_attr = { class: "IntroTitle" }
|
198
|
+
isoxml.xpath(ns("//preface/clause")).each do |f|
|
199
|
+
page_break(out)
|
200
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
201
|
+
clause_name(nil, f&.at(ns("./title")), div, title_attr)
|
202
|
+
f.elements.each do |e|
|
203
|
+
parse(e, div) unless e.name == "title"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
184
209
|
def copyright_parse(node, out)
|
185
210
|
out.div **{class: "boilerplate-copyright"} do |div|
|
186
211
|
node.children.each { |n| parse(n, div) }
|
@@ -64,6 +64,7 @@ module IsoDoc::Function
|
|
64
64
|
|
65
65
|
CLAUSE_ANCESTOR =
|
66
66
|
".//ancestor::*[local-name() = 'annex' or "\
|
67
|
+
"local-name() = 'acknowledgements' or "\
|
67
68
|
"local-name() = 'appendix' or local-name() = 'foreword' or "\
|
68
69
|
"local-name() = 'introduction' or local-name() = 'terms' or "\
|
69
70
|
"local-name() = 'clause' or local-name() = 'references']/@id".freeze
|
@@ -77,6 +78,7 @@ module IsoDoc::Function
|
|
77
78
|
".//ancestor::*[local-name() = 'annex' or "\
|
78
79
|
"local-name() = 'foreword' or local-name() = 'appendix' or "\
|
79
80
|
"local-name() = 'introduction' or local-name() = 'terms' or "\
|
81
|
+
"local-name() = 'acknowledgements' or "\
|
80
82
|
"local-name() = 'clause' or local-name() = 'references' or "\
|
81
83
|
"local-name() = 'figure' or local-name() = 'formula' or "\
|
82
84
|
"local-name() = 'table' or local-name() = 'example']/@id".freeze
|
@@ -38,7 +38,8 @@ module IsoDoc::Function
|
|
38
38
|
end
|
39
39
|
|
40
40
|
SECTIONS_XPATH =
|
41
|
-
"//foreword | //introduction | //
|
41
|
+
"//foreword | //introduction | //acknowledgements | //preface/clause | "\
|
42
|
+
"//sections/terms | //annex | "\
|
42
43
|
"//sections/clause | //sections/definitions | "\
|
43
44
|
"//bibliography/references | //bibliography/clause".freeze
|
44
45
|
|
@@ -4,8 +4,11 @@ module IsoDoc::Function
|
|
4
4
|
docxml.xpath(ns("//annex")).each_with_index do |c, i|
|
5
5
|
annex_names(c, (65 + i).chr.to_s)
|
6
6
|
end
|
7
|
-
docxml.xpath(
|
8
|
-
|
7
|
+
docxml.xpath(
|
8
|
+
ns("//bibliography/clause[not(xmlns:title = 'Normative References' or "\
|
9
|
+
"xmlns:title = 'Normative references')] |"\
|
10
|
+
"//bibliography/references[not(xmlns:title = 'Normative References'"\
|
11
|
+
" or xmlns:title = 'Normative references')]")).each do |b|
|
9
12
|
preface_names(b)
|
10
13
|
end
|
11
14
|
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
@@ -17,11 +20,20 @@ module IsoDoc::Function
|
|
17
20
|
preface_names(d.at(ns("//preface/abstract")))
|
18
21
|
preface_names(d.at(ns("//foreword")))
|
19
22
|
preface_names(d.at(ns("//introduction")))
|
20
|
-
|
23
|
+
d.xpath(ns("//preface/clause")).each do |c|
|
24
|
+
preface_names(c)
|
25
|
+
end
|
26
|
+
preface_names(d.at(ns("//acknowledgements")))
|
27
|
+
# potentially overridden in middle_section_asset_names()
|
28
|
+
sequential_asset_names(
|
29
|
+
d.xpath(ns("//preface/abstract | //foreword | //introduction | "\
|
30
|
+
"//preface/clause | //acknowledgements")))
|
21
31
|
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
22
32
|
n = section_names(d.at(ns(
|
23
|
-
"//bibliography/clause[title = 'Normative References' or
|
24
|
-
"
|
33
|
+
"//bibliography/clause[title = 'Normative References' or "\
|
34
|
+
"title = 'Normative references'] |"\
|
35
|
+
"//bibliography/references[title = 'Normative References' or "\
|
36
|
+
"title = 'Normative references']")), n, 1)
|
25
37
|
n = section_names(d.at(ns("//sections/terms | "\
|
26
38
|
"//sections/clause[descendant::terms]")), n, 1)
|
27
39
|
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
@@ -36,15 +48,18 @@ module IsoDoc::Function
|
|
36
48
|
ret
|
37
49
|
end
|
38
50
|
|
39
|
-
SUBCLAUSES =
|
51
|
+
SUBCLAUSES =
|
52
|
+
"./clause | ./references | ./term | ./terms | ./definitions".freeze
|
40
53
|
|
41
54
|
# in StanDoc, prefaces have no numbering; they are referenced only by title
|
42
55
|
def preface_names(clause)
|
43
56
|
return if clause.nil?
|
44
57
|
@anchors[clause["id"]] =
|
45
|
-
{ label: nil, level: 1, xref: preface_clause_name(clause),
|
58
|
+
{ label: nil, level: 1, xref: preface_clause_name(clause),
|
59
|
+
type: "clause" }
|
46
60
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
47
|
-
preface_names1(c, c.at(ns("./title"))&.text,
|
61
|
+
preface_names1(c, c.at(ns("./title"))&.text,
|
62
|
+
"#{preface_clause_name(clause)}, #{i+1}", 2)
|
48
63
|
end
|
49
64
|
end
|
50
65
|
|
@@ -54,15 +69,17 @@ module IsoDoc::Function
|
|
54
69
|
{ label: nil, level: level, xref: label, type: "clause" }
|
55
70
|
clause.xpath(ns(SUBCLAUSES)).
|
56
71
|
each_with_index do |c, i|
|
57
|
-
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i+1}",
|
72
|
+
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i+1}",
|
73
|
+
level + 1)
|
58
74
|
end
|
59
75
|
end
|
60
76
|
|
61
77
|
def middle_section_asset_names(d)
|
62
78
|
middle_sections = "//clause[title = 'Scope'] | "\
|
63
|
-
"//
|
64
|
-
"
|
65
|
-
"//sections/terms | "\
|
79
|
+
"//references[title = 'Normative References' or title = "\
|
80
|
+
"'Normative references'] | "\
|
81
|
+
"//sections/terms | //preface/abstract | //foreword | "\
|
82
|
+
"//introduction | //preface/clause | //acknowledgements "\
|
66
83
|
"//sections/definitions | //clause[parent::sections]"
|
67
84
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
68
85
|
end
|
@@ -78,7 +95,8 @@ module IsoDoc::Function
|
|
78
95
|
return num if clause.nil?
|
79
96
|
num = num + 1
|
80
97
|
@anchors[clause["id"]] =
|
81
|
-
{ label: num.to_s, xref: l10n("#{@clause_lbl} #{num}"), level: lvl,
|
98
|
+
{ label: num.to_s, xref: l10n("#{@clause_lbl} #{num}"), level: lvl,
|
99
|
+
type: "clause" }
|
82
100
|
clause.xpath(ns(SUBCLAUSES)).
|
83
101
|
each_with_index do |c, i|
|
84
102
|
section_names1(c, "#{num}.#{i + 1}", lvl + 1)
|
@@ -88,7 +106,8 @@ module IsoDoc::Function
|
|
88
106
|
|
89
107
|
def section_names1(clause, num, level)
|
90
108
|
@anchors[clause["id"]] =
|
91
|
-
{ label: num, level: level, xref: l10n("#{@clause_lbl} #{num}"),
|
109
|
+
{ label: num, level: level, xref: l10n("#{@clause_lbl} #{num}"),
|
110
|
+
type: "clause" }
|
92
111
|
clause.xpath(ns(SUBCLAUSES)).
|
93
112
|
each_with_index do |c, i|
|
94
113
|
section_names1(c, "#{num}.#{i + 1}", level + 1)
|
@@ -102,7 +121,8 @@ module IsoDoc::Function
|
|
102
121
|
end
|
103
122
|
|
104
123
|
def annex_names(clause, num)
|
105
|
-
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
124
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
125
|
+
type: "clause",
|
106
126
|
xref: "#{@annex_lbl} #{num}", level: 1 }
|
107
127
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
108
128
|
annex_names1(c, "#{num}.#{i + 1}", 2)
|
data/lib/isodoc/version.rb
CHANGED
@@ -31,6 +31,8 @@ module IsoDoc::WordFunction
|
|
31
31
|
abstract docxml, div2
|
32
32
|
foreword docxml, div2
|
33
33
|
introduction docxml, div2
|
34
|
+
preface docxml, div2
|
35
|
+
acknowledgements docxml, div2
|
34
36
|
div2.p { |p| p << " " } # placeholder
|
35
37
|
end
|
36
38
|
section_break(body)
|
@@ -58,6 +60,17 @@ module IsoDoc::WordFunction
|
|
58
60
|
classtype
|
59
61
|
end
|
60
62
|
|
63
|
+
def para_parse(node, out)
|
64
|
+
out.p **attr_code(para_attrs(node)) do |p|
|
65
|
+
unless @termdomain.empty?
|
66
|
+
p << "<#{@termdomain}> "
|
67
|
+
@termdomain = ""
|
68
|
+
end
|
69
|
+
node.children.each { |n| parse(n, p) unless n.name == "note" }
|
70
|
+
end
|
71
|
+
node.xpath(ns("./note")).each { |n| parse(n, out) }
|
72
|
+
end
|
73
|
+
|
61
74
|
def section_break(body)
|
62
75
|
body.p do |p|
|
63
76
|
p.br **{ clear: "all", class: "section" }
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -222,6 +222,97 @@ INPUT
|
|
222
222
|
OUTPUT
|
223
223
|
end
|
224
224
|
|
225
|
+
it "processes paragraphs containing notes" do
|
226
|
+
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
227
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
228
|
+
<preface><foreword>
|
229
|
+
<p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
|
230
|
+
<note id="B1"><p id="C1">XYZ1</p></note></p>
|
231
|
+
</foreword></preface>
|
232
|
+
</iso-standard>
|
233
|
+
INPUT
|
234
|
+
#{HTML_HDR}
|
235
|
+
<br/>
|
236
|
+
<div>
|
237
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
238
|
+
<p id='A'>
|
239
|
+
ABC
|
240
|
+
<div id='B' class='Note'>
|
241
|
+
<p>
|
242
|
+
<span class='note_label'>NOTE 1</span>
|
243
|
+
  XYZ
|
244
|
+
</p>
|
245
|
+
</div>
|
246
|
+
<div id='B1' class='Note'>
|
247
|
+
<p>
|
248
|
+
<span class='note_label'>NOTE 2</span>
|
249
|
+
  XYZ1
|
250
|
+
</p>
|
251
|
+
</div>
|
252
|
+
</p>
|
253
|
+
</div>
|
254
|
+
<p class='zzSTDTitle1'/>
|
255
|
+
</div>
|
256
|
+
</body>
|
257
|
+
</html>
|
258
|
+
OUTPUT
|
259
|
+
end
|
260
|
+
|
261
|
+
it "processes paragraphs containing notes (Word)" do
|
262
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
263
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
264
|
+
<preface><foreword>
|
265
|
+
<p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
|
266
|
+
<note id="B1"><p id="C1">XYZ1</p></note></p>
|
267
|
+
</foreword></preface>
|
268
|
+
</iso-standard>
|
269
|
+
INPUT
|
270
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
271
|
+
<head>
|
272
|
+
<style/>
|
273
|
+
</head>
|
274
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
275
|
+
<div class='WordSection1'>
|
276
|
+
<p> </p>
|
277
|
+
</div>
|
278
|
+
<p>
|
279
|
+
<br clear='all' class='section'/>
|
280
|
+
</p>
|
281
|
+
<div class='WordSection2'>
|
282
|
+
<p>
|
283
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
284
|
+
</p>
|
285
|
+
<div>
|
286
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
287
|
+
<p id='A'>ABC </p>
|
288
|
+
<div id='B' class='Note'>
|
289
|
+
<p class='Note'>
|
290
|
+
<span class='note_label'>NOTE 1</span>
|
291
|
+
<span style='mso-tab-count:1'>  </span>
|
292
|
+
XYZ
|
293
|
+
</p>
|
294
|
+
</div>
|
295
|
+
<div id='B1' class='Note'>
|
296
|
+
<p class='Note'>
|
297
|
+
<span class='note_label'>NOTE 2</span>
|
298
|
+
<span style='mso-tab-count:1'>  </span>
|
299
|
+
XYZ1
|
300
|
+
</p>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
<p> </p>
|
304
|
+
</div>
|
305
|
+
<p>
|
306
|
+
<br clear='all' class='section'/>
|
307
|
+
</p>
|
308
|
+
<div class='WordSection3'>
|
309
|
+
<p class='zzSTDTitle1'/>
|
310
|
+
</div>
|
311
|
+
</body>
|
312
|
+
</html>
|
313
|
+
OUTPUT
|
314
|
+
end
|
315
|
+
|
225
316
|
it "processes figures" do
|
226
317
|
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
227
318
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -63,7 +63,13 @@ RSpec.describe IsoDoc do
|
|
63
63
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
64
64
|
<title>Introduction Subsection</title>
|
65
65
|
</clause>
|
66
|
-
</introduction
|
66
|
+
</introduction>
|
67
|
+
<clause id="B1"><title>Dedication</title></clause>
|
68
|
+
<clause id="B2"><title>Note to reader</title></clause>
|
69
|
+
<acknowledgements obligation="informative">
|
70
|
+
<title>Acknowledgements</title>
|
71
|
+
</acknowledgements>
|
72
|
+
</preface><sections>
|
67
73
|
<clause id="D" obligation="normative">
|
68
74
|
<title>Scope</title>
|
69
75
|
<p id="E">Text</p>
|
@@ -159,6 +165,18 @@ RSpec.describe IsoDoc do
|
|
159
165
|
<h2>Introduction Subsection</h2>
|
160
166
|
</div>
|
161
167
|
</div>
|
168
|
+
<br/>
|
169
|
+
<div class='Section3' id='B1'>
|
170
|
+
<h1 class='IntroTitle'>Dedication</h1>
|
171
|
+
</div>
|
172
|
+
<br/>
|
173
|
+
<div class='Section3' id='B2'>
|
174
|
+
<h1 class='IntroTitle'>Note to reader</h1>
|
175
|
+
</div>
|
176
|
+
<br/>
|
177
|
+
<div class='Section3' id=''>
|
178
|
+
<h1 class='IntroTitle'>Acknowledgements</h1>
|
179
|
+
</div>
|
162
180
|
<p class="zzSTDTitle1"/>
|
163
181
|
<div id="D">
|
164
182
|
<h1>1.  Scope</h1>
|
@@ -258,7 +276,13 @@ OUTPUT
|
|
258
276
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
259
277
|
<title>Introduction Subsection</title>
|
260
278
|
</clause>
|
261
|
-
</introduction
|
279
|
+
</introduction>
|
280
|
+
<clause id="B1"><title>Dedication</title></clause>
|
281
|
+
<clause id="B2"><title>Note to reader</title></clause>
|
282
|
+
<acknowledgements obligation="informative">
|
283
|
+
<title>Acknowledgements</title>
|
284
|
+
</acknowledgements>
|
285
|
+
</preface><sections>
|
262
286
|
<clause id="D" obligation="normative">
|
263
287
|
<title>Scope</title>
|
264
288
|
<p id="E">Text</p>
|
@@ -358,6 +382,24 @@ OUTPUT
|
|
358
382
|
<h2>Introduction Subsection</h2>
|
359
383
|
</div>
|
360
384
|
</div>
|
385
|
+
<p>
|
386
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
387
|
+
</p>
|
388
|
+
<div class='Section3' id='B1'>
|
389
|
+
<h1 class='IntroTitle'>Dedication</h1>
|
390
|
+
</div>
|
391
|
+
<p>
|
392
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
393
|
+
</p>
|
394
|
+
<div class='Section3' id='B2'>
|
395
|
+
<h1 class='IntroTitle'>Note to reader</h1>
|
396
|
+
</div>
|
397
|
+
<p>
|
398
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
399
|
+
</p>
|
400
|
+
<div class='Section3' id=''>
|
401
|
+
<h1 class='IntroTitle'>Acknowledgements</h1>
|
402
|
+
</div>
|
361
403
|
<p> </p>
|
362
404
|
</div>
|
363
405
|
<p><br clear="all" class="section"/></p>
|
@@ -425,6 +467,295 @@ OUTPUT
|
|
425
467
|
OUTPUT
|
426
468
|
end
|
427
469
|
|
470
|
+
it "processes footnotes in section names" do
|
471
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true).gsub(%r{<aside .*</aside>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
472
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
473
|
+
<boilerplate>
|
474
|
+
<copyright-statement>
|
475
|
+
<clause>
|
476
|
+
<title>Copyright<fn reference="1"><p>A</p></fn></title>
|
477
|
+
</clause>
|
478
|
+
</copyright-statement>
|
479
|
+
<license-statement>
|
480
|
+
<clause>
|
481
|
+
<title>License<fn reference="2"><p>A</p></fn></title>
|
482
|
+
</clause>
|
483
|
+
</license-statement>
|
484
|
+
<legal-statement>
|
485
|
+
<clause>
|
486
|
+
<title>Legal<fn reference="3"><p>A</p></fn></title>
|
487
|
+
</clause>
|
488
|
+
</legal-statement>
|
489
|
+
<feedback-statement>
|
490
|
+
<clause>
|
491
|
+
<title>Feedback<fn reference="4"><p>A</p></fn></title>
|
492
|
+
</clause>
|
493
|
+
</feedback-statement>
|
494
|
+
</boilerplate>
|
495
|
+
<preface>
|
496
|
+
<abstract obligation="informative">
|
497
|
+
<title>Foreword<fn reference="5"><p>A</p></fn></title>
|
498
|
+
</abstract>
|
499
|
+
<foreword obligation="informative">
|
500
|
+
<title>Foreword<fn reference="6"><p>A</p></fn></title>
|
501
|
+
<p id="A">This is a preamble</p>
|
502
|
+
</foreword>
|
503
|
+
<introduction id="B" obligation="informative">
|
504
|
+
<title>Introduction<fn reference="7"><p>A</p></fn></title><clause id="C" inline-header="false" obligation="informative">
|
505
|
+
<title>Introduction Subsection<fn reference="8"><p>A</p></fn></title>
|
506
|
+
</clause>
|
507
|
+
</introduction></preface><sections>
|
508
|
+
<clause id="D" obligation="normative">
|
509
|
+
<title>Scope<fn reference="9"><p>A</p></fn></title>
|
510
|
+
<p id="E">Text</p>
|
511
|
+
</clause>
|
512
|
+
|
513
|
+
<clause id="H" obligation="normative">
|
514
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms<fn reference="10"><p>A</p></fn></title><terms id="I" obligation="normative">
|
515
|
+
<title>Normal Terms<fn reference="11"><p>A</p></fn></title>
|
516
|
+
<term id="J">
|
517
|
+
<preferred>Term2</preferred>
|
518
|
+
</term>
|
519
|
+
</terms>
|
520
|
+
<definitions id="K">
|
521
|
+
<title>Definitions<fn reference="12"><p>A</p></fn></title>
|
522
|
+
<dl>
|
523
|
+
<dt>Symbol</dt>
|
524
|
+
<dd>Definition</dd>
|
525
|
+
</dl>
|
526
|
+
</definitions>
|
527
|
+
</clause>
|
528
|
+
<definitions id="L">
|
529
|
+
<dl>
|
530
|
+
<dt>Symbol</dt>
|
531
|
+
<dd>Definition</dd>
|
532
|
+
</dl>
|
533
|
+
</definitions>
|
534
|
+
<clause id="M" inline-header="false" obligation="normative">
|
535
|
+
<title>Clause 4<fn reference="13"><p>A</p></fn></title><clause id="N" inline-header="false" obligation="normative">
|
536
|
+
<title>Introduction<fn reference="1"><p>A</p></fn></title>
|
537
|
+
</clause>
|
538
|
+
<clause id="O" inline-header="false" obligation="normative">
|
539
|
+
<title>Clause 4.2<fn reference="14"><p>A</p></fn></title>
|
540
|
+
</clause>
|
541
|
+
<clause id="O1" inline-header="false" obligation="normative">
|
542
|
+
</clause>
|
543
|
+
</clause>
|
544
|
+
|
545
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
546
|
+
<title>Annex<fn reference="15"><p>A</p></fn></title>
|
547
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
548
|
+
<title>Annex A.1<fn reference="16"><p>A</p></fn></title>
|
549
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
550
|
+
<title>Annex A.1a<fn reference="17"><p>A</p></fn></title>
|
551
|
+
</clause>
|
552
|
+
<references id="Q2"><title>Annex Bibliography<fn reference="18"><p>A</p></fn></title></references>
|
553
|
+
</clause>
|
554
|
+
</annex><bibliography><references id="R" obligation="informative">
|
555
|
+
<title>Normative References<fn reference="19"><p>A</p></fn></title>
|
556
|
+
</references><clause id="S" obligation="informative">
|
557
|
+
<title>Bibliography<fn reference="20"><p>A</p></fn></title>
|
558
|
+
<references id="T" obligation="informative">
|
559
|
+
<title>Bibliography Subsection<fn reference="21"><p>A</p></fn></title>
|
560
|
+
</references>
|
561
|
+
</clause>
|
562
|
+
</bibliography>
|
563
|
+
</iso-standard>
|
564
|
+
INPUT
|
565
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
566
|
+
<head/>
|
567
|
+
<body lang='en'>
|
568
|
+
<div class='title-section'>
|
569
|
+
<p> </p>
|
570
|
+
</div>
|
571
|
+
<br/>
|
572
|
+
<div class='prefatory-section'>
|
573
|
+
<p> </p>
|
574
|
+
</div>
|
575
|
+
<br/>
|
576
|
+
<div class='main-section'>
|
577
|
+
<div class='authority'>
|
578
|
+
<div class='boilerplate-copyright'>
|
579
|
+
<div>
|
580
|
+
<h1>
|
581
|
+
Copyright
|
582
|
+
<a rel='footnote' href='#fn:1' epub:type='footnote'>
|
583
|
+
<sup>1</sup>
|
584
|
+
</a>
|
585
|
+
</h1>
|
586
|
+
</div>
|
587
|
+
</div>
|
588
|
+
<div class='boilerplate-license'>
|
589
|
+
<div>
|
590
|
+
<h1>
|
591
|
+
License
|
592
|
+
<a rel='footnote' href='#fn:2' epub:type='footnote'>
|
593
|
+
<sup>2</sup>
|
594
|
+
</a>
|
595
|
+
</h1>
|
596
|
+
</div>
|
597
|
+
</div>
|
598
|
+
<div class='boilerplate-legal'>
|
599
|
+
<div>
|
600
|
+
<h1>
|
601
|
+
Legal
|
602
|
+
<a rel='footnote' href='#fn:3' epub:type='footnote'>
|
603
|
+
<sup>3</sup>
|
604
|
+
</a>
|
605
|
+
</h1>
|
606
|
+
</div>
|
607
|
+
</div>
|
608
|
+
<div class='boilerplate-feedback'>
|
609
|
+
<div>
|
610
|
+
<h1>
|
611
|
+
Feedback
|
612
|
+
<a rel='footnote' href='#fn:4' epub:type='footnote'>
|
613
|
+
<sup>4</sup>
|
614
|
+
</a>
|
615
|
+
</h1>
|
616
|
+
</div>
|
617
|
+
</div>
|
618
|
+
</div>
|
619
|
+
<br/>
|
620
|
+
<div>
|
621
|
+
<h1 class='AbstractTitle'>Abstract</h1>
|
622
|
+
</div>
|
623
|
+
<br/>
|
624
|
+
<div>
|
625
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
626
|
+
<p id='A'>This is a preamble</p>
|
627
|
+
</div>
|
628
|
+
<br/>
|
629
|
+
<div class='Section3' id='B'>
|
630
|
+
<h1 class='IntroTitle'>Introduction</h1>
|
631
|
+
<div id='C'>
|
632
|
+
<h2>
|
633
|
+
Introduction Subsection
|
634
|
+
<a rel='footnote' href='#fn:8' epub:type='footnote'>
|
635
|
+
<sup>8</sup>
|
636
|
+
</a>
|
637
|
+
</h2>
|
638
|
+
</div>
|
639
|
+
</div>
|
640
|
+
<p class='zzSTDTitle1'/>
|
641
|
+
<div id='H'>
|
642
|
+
<h1>1.  Terms, definitions, symbols and abbreviated terms</h1>
|
643
|
+
<div id='I'>
|
644
|
+
<h2>
|
645
|
+
1.1.  Normal Terms
|
646
|
+
<a rel='footnote' href='#fn:11' epub:type='footnote'>
|
647
|
+
<sup>11</sup>
|
648
|
+
</a>
|
649
|
+
</h2>
|
650
|
+
<p class='TermNum' id='J'>1.1.1.</p>
|
651
|
+
<p class='Terms' style='text-align:left;'>Term2</p>
|
652
|
+
</div>
|
653
|
+
<div id='K'>
|
654
|
+
<h2>
|
655
|
+
1.2.  Definitions
|
656
|
+
<a rel='footnote' href='#fn:12' epub:type='footnote'>
|
657
|
+
<sup>12</sup>
|
658
|
+
</a>
|
659
|
+
</h2>
|
660
|
+
<dl>
|
661
|
+
<dt>
|
662
|
+
<p>Symbol</p>
|
663
|
+
</dt>
|
664
|
+
<dd>Definition</dd>
|
665
|
+
</dl>
|
666
|
+
</div>
|
667
|
+
</div>
|
668
|
+
<div id='L' class='Symbols'>
|
669
|
+
<h1>2.  Symbols and abbreviated terms</h1>
|
670
|
+
<dl>
|
671
|
+
<dt>
|
672
|
+
<p>Symbol</p>
|
673
|
+
</dt>
|
674
|
+
<dd>Definition</dd>
|
675
|
+
</dl>
|
676
|
+
</div>
|
677
|
+
<div id='D'>
|
678
|
+
<h1>
|
679
|
+
3.  Scope
|
680
|
+
<a rel='footnote' href='#fn:9' epub:type='footnote'>
|
681
|
+
<sup>9</sup>
|
682
|
+
</a>
|
683
|
+
</h1>
|
684
|
+
<p id='E'>Text</p>
|
685
|
+
</div>
|
686
|
+
<div id='M'>
|
687
|
+
<h1>
|
688
|
+
4.  Clause 4
|
689
|
+
<a rel='footnote' href='#fn:13' epub:type='footnote'>
|
690
|
+
<sup>13</sup>
|
691
|
+
</a>
|
692
|
+
</h1>
|
693
|
+
<div id='N'>
|
694
|
+
<h2>
|
695
|
+
4.1.  Introduction
|
696
|
+
<a rel='footnote' href='#fn:1' epub:type='footnote'>
|
697
|
+
<sup>1</sup>
|
698
|
+
</a>
|
699
|
+
</h2>
|
700
|
+
</div>
|
701
|
+
<div id='O'>
|
702
|
+
<h2>
|
703
|
+
4.2.  Clause 4.2
|
704
|
+
<a rel='footnote' href='#fn:14' epub:type='footnote'>
|
705
|
+
<sup>14</sup>
|
706
|
+
</a>
|
707
|
+
</h2>
|
708
|
+
</div>
|
709
|
+
<div id='O1'>
|
710
|
+
<h2>4.3.  </h2>
|
711
|
+
</div>
|
712
|
+
</div>
|
713
|
+
<br/>
|
714
|
+
<div id='P' class='Section3'>
|
715
|
+
<h1 class='Annex'>
|
716
|
+
<b>Annex A</b>
|
717
|
+
<br/>
|
718
|
+
(normative)
|
719
|
+
<br/>
|
720
|
+
<br/>
|
721
|
+
<b>
|
722
|
+
Annex
|
723
|
+
<a rel='footnote' href='#fn:15' epub:type='footnote'>
|
724
|
+
<sup>15</sup>
|
725
|
+
</a>
|
726
|
+
</b>
|
727
|
+
</h1>
|
728
|
+
<div id='Q'>
|
729
|
+
<h2>
|
730
|
+
A.1.  Annex A.1
|
731
|
+
<a rel='footnote' href='#fn:16' epub:type='footnote'>
|
732
|
+
<sup>16</sup>
|
733
|
+
</a>
|
734
|
+
</h2>
|
735
|
+
<div id='Q1'>
|
736
|
+
<h3>
|
737
|
+
A.1.1.  Annex A.1a
|
738
|
+
<a rel='footnote' href='#fn:17' epub:type='footnote'>
|
739
|
+
<sup>17</sup>
|
740
|
+
</a>
|
741
|
+
</h3>
|
742
|
+
</div>
|
743
|
+
<div>
|
744
|
+
<h3>
|
745
|
+
A.1.2.  Annex Bibliography
|
746
|
+
<a rel='footnote' href='#fn:18' epub:type='footnote'>
|
747
|
+
<sup>18</sup>
|
748
|
+
</a>
|
749
|
+
</h3>
|
750
|
+
</div>
|
751
|
+
</div>
|
752
|
+
</div>
|
753
|
+
</div>
|
754
|
+
</body>
|
755
|
+
</html>
|
756
|
+
OUTPUT
|
757
|
+
end
|
758
|
+
|
428
759
|
it "processes section names suppressing section numbering" do
|
429
760
|
expect(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
430
761
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
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.18
|
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-02-
|
11
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|