metanorma-iso 1.9.0.1 → 1.9.4
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/asciidoctor/iso/cleanup.rb +3 -4
- data/lib/asciidoctor/iso/front_id.rb +7 -2
- data/lib/asciidoctor/iso/isodoc.rng +52 -11
- data/lib/asciidoctor/iso/isostandard.rng +4 -1
- data/lib/asciidoctor/iso/reqt.rng +15 -4
- data/lib/asciidoctor/iso/section.rb +7 -1
- data/lib/asciidoctor/iso/validate_section.rb +18 -20
- data/lib/asciidoctor/iso/validate_style.rb +17 -9
- data/lib/isodoc/iso/index.rb +48 -24
- data/lib/isodoc/iso/iso.amendment.xsl +387 -151
- data/lib/isodoc/iso/iso.international-standard.xsl +387 -151
- data/lib/isodoc/iso/metadata.rb +28 -16
- data/lib/isodoc/iso/presentation_xml_convert.rb +21 -12
- data/lib/metanorma/iso/processor.rb +1 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +2 -1
- data/spec/asciidoctor/blocks_spec.rb +41 -2
- data/spec/asciidoctor/cleanup_spec.rb +2 -2
- data/spec/asciidoctor/refs_spec.rb +1 -1
- data/spec/isodoc/inline_spec.rb +250 -219
- data/spec/isodoc/terms_spec.rb +30 -0
- metadata +2 -2
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -2,7 +2,7 @@ require "isodoc"
|
|
2
2
|
|
3
3
|
module IsoDoc
|
4
4
|
module Iso
|
5
|
-
class
|
5
|
+
class Metadata < IsoDoc::Metadata
|
6
6
|
def initialize(lang, script, i18n)
|
7
7
|
super
|
8
8
|
set(:tc, "XXXX")
|
@@ -14,17 +14,17 @@ module IsoDoc
|
|
14
14
|
set(:obsoletes_part, nil)
|
15
15
|
end
|
16
16
|
|
17
|
-
def status_abbrev(stage,
|
17
|
+
def status_abbrev(stage, _substage, iter, draft, doctype)
|
18
18
|
return "" unless stage
|
19
19
|
|
20
20
|
if %w(technical-report technical-specification).include?(doctype)
|
21
21
|
stage = "DTS" if stage == "DIS"
|
22
22
|
stage = "FDTS" if stage == "FDIS"
|
23
23
|
end
|
24
|
-
if %w(PWI NWIP WD CD).include?(stage)
|
25
|
-
stage += iter
|
24
|
+
if %w(PWI NWIP WD CD).include?(stage) && iter
|
25
|
+
stage += iter
|
26
26
|
end
|
27
|
-
stage = "Pre"
|
27
|
+
stage = "Pre#{stage}" if /^0\./.match?(draft)
|
28
28
|
stage
|
29
29
|
end
|
30
30
|
|
@@ -48,14 +48,14 @@ module IsoDoc
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def unpublished(status)
|
51
|
-
status.to_i
|
51
|
+
status.to_i.positive? && status.to_i < 60
|
52
52
|
end
|
53
53
|
|
54
54
|
def docid(isoxml, _out)
|
55
55
|
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
|
56
56
|
set(:docnumber, dn&.text)
|
57
57
|
tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
|
58
|
-
set(:tc_docnumber, tcdn.map
|
58
|
+
set(:tc_docnumber, tcdn.map(&:text))
|
59
59
|
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
|
60
60
|
set(:docnumber_lang, dn&.text)
|
61
61
|
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
|
@@ -87,6 +87,7 @@ module IsoDoc
|
|
87
87
|
|
88
88
|
def part_title(part, partnum, subpartnum, lang)
|
89
89
|
return "" unless part
|
90
|
+
|
90
91
|
suffix = @c.encode(part.text, :hexadecimal)
|
91
92
|
partnum = "#{partnum}–#{subpartnum}" if partnum && subpartnum
|
92
93
|
suffix = "#{part_label(lang)} #{partnum}: " + suffix if partnum
|
@@ -125,10 +126,14 @@ module IsoDoc
|
|
125
126
|
end
|
126
127
|
|
127
128
|
def title_parts(isoxml, lang)
|
128
|
-
[isoxml.at(ns("//bibdata//title[@type='title-intro' and
|
129
|
-
|
130
|
-
isoxml.at(ns("//bibdata//title[@type='title-
|
131
|
-
|
129
|
+
[isoxml.at(ns("//bibdata//title[@type='title-intro' and "\
|
130
|
+
"@language='#{lang}']")),
|
131
|
+
isoxml.at(ns("//bibdata//title[@type='title-main' and "\
|
132
|
+
"@language='#{lang}']")),
|
133
|
+
isoxml.at(ns("//bibdata//title[@type='title-part' and "\
|
134
|
+
"@language='#{lang}']")),
|
135
|
+
isoxml.at(ns("//bibdata//title[@type='title-amd' and "\
|
136
|
+
"@language='#{lang}']"))]
|
132
137
|
end
|
133
138
|
|
134
139
|
def title(isoxml, _out)
|
@@ -139,7 +144,10 @@ module IsoDoc
|
|
139
144
|
set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
140
145
|
main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
|
141
146
|
set(:doctitle, main)
|
142
|
-
|
147
|
+
if intro
|
148
|
+
set(:doctitleintro,
|
149
|
+
@c.encode(intro ? intro.text : "", :hexadecimal))
|
150
|
+
end
|
143
151
|
set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
|
144
152
|
set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
|
145
153
|
set(:doctitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
|
@@ -155,7 +163,10 @@ module IsoDoc
|
|
155
163
|
set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
156
164
|
main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
|
157
165
|
set(:docsubtitle, main)
|
158
|
-
|
166
|
+
if intro
|
167
|
+
set(:docsubtitleintro,
|
168
|
+
@c.encode(intro ? intro.text : "", :hexadecimal))
|
169
|
+
end
|
159
170
|
set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
|
160
171
|
set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
|
161
172
|
set(:docsubtitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
|
@@ -173,8 +184,8 @@ module IsoDoc
|
|
173
184
|
|
174
185
|
def tc(xml)
|
175
186
|
tc_num = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@number"))
|
176
|
-
tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@type"))
|
177
|
-
text || "TC"
|
187
|
+
tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@type"))
|
188
|
+
&.text || "TC"
|
178
189
|
if tc_num
|
179
190
|
tcid = "#{tc_type} #{tc_num.text}"
|
180
191
|
set(:tc, tcid)
|
@@ -212,7 +223,8 @@ module IsoDoc
|
|
212
223
|
ics = []
|
213
224
|
isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
|
214
225
|
set(:ics, ics.empty? ? nil : ics.join(", "))
|
215
|
-
a = isoxml.at(ns("//bibdata/ext/horizontal")) and set(:horizontal,
|
226
|
+
a = isoxml.at(ns("//bibdata/ext/horizontal")) and set(:horizontal,
|
227
|
+
a.text)
|
216
228
|
end
|
217
229
|
end
|
218
230
|
end
|
@@ -68,7 +68,8 @@ module IsoDoc
|
|
68
68
|
subsection = from&.text&.match(/\./)
|
69
69
|
type = type.downcase
|
70
70
|
lang == "zh" and
|
71
|
-
return l10n(eref_localities1_zh(target, type, from, upto, node,
|
71
|
+
return l10n(eref_localities1_zh(target, type, from, upto, node,
|
72
|
+
delim))
|
72
73
|
ret = if delim == ";" then ";"
|
73
74
|
else
|
74
75
|
type == "list" ? "" : delim
|
@@ -117,27 +118,35 @@ module IsoDoc
|
|
117
118
|
concept_term(f, m)
|
118
119
|
end
|
119
120
|
docxml.xpath(ns("//concept")).each do |node|
|
120
|
-
concept_render(node, node["ital"] || "false",
|
121
|
+
concept_render(node, ital: node["ital"] || "false",
|
122
|
+
ref: node["ref"] || "false",
|
123
|
+
linkref: node["linkref"] || "true",
|
124
|
+
linkmention: node["linkmention"] || "false")
|
121
125
|
end
|
122
126
|
end
|
123
127
|
|
124
128
|
def concept_term(node, seen)
|
125
129
|
term = node&.at(ns("./refterm"))&.to_xml
|
126
130
|
if term && seen[term]
|
127
|
-
concept_render(node, node["ital"] || "false",
|
128
|
-
|
131
|
+
concept_render(node, ital: node["ital"] || "false",
|
132
|
+
ref: node["ref"] || "false",
|
133
|
+
linkref: node["linkref"] || "true",
|
134
|
+
linkmention: node["linkmention"] || "false")
|
135
|
+
else concept_render(node, ital: node["ital"] || "true",
|
136
|
+
ref: node["ref"] || "true",
|
137
|
+
linkref: node["linkref"] || "true",
|
138
|
+
linkmention: node["linkmention"] || "false")
|
129
139
|
end
|
130
140
|
seen[term] = true if term
|
131
141
|
seen
|
132
142
|
end
|
133
143
|
|
134
|
-
def
|
135
|
-
if
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
r.replace("(#{r.to_xml})")
|
144
|
+
def concept1_ref_content(ref)
|
145
|
+
if ref.name == "termref"
|
146
|
+
ref.replace(@i18n.term_defined_in.sub(/%/,
|
147
|
+
ref.to_xml))
|
148
|
+
else
|
149
|
+
ref.replace("(#{ref.to_xml})")
|
141
150
|
end
|
142
151
|
end
|
143
152
|
|
@@ -160,7 +169,7 @@ module IsoDoc
|
|
160
169
|
# i = display_order_at(docxml, "//sections/definitions", i)
|
161
170
|
# i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
|
162
171
|
i = display_order_xpath(docxml, "//sections/clause[not(@type = 'scope')] | "\
|
163
|
-
|
172
|
+
"//sections/terms | //sections/definitions", i)
|
164
173
|
i = display_order_xpath(docxml, "//annex", i)
|
165
174
|
i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
|
166
175
|
display_order_xpath(docxml, "//indexsect", i)
|
@@ -212,6 +212,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
212
212
|
:pub-fax: 4444444
|
213
213
|
:pub-email: x@example.com
|
214
214
|
:pub-uri: http://www.example.com
|
215
|
+
:docstage:
|
216
|
+
:docsubstage:
|
215
217
|
INPUT
|
216
218
|
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
217
219
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
@@ -304,7 +306,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
304
306
|
<phone type='fax'>4444444</phone>
|
305
307
|
<email>x@example.com</email>
|
306
308
|
<uri>http://www.example.com</uri>
|
307
|
-
#{' '}
|
308
309
|
</organization>
|
309
310
|
</owner>
|
310
311
|
</copyright>
|
@@ -48,11 +48,11 @@ RSpec.describe Asciidoctor::ISO do
|
|
48
48
|
<mi>r</mi>
|
49
49
|
<mo>=</mo>
|
50
50
|
<mn>1</mn>
|
51
|
-
<
|
51
|
+
<mo>%</mo>
|
52
52
|
<mi>r</mi>
|
53
53
|
<mo>=</mo>
|
54
54
|
<mn>1</mn>
|
55
|
-
<
|
55
|
+
<mo>%</mo>
|
56
56
|
</math>
|
57
57
|
</stem>
|
58
58
|
</formula>
|
@@ -586,4 +586,43 @@ RSpec.describe Asciidoctor::ISO do
|
|
586
586
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
587
587
|
.to be_equivalent_to xmlpp(output)
|
588
588
|
end
|
589
|
+
|
590
|
+
it "processes nested terms" do
|
591
|
+
input = <<~INPUT
|
592
|
+
#{ASCIIDOC_BLANK_HDR}
|
593
|
+
== Terms and Definitions
|
594
|
+
|
595
|
+
[.term]
|
596
|
+
=== Term1
|
597
|
+
|
598
|
+
definition
|
599
|
+
|
600
|
+
==== Term11
|
601
|
+
definition2
|
602
|
+
INPUT
|
603
|
+
output = <<~OUTPUT
|
604
|
+
#{BLANK_HDR}
|
605
|
+
<sections>
|
606
|
+
<terms id='_' obligation='normative'>
|
607
|
+
<title>Terms and definitions</title>
|
608
|
+
#{TERM_BOILERPLATE}
|
609
|
+
<term id='term-term1'>
|
610
|
+
<preferred>Term1</preferred>
|
611
|
+
<definition>
|
612
|
+
<p id='_'>definition</p>
|
613
|
+
</definition>
|
614
|
+
<term id='term-term11'>
|
615
|
+
<preferred>Term11</preferred>
|
616
|
+
<definition>
|
617
|
+
<p id='_'>definition2</p>
|
618
|
+
</definition>
|
619
|
+
</term>
|
620
|
+
</term>
|
621
|
+
</terms>
|
622
|
+
</sections>
|
623
|
+
</iso-standard>
|
624
|
+
OUTPUT
|
625
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
626
|
+
.to be_equivalent_to xmlpp(output)
|
627
|
+
end
|
589
628
|
end
|
@@ -26,7 +26,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
26
26
|
<title>Clause</title>
|
27
27
|
<p id="_">
|
28
28
|
<eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>
|
29
|
-
<fn reference="1">The standard is in press</fn>
|
29
|
+
<fn reference="1"><p id="_">The standard is in press</p></fn>
|
30
30
|
<eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>A.
|
31
31
|
<fn reference="2">
|
32
32
|
<p id="_">a footnote</p></fn>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -131,26 +131,27 @@ RSpec.describe IsoDoc do
|
|
131
131
|
<sections>
|
132
132
|
</iso-standard>
|
133
133
|
INPUT
|
134
|
-
expect(xmlpp(output.sub(/<html/,
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
134
|
+
expect(xmlpp(output.sub(/<html/,
|
135
|
+
"<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
136
|
+
#{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
|
137
|
+
<br/>
|
138
|
+
<div>
|
139
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
140
|
+
<p>
|
141
|
+
<span class="stem">(#(A)#)</span>
|
142
|
+
<span class="stem">
|
143
|
+
<m:math>
|
144
|
+
<m:row>X</m:row>
|
145
|
+
</m:math>
|
146
|
+
</span>
|
147
|
+
<span class="stem">Latex?</span>
|
148
|
+
</p>
|
149
|
+
</div>
|
150
|
+
<p class="zzSTDTitle1"/>
|
151
|
+
</div>
|
152
|
+
</body>
|
153
|
+
</html>
|
154
|
+
OUTPUT
|
154
155
|
end
|
155
156
|
|
156
157
|
it "overrides AsciiMath delimiters" do
|
@@ -232,163 +233,165 @@ RSpec.describe IsoDoc do
|
|
232
233
|
end
|
233
234
|
|
234
235
|
it "processes eref content" do
|
235
|
-
output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test",
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
236
|
+
output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test",
|
237
|
+
<<~"INPUT", true)
|
238
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
239
|
+
<preface>
|
240
|
+
<foreword>
|
241
|
+
<p>
|
242
|
+
<eref bibitemid="IEV" citeas="IEV" type="inline">
|
243
|
+
<locality type="clause">
|
244
|
+
<referenceFrom>1-2-3</referenceFrom>
|
245
|
+
</locality>
|
246
|
+
</eref>
|
247
|
+
<eref bibitemid="ISO712" citeas="ISO 712" type="inline"/>
|
248
|
+
<eref bibitemid="ISO712" type="inline"/>
|
249
|
+
<eref bibitemid="ISO712" type="inline">
|
250
|
+
<locality type="table">
|
251
|
+
<referenceFrom>1</referenceFrom>
|
252
|
+
</locality>
|
253
|
+
</eref>
|
254
|
+
<eref bibitemid="ISO712" type="inline">
|
255
|
+
<locality type="table">
|
256
|
+
<referenceFrom>1</referenceFrom>
|
257
|
+
<referenceTo>1</referenceTo>
|
258
|
+
</locality>
|
259
|
+
</eref>
|
260
|
+
<eref bibitemid="ISO712" type="inline">
|
261
|
+
<locality type="clause">
|
262
|
+
<referenceFrom>1</referenceFrom>
|
263
|
+
</locality>
|
264
|
+
<locality type="table">
|
265
|
+
<referenceFrom>1</referenceFrom>
|
266
|
+
</locality>
|
267
|
+
</eref>
|
268
|
+
<eref bibitemid="ISO712" type="inline">
|
269
|
+
<locality type="clause">
|
270
|
+
<referenceFrom>1</referenceFrom>
|
271
|
+
</locality>
|
272
|
+
<locality type="list">
|
273
|
+
<referenceFrom>a</referenceFrom>
|
274
|
+
</locality>
|
275
|
+
</eref>
|
276
|
+
<eref bibitemid="ISO712" type="inline">
|
277
|
+
<locality type="clause">
|
278
|
+
<referenceFrom>1</referenceFrom>
|
279
|
+
</locality>
|
280
|
+
</eref>
|
281
|
+
<eref bibitemid="ISO712" type="inline">
|
282
|
+
<locality type="clause">
|
283
|
+
<referenceFrom>1.5</referenceFrom>
|
284
|
+
</locality>
|
285
|
+
</eref>
|
286
|
+
<eref bibitemid="ISO712" type="inline">
|
287
|
+
<locality type="table">
|
288
|
+
<referenceFrom>1</referenceFrom>
|
289
|
+
</locality>A</eref>
|
290
|
+
<eref bibitemid="ISO712" type="inline">
|
291
|
+
<locality type="whole"/>
|
292
|
+
</eref>
|
293
|
+
<eref bibitemid="ISO712" type="inline">
|
294
|
+
<locality type="locality:prelude">
|
295
|
+
<referenceFrom>7</referenceFrom>
|
296
|
+
</locality>
|
297
|
+
</eref>
|
298
|
+
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
|
299
|
+
</p>
|
300
|
+
</foreword>
|
301
|
+
</preface>
|
302
|
+
<bibliography>
|
303
|
+
<references id="_normative_references" normative="true" obligation="informative">
|
304
|
+
<title>Normative References</title>
|
305
|
+
<bibitem id="ISO712" type="standard">
|
306
|
+
<title format="text/plain">Cereals and cereal products</title>
|
307
|
+
<docidentifier>ISO 712</docidentifier>
|
308
|
+
<contributor>
|
309
|
+
<role type="publisher"/>
|
310
|
+
<organization>
|
311
|
+
<abbreviation>ISO</abbreviation>
|
312
|
+
</organization>
|
313
|
+
</contributor>
|
314
|
+
</bibitem>
|
315
|
+
</references>
|
316
|
+
</bibliography>
|
317
|
+
</iso-standard>
|
318
|
+
INPUT
|
319
|
+
expect(xmlpp(output).sub(%r{<i18nyaml>.*</i18nyaml>}m,
|
320
|
+
"")).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
321
|
+
<?xml version='1.0'?>
|
322
|
+
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
323
|
+
<preface>
|
324
|
+
<foreword displayorder="1">
|
325
|
+
<p>
|
326
|
+
<eref bibitemid="IEV" citeas="IEV" type="inline">
|
327
|
+
<locality type="clause">
|
328
|
+
<referenceFrom>1-2-3</referenceFrom>
|
329
|
+
</locality>IEV, 1-2-3</eref>
|
330
|
+
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">ISO 712</eref>
|
331
|
+
<eref bibitemid="ISO712" type="inline">ISO 712</eref>
|
332
|
+
<eref bibitemid="ISO712" type="inline">
|
333
|
+
<locality type="table">
|
334
|
+
<referenceFrom>1</referenceFrom>
|
335
|
+
</locality>ISO 712, Table 1</eref>
|
336
|
+
<eref bibitemid="ISO712" type="inline">
|
337
|
+
<locality type="table">
|
338
|
+
<referenceFrom>1</referenceFrom>
|
339
|
+
<referenceTo>1</referenceTo>
|
340
|
+
</locality>ISO 712, Table 1–1</eref>
|
341
|
+
<eref bibitemid="ISO712" type="inline">
|
342
|
+
<locality type="clause">
|
343
|
+
<referenceFrom>1</referenceFrom>
|
344
|
+
</locality>
|
345
|
+
<locality type="table">
|
346
|
+
<referenceFrom>1</referenceFrom>
|
347
|
+
</locality>ISO 712, Clause 1, Table 1</eref>
|
348
|
+
<eref bibitemid="ISO712" type="inline">
|
349
|
+
<locality type="clause">
|
350
|
+
<referenceFrom>1</referenceFrom>
|
351
|
+
</locality>
|
352
|
+
<locality type="list">
|
353
|
+
<referenceFrom>a</referenceFrom>
|
354
|
+
</locality>ISO 712, Clause 1 a)</eref>
|
355
|
+
<eref bibitemid="ISO712" type="inline">
|
356
|
+
<locality type="clause">
|
357
|
+
<referenceFrom>1</referenceFrom>
|
358
|
+
</locality>ISO 712, Clause 1</eref>
|
359
|
+
<eref bibitemid="ISO712" type="inline">
|
360
|
+
<locality type="clause">
|
361
|
+
<referenceFrom>1.5</referenceFrom>
|
362
|
+
</locality>ISO 712, 1.5</eref>
|
363
|
+
<eref bibitemid="ISO712" type="inline">
|
364
|
+
<locality type="table">
|
365
|
+
<referenceFrom>1</referenceFrom>
|
366
|
+
</locality>A</eref>
|
367
|
+
<eref bibitemid="ISO712" type="inline">
|
368
|
+
<locality type="whole"/>ISO 712, Whole of text</eref>
|
369
|
+
<eref bibitemid="ISO712" type="inline">
|
370
|
+
<locality type="locality:prelude">
|
371
|
+
<referenceFrom>7</referenceFrom>
|
372
|
+
</locality>ISO 712, Prelude 7</eref>
|
373
|
+
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
|
374
|
+
</p>
|
375
|
+
</foreword>
|
376
|
+
</preface>
|
377
|
+
<bibliography>
|
378
|
+
<references id="_normative_references" normative="true" obligation="informative" displayorder="2">
|
379
|
+
<title depth="1">1<tab/>
|
380
|
+
Normative References</title>
|
381
|
+
<bibitem id="ISO712" type="standard">
|
382
|
+
<title format="text/plain">Cereals and cereal products</title>
|
383
|
+
<docidentifier>ISO 712</docidentifier>
|
384
|
+
<contributor>
|
385
|
+
<role type="publisher"/>
|
386
|
+
<organization>
|
387
|
+
<abbreviation>ISO</abbreviation>
|
388
|
+
</organization>
|
389
|
+
</contributor>
|
390
|
+
</bibitem>
|
391
|
+
</references>
|
392
|
+
</bibliography>
|
393
|
+
</iso-standard>
|
394
|
+
OUTPUT
|
392
395
|
end
|
393
396
|
|
394
397
|
it "processes concept markup" do
|
@@ -398,7 +401,7 @@ RSpec.describe IsoDoc do
|
|
398
401
|
<terms id="Terms">
|
399
402
|
<p>
|
400
403
|
<ul>
|
401
|
-
|
404
|
+
<li><concept><refterm>term0</refterm>
|
402
405
|
<xref target='clause1'/>
|
403
406
|
</concept></li>
|
404
407
|
<li><concept><refterm>term1</refterm>
|
@@ -742,7 +745,7 @@ RSpec.describe IsoDoc do
|
|
742
745
|
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
743
746
|
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
744
747
|
end
|
745
|
-
|
748
|
+
|
746
749
|
it "processes concept attributes" do
|
747
750
|
input = <<~INPUT
|
748
751
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -776,20 +779,23 @@ RSpec.describe IsoDoc do
|
|
776
779
|
<renderterm>term</renderterm>
|
777
780
|
<xref target='clause1'/>
|
778
781
|
</concept></li>
|
782
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
|
783
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
|
784
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
|
785
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
|
779
786
|
</ul></p>
|
780
787
|
</terms>
|
781
788
|
</sections>
|
782
789
|
</iso-standard>
|
783
790
|
INPUT
|
784
791
|
presxml = <<~OUTPUT
|
785
|
-
|
792
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
786
793
|
<sections>
|
787
794
|
<clause id="clause1" displayorder="1"><title depth="1">1<tab/>Clause 1</title></clause>
|
788
795
|
<terms id="A" displayorder="2"><title>2</title>
|
789
796
|
<p>
|
790
797
|
<ul>
|
791
798
|
<li>
|
792
|
-
|
793
799
|
<em>term</em>
|
794
800
|
(<xref target="clause1">Clause 1</xref>)
|
795
801
|
</li>
|
@@ -803,57 +809,82 @@ RSpec.describe IsoDoc do
|
|
803
809
|
</li>
|
804
810
|
<li>
|
805
811
|
term
|
806
|
-
|
807
812
|
</li>
|
808
813
|
<li>
|
809
814
|
term
|
810
|
-
|
811
815
|
</li>
|
812
816
|
<li>
|
813
817
|
term
|
814
|
-
|
815
818
|
</li>
|
819
|
+
<li><xref target="clause1"><em>term</em></xref> (<xref target="clause1">Clause 1</xref>)</li>
|
820
|
+
<li><xref target="clause1"><em>term</em></xref> (Clause 1)</li>
|
821
|
+
<li><em>term</em> (<xref target="clause1">Clause 1</xref>)</li>
|
822
|
+
<li><em>term</em> (Clause 1)</li>
|
816
823
|
</ul></p>
|
817
824
|
</terms>
|
818
825
|
</sections>
|
819
826
|
</iso-standard>
|
820
827
|
OUTPUT
|
821
828
|
output = <<~OUTPUT
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
</
|
829
|
+
#{HTML_HDR}
|
830
|
+
<p class='zzSTDTitle1'/>
|
831
|
+
<div id='clause1'>
|
832
|
+
<h1>1  Clause 1</h1>
|
833
|
+
</div>
|
834
|
+
<div id='A'>
|
835
|
+
<h1>2</h1>
|
836
|
+
<p>
|
837
|
+
<ul>
|
838
|
+
<li>
|
839
|
+
<i>term</i>
|
840
|
+
(
|
841
|
+
<a href='#clause1'>Clause 1</a>
|
842
|
+
)
|
843
|
+
</li>
|
844
|
+
<li>
|
845
|
+
term (
|
846
|
+
<a href='#clause1'>Clause 1</a>
|
847
|
+
)
|
848
|
+
</li>
|
849
|
+
<li>
|
850
|
+
<i>term</i>
|
851
|
+
(
|
852
|
+
<a href='#clause1'>Clause 1</a>
|
853
|
+
)
|
854
|
+
</li>
|
855
|
+
<li> term </li>
|
856
|
+
<li> term </li>
|
857
|
+
<li> term </li>
|
858
|
+
<li>
|
859
|
+
<a href='#clause1'>
|
860
|
+
<i>term</i>
|
861
|
+
</a>
|
862
|
+
(
|
863
|
+
<a href='#clause1'>Clause 1</a>
|
864
|
+
)
|
865
|
+
</li>
|
866
|
+
<li>
|
867
|
+
<a href='#clause1'>
|
868
|
+
<i>term</i>
|
869
|
+
</a>
|
870
|
+
(Clause 1)
|
871
|
+
</li>
|
872
|
+
<li>
|
873
|
+
<i>term</i>
|
874
|
+
(
|
875
|
+
<a href='#clause1'>Clause 1</a>
|
876
|
+
)
|
877
|
+
</li>
|
878
|
+
<li>
|
879
|
+
<i>term</i>
|
880
|
+
(Clause 1)
|
881
|
+
</li>
|
882
|
+
</ul>
|
883
|
+
</p>
|
884
|
+
</div>
|
885
|
+
</div>
|
886
|
+
</body>
|
887
|
+
</html>
|
857
888
|
OUTPUT
|
858
889
|
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
859
890
|
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|