metanorma-iso 1.9.4 → 1.10.1
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/.github/workflows/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/basicdoc.rng +32 -5
- data/lib/asciidoctor/iso/biblio.rng +2 -0
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +9 -1
- data/lib/asciidoctor/iso/isodoc.rng +430 -76
- data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
- data/lib/asciidoctor/iso/isostandard.rng +9 -23
- data/lib/asciidoctor/iso/reqt.rng +24 -3
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +1 -2
- data/lib/isodoc/iso/html/isodoc.scss +1 -1
- data/lib/isodoc/iso/html/wordstyle.css +16 -4
- data/lib/isodoc/iso/html/wordstyle.scss +16 -4
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +200 -20
- data/lib/isodoc/iso/iso.international-standard.xsl +200 -20
- data/lib/isodoc/iso/presentation_xml_convert.rb +9 -10
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -3
- data/spec/asciidoctor/base_spec.rb +685 -178
- data/spec/asciidoctor/blank_spec.rb +38 -0
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +34 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +87 -4
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +29 -15
- data/spec/isodoc/inline_spec.rb +56 -26
- data/spec/isodoc/section_spec.rb +1 -1
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +11 -11
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +4 -1
- data/spec/spec_helper.rb +14 -1
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +38 -19
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::ISO do
|
4
|
+
it "processes a blank document" do
|
5
|
+
input = <<~INPUT
|
6
|
+
#{ASCIIDOC_BLANK_HDR}
|
7
|
+
INPUT
|
8
|
+
output = <<~OUTPUT
|
9
|
+
#{BLANK_HDR}
|
10
|
+
<sections/>
|
11
|
+
</iso-standard>
|
12
|
+
OUTPUT
|
13
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
14
|
+
.to be_equivalent_to xmlpp(output)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "converts a blank document" do
|
18
|
+
input = <<~INPUT
|
19
|
+
= Document title
|
20
|
+
Author
|
21
|
+
:docfile: test.adoc
|
22
|
+
:novalid:
|
23
|
+
:no-isobib:
|
24
|
+
INPUT
|
25
|
+
output = <<~OUTPUT
|
26
|
+
#{BLANK_HDR}
|
27
|
+
<sections/>
|
28
|
+
</iso-standard>
|
29
|
+
OUTPUT
|
30
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
31
|
+
.to be_equivalent_to xmlpp(output)
|
32
|
+
expect(File.exist?("test_alt.html")).to be true
|
33
|
+
expect(File.exist?("test.html")).to be true
|
34
|
+
expect(File.exist?("test.doc")).to be true
|
35
|
+
expect(File.exist?("test.pdf")).to be true
|
36
|
+
expect(File.exist?("htmlstyle.css")).to be false
|
37
|
+
end
|
38
|
+
end
|
@@ -133,7 +133,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
133
133
|
<p id="foreword">Foreword</p>
|
134
134
|
<review date="20170101T00:00:00Z" from="foreword" id="_" reviewer="ISO" to="foreword">
|
135
135
|
<p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
|
136
|
-
<p id="_">For further information on the Foreword, see
|
136
|
+
<p id="_">For further information on the Foreword, see
|
137
137
|
<strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
|
138
138
|
</review>
|
139
139
|
</sections>
|
@@ -158,9 +158,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
158
158
|
<sections>
|
159
159
|
<terms id="_" obligation="normative">
|
160
160
|
<title>Terms and definitions</title>
|
161
|
-
#{TERM_BOILERPLATE}
|
161
|
+
#{TERM_BOILERPLATE}
|
162
162
|
<term id="term-term1">
|
163
|
-
<preferred>Term1</preferred>
|
163
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
164
164
|
<termnote id="_">
|
165
165
|
<p id="_">This is a note</p></termnote>
|
166
166
|
</term>
|
@@ -283,7 +283,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
283
283
|
<title>Terms and definitions</title>
|
284
284
|
#{TERM_BOILERPLATE}
|
285
285
|
<term id="term-term1">
|
286
|
-
<preferred>Term1</preferred>
|
286
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
287
287
|
<termexample id="_">
|
288
288
|
<p id="_">This is an example</p></termexample>
|
289
289
|
</term>
|
@@ -521,6 +521,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
521
521
|
|
522
522
|
=== Term1
|
523
523
|
|
524
|
+
Definition
|
525
|
+
|
524
526
|
[.source]
|
525
527
|
<<ISO2191,section=1>>
|
526
528
|
INPUT
|
@@ -531,8 +533,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
531
533
|
<title>Terms and definitions</title>
|
532
534
|
#{TERM_BOILERPLATE}
|
533
535
|
<term id="term-term1">
|
534
|
-
<preferred>Term1</preferred>
|
535
|
-
|
536
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
537
|
+
<definition>
|
538
|
+
<verbaldefinition>
|
539
|
+
<p id='_'>Definition</p>
|
540
|
+
</verbaldefinition>
|
541
|
+
</definition>
|
542
|
+
<termsource status='identical' type='authoritative'>
|
536
543
|
<origin bibitemid="ISO2191" citeas="" type="inline">
|
537
544
|
<localityStack>
|
538
545
|
<locality type="section">
|
@@ -556,6 +563,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
556
563
|
|
557
564
|
=== Term1
|
558
565
|
|
566
|
+
Definition
|
567
|
+
|
559
568
|
[.source]
|
560
569
|
<<ISO2191,section=1>>, with adjustments
|
561
570
|
INPUT
|
@@ -566,8 +575,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
566
575
|
<title>Terms and definitions</title>
|
567
576
|
#{TERM_BOILERPLATE}
|
568
577
|
<term id="term-term1">
|
569
|
-
<preferred>Term1</preferred>
|
570
|
-
|
578
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
579
|
+
<definition>
|
580
|
+
<verbaldefinition>
|
581
|
+
<p id='_'>Definition</p>
|
582
|
+
</verbaldefinition>
|
583
|
+
</definition>
|
584
|
+
<termsource status='modified' type='authoritative'>
|
571
585
|
<origin bibitemid="ISO2191" citeas="" type="inline">
|
572
586
|
<localityStack>
|
573
587
|
<locality type="section">
|
@@ -586,43 +600,4 @@ RSpec.describe Asciidoctor::ISO do
|
|
586
600
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
587
601
|
.to be_equivalent_to xmlpp(output)
|
588
602
|
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
|
628
603
|
end
|
@@ -36,6 +36,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
36
36
|
#{TERM_BOILERPLATE}
|
37
37
|
<term id="term-t90">
|
38
38
|
<preferred>
|
39
|
+
<letter-symbol><name>
|
39
40
|
<stem type="MathML">
|
40
41
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
41
42
|
<msub>
|
@@ -47,8 +48,10 @@ RSpec.describe Asciidoctor::ISO do
|
|
47
48
|
</msub>
|
48
49
|
</math>
|
49
50
|
</stem>
|
51
|
+
</name></letter-symbol>
|
50
52
|
</preferred>
|
51
53
|
<admitted>
|
54
|
+
<letter-symbol><name>
|
52
55
|
<stem type="MathML">
|
53
56
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
54
57
|
<msub>
|
@@ -61,10 +64,11 @@ RSpec.describe Asciidoctor::ISO do
|
|
61
64
|
</msub>
|
62
65
|
</math>
|
63
66
|
</stem>
|
67
|
+
</name></letter-symbol>
|
64
68
|
</admitted>
|
65
|
-
<definition>
|
69
|
+
<definition><verbaldefinition>
|
66
70
|
<p id="_">Time</p>
|
67
|
-
</definition>
|
71
|
+
</verbaldefinition></definition>
|
68
72
|
</term>
|
69
73
|
</terms>
|
70
74
|
</sections>
|
@@ -90,10 +94,10 @@ RSpec.describe Asciidoctor::ISO do
|
|
90
94
|
<title>Terms and definitions</title>#{TERM_BOILERPLATE}
|
91
95
|
|
92
96
|
<term id="term-tempus">
|
93
|
-
<preferred>Tempus</preferred>
|
97
|
+
<preferred><expression><name>Tempus</name></expression></preferred>
|
94
98
|
<domain>relativity</domain>
|
95
|
-
<definition>
|
96
|
-
<p id="_">Time</p></definition>
|
99
|
+
<definition><verbaldefinition>
|
100
|
+
<p id="_">Time</p></verbaldefinition></definition>
|
97
101
|
</term>
|
98
102
|
</terms>
|
99
103
|
</sections>
|
@@ -132,6 +136,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
132
136
|
#{TERM_BOILERPLATE}
|
133
137
|
<term id="term-t90">
|
134
138
|
<preferred>
|
139
|
+
<letter-symbol><name>
|
135
140
|
<stem type="MathML">
|
136
141
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
137
142
|
<msub>
|
@@ -143,8 +148,11 @@ RSpec.describe Asciidoctor::ISO do
|
|
143
148
|
</msub>
|
144
149
|
</math>
|
145
150
|
</stem>
|
151
|
+
</name></letter-symbol>
|
146
152
|
</preferred>
|
147
153
|
<definition>
|
154
|
+
<verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition>
|
155
|
+
<nonverbalrepresentation>
|
148
156
|
<formula id="_">
|
149
157
|
<stem type="MathML">
|
150
158
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
@@ -159,8 +167,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
159
167
|
</math>
|
160
168
|
</stem>
|
161
169
|
</formula>
|
162
|
-
|
163
|
-
</definition>
|
170
|
+
</nonverbalrepresentation></definition>
|
164
171
|
</term>
|
165
172
|
</terms>
|
166
173
|
</sections>
|
@@ -195,10 +202,10 @@ RSpec.describe Asciidoctor::ISO do
|
|
195
202
|
<p id="_">So am I</p></li>
|
196
203
|
</ul>
|
197
204
|
<term id="term-time">
|
198
|
-
<preferred>Time</preferred>
|
199
|
-
<definition>
|
205
|
+
<preferred><expression><name>Time</name></expression></preferred>
|
206
|
+
<definition><verbaldefinition>
|
200
207
|
<p id="_">This paragraph is extraneous</p>
|
201
|
-
</definition>
|
208
|
+
</verbaldefinition></definition>
|
202
209
|
</term>
|
203
210
|
</terms>
|
204
211
|
</sections>
|
@@ -433,6 +440,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
433
440
|
|
434
441
|
=== Term1
|
435
442
|
|
443
|
+
Definition
|
444
|
+
|
436
445
|
[.source]
|
437
446
|
<<ISO2191,section=1>>
|
438
447
|
INPUT
|
@@ -443,8 +452,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
443
452
|
<title>Terms and definitions</title>
|
444
453
|
#{TERM_BOILERPLATE}
|
445
454
|
<term id="term-term1">
|
446
|
-
<preferred>Term1</preferred>
|
447
|
-
|
455
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
456
|
+
<definition>
|
457
|
+
<verbaldefinition>
|
458
|
+
<p id='_'>Definition</p>
|
459
|
+
</verbaldefinition>
|
460
|
+
</definition>
|
461
|
+
<termsource status='identical' type='authoritative'>
|
448
462
|
<origin bibitemid="ISO2191" citeas="" type="inline">
|
449
463
|
<localityStack>
|
450
464
|
<locality type="section">
|
@@ -1241,7 +1255,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
1241
1255
|
</li>
|
1242
1256
|
</ul>
|
1243
1257
|
<term id='term-term1'>
|
1244
|
-
<preferred>Term1</preferred>
|
1258
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1245
1259
|
</term>
|
1246
1260
|
</terms>
|
1247
1261
|
</sections>
|
@@ -1292,13 +1306,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
1292
1306
|
<terms id='_' obligation='normative'>
|
1293
1307
|
<title>Normal Terms</title>
|
1294
1308
|
<term id='term-term1'>
|
1295
|
-
<preferred>Term1</preferred>
|
1309
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1296
1310
|
</term>
|
1297
1311
|
</terms>
|
1298
1312
|
<terms id='_' obligation='normative'>
|
1299
1313
|
<title>Abnormal terms</title>
|
1300
1314
|
<term id='term-term-2'>
|
1301
|
-
<preferred>Term 2</preferred>
|
1315
|
+
<preferred><expression><name>Term 2</name></expression></preferred>
|
1302
1316
|
</term>
|
1303
1317
|
</terms>
|
1304
1318
|
</clause>
|
@@ -1356,13 +1370,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
1356
1370
|
<terms id='_' obligation='normative'>
|
1357
1371
|
<title>Normal Terms</title>
|
1358
1372
|
<term id='term-term1'>
|
1359
|
-
<preferred>Term1</preferred>
|
1373
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1360
1374
|
</term>
|
1361
1375
|
</terms>
|
1362
1376
|
<terms id='_' obligation='normative'>
|
1363
1377
|
<title>Abnormal terms</title>
|
1364
1378
|
<term id='term-term-2'>
|
1365
|
-
<preferred>Term 2</preferred>
|
1379
|
+
<preferred><expression><name>Term 2</name></expression></preferred>
|
1366
1380
|
</term>
|
1367
1381
|
</terms>
|
1368
1382
|
</clause>
|
@@ -1421,13 +1435,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
1421
1435
|
</li>
|
1422
1436
|
</ul>
|
1423
1437
|
<term id='term-term1'>
|
1424
|
-
<preferred>Term1</preferred>
|
1438
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1425
1439
|
</term>
|
1426
1440
|
</terms>
|
1427
1441
|
<terms id='_' obligation='normative'>
|
1428
1442
|
<title>Other Terms</title>
|
1429
1443
|
<term id='term-term-2'>
|
1430
|
-
<preferred>Term 2</preferred>
|
1444
|
+
<preferred><expression><name>Term 2</name></expression></preferred>
|
1431
1445
|
</term>
|
1432
1446
|
</terms>
|
1433
1447
|
<definitions id='_' obligation='normative'>
|
@@ -1479,7 +1493,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
1479
1493
|
</li>
|
1480
1494
|
</ul>
|
1481
1495
|
<term id='term-term1'>
|
1482
|
-
<preferred>Term1</preferred>
|
1496
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1483
1497
|
</term>
|
1484
1498
|
</terms>
|
1485
1499
|
</sections>
|
@@ -56,8 +56,16 @@ RSpec.describe Asciidoctor::ISO do
|
|
56
56
|
</msub>
|
57
57
|
</math>
|
58
58
|
</stem>
|
59
|
-
<admitted>
|
60
|
-
|
59
|
+
<admitted>
|
60
|
+
<expression>
|
61
|
+
<name>alt</name>
|
62
|
+
</expression>
|
63
|
+
</admitted>
|
64
|
+
<deprecates>
|
65
|
+
<expression>
|
66
|
+
<name>deprecated</name>
|
67
|
+
</expression>
|
68
|
+
</deprecates>
|
61
69
|
<domain>domain</domain>
|
62
70
|
<strike>strike</strike>
|
63
71
|
<smallcap>smallcap</smallcap>
|
@@ -5,7 +5,7 @@ require "relaton_ietf"
|
|
5
5
|
RSpec.describe Asciidoctor::ISO do
|
6
6
|
it "processes draft ISO reference" do
|
7
7
|
mock_fdis
|
8
|
-
|
8
|
+
input = <<~INPUT
|
9
9
|
#{ISOBIB_BLANK_HDR}
|
10
10
|
== Clause
|
11
11
|
<<iso123>>
|
@@ -20,6 +20,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
20
20
|
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
|
21
21
|
* [[[fdis,ISO/FDIS 17664-1]]] Title
|
22
22
|
INPUT
|
23
|
+
output = <<~OUTPUT
|
23
24
|
#{BLANK_HDR}
|
24
25
|
<sections>
|
25
26
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -169,10 +170,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
169
170
|
</bibliography>
|
170
171
|
</iso-standard>
|
171
172
|
OUTPUT
|
173
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
174
|
+
.to be_equivalent_to xmlpp(output)
|
172
175
|
end
|
173
176
|
|
174
177
|
it "processes all-parts ISO reference" do
|
175
|
-
|
178
|
+
input = <<~INPUT
|
176
179
|
#{ASCIIDOC_BLANK_HDR}
|
177
180
|
|
178
181
|
== Clause
|
@@ -184,6 +187,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
184
187
|
|
185
188
|
* [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
|
186
189
|
INPUT
|
190
|
+
output = <<~OUTPUT
|
187
191
|
#{BLANK_HDR}
|
188
192
|
<sections>
|
189
193
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -219,16 +223,19 @@ RSpec.describe Asciidoctor::ISO do
|
|
219
223
|
</bibliography>
|
220
224
|
</iso-standard>
|
221
225
|
OUTPUT
|
226
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
227
|
+
.to be_equivalent_to xmlpp(output)
|
222
228
|
end
|
223
229
|
|
224
230
|
it "processes non-ISO reference in Normative References" do
|
225
|
-
|
231
|
+
input = <<~INPUT
|
226
232
|
#{ASCIIDOC_BLANK_HDR}
|
227
233
|
[bibliography]
|
228
234
|
== Normative References
|
229
235
|
|
230
236
|
* [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
|
231
237
|
INPUT
|
238
|
+
output = <<~OUTPUT
|
232
239
|
#{BLANK_HDR}
|
233
240
|
<sections>
|
234
241
|
|
@@ -248,16 +255,19 @@ RSpec.describe Asciidoctor::ISO do
|
|
248
255
|
</bibliography>
|
249
256
|
</iso-standard>
|
250
257
|
OUTPUT
|
258
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
259
|
+
.to be_equivalent_to xmlpp(output)
|
251
260
|
end
|
252
261
|
|
253
262
|
it "processes non-ISO reference in Bibliography" do
|
254
|
-
|
263
|
+
input = <<~INPUT
|
255
264
|
#{ASCIIDOC_BLANK_HDR}
|
256
265
|
[bibliography]
|
257
266
|
== Bibliography
|
258
267
|
|
259
268
|
* [[[iso123,1]]] _Standard_
|
260
269
|
INPUT
|
270
|
+
output = <<~OUTPUT
|
261
271
|
#{BLANK_HDR}
|
262
272
|
<sections>
|
263
273
|
|
@@ -275,6 +285,79 @@ RSpec.describe Asciidoctor::ISO do
|
|
275
285
|
</bibliography>
|
276
286
|
</iso-standard>
|
277
287
|
OUTPUT
|
288
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
289
|
+
.to be_equivalent_to xmlpp(output)
|
290
|
+
end
|
291
|
+
|
292
|
+
it "sort ISO references in Bibliography" do
|
293
|
+
VCR.use_cassette "sortrefs" do
|
294
|
+
input = <<~INPUT
|
295
|
+
#{ASCIIDOC_BLANK_HDR}
|
296
|
+
[bibliography]
|
297
|
+
== Bibliography
|
298
|
+
|
299
|
+
* [[[iso1,ISO 8000-110]]]
|
300
|
+
* [[[iso2,ISO 8000-61]]]
|
301
|
+
* [[[iso3,ISO 8000-8]]]
|
302
|
+
* [[[iso4,ISO 9]]]
|
303
|
+
INPUT
|
304
|
+
output = <<~OUTPUT
|
305
|
+
#{BLANK_HDR}
|
306
|
+
<sections> </sections>
|
307
|
+
<bibliography>
|
308
|
+
<references id='_' normative='false' obligation='informative'>
|
309
|
+
<title>Bibliography</title>
|
310
|
+
<bibitem id='iso4' type='standard'>
|
311
|
+
<docidentifier>ISO 9</docidentifier>
|
312
|
+
<docnumber>9</docnumber>
|
313
|
+
<contributor>
|
314
|
+
<role type='publisher'/>
|
315
|
+
<organization>
|
316
|
+
<name>International Organization for Standardization</name>
|
317
|
+
<abbreviation>ISO</abbreviation>
|
318
|
+
</organization>
|
319
|
+
</contributor>
|
320
|
+
</bibitem>
|
321
|
+
<bibitem id='iso3' type='standard'>
|
322
|
+
<docidentifier>ISO 8000-8</docidentifier>
|
323
|
+
<docnumber>8000-8</docnumber>
|
324
|
+
<contributor>
|
325
|
+
<role type='publisher'/>
|
326
|
+
<organization>
|
327
|
+
<name>International Organization for Standardization</name>
|
328
|
+
<abbreviation>ISO</abbreviation>
|
329
|
+
</organization>
|
330
|
+
</contributor>
|
331
|
+
</bibitem>
|
332
|
+
<bibitem id='iso2' type='standard'>
|
333
|
+
<docidentifier>ISO 8000-61</docidentifier>
|
334
|
+
<docnumber>8000-61</docnumber>
|
335
|
+
<contributor>
|
336
|
+
<role type='publisher'/>
|
337
|
+
<organization>
|
338
|
+
<name>International Organization for Standardization</name>
|
339
|
+
<abbreviation>ISO</abbreviation>
|
340
|
+
</organization>
|
341
|
+
</contributor>
|
342
|
+
</bibitem>
|
343
|
+
<bibitem id='iso1' type='standard'>
|
344
|
+
<docidentifier>ISO 8000-110</docidentifier>
|
345
|
+
<docnumber>8000-110</docnumber>
|
346
|
+
<contributor>
|
347
|
+
<role type='publisher'/>
|
348
|
+
<organization>
|
349
|
+
<name>International Organization for Standardization</name>
|
350
|
+
<abbreviation>ISO</abbreviation>
|
351
|
+
</organization>
|
352
|
+
</contributor>
|
353
|
+
</bibitem>
|
354
|
+
</references>
|
355
|
+
</bibliography>
|
356
|
+
</iso-standard>
|
357
|
+
OUTPUT
|
358
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
359
|
+
.to be_equivalent_to xmlpp(output)
|
360
|
+
end
|
278
361
|
end
|
279
362
|
|
280
363
|
private
|
@@ -95,7 +95,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
95
95
|
</li>
|
96
96
|
</ul>
|
97
97
|
<term id="term-term1">
|
98
|
-
<preferred>Term1</preferred>
|
98
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
99
99
|
</term>
|
100
100
|
</terms>
|
101
101
|
<clause id="_" obligation="normative">
|
@@ -103,7 +103,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
103
103
|
<terms id="_" obligation="normative">
|
104
104
|
<title>Normal Terms</title>
|
105
105
|
<term id="term-term2">
|
106
|
-
<preferred>Term2</preferred>
|
106
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
107
107
|
</term>
|
108
108
|
</terms>
|
109
109
|
<definitions id="_" obligation="normative">
|
@@ -292,7 +292,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
292
292
|
</li>
|
293
293
|
</ul>
|
294
294
|
<term id="term-term1">
|
295
|
-
<preferred>Term1</preferred>
|
295
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
296
296
|
</term>
|
297
297
|
</terms>
|
298
298
|
</sections>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -30,7 +30,7 @@ RSpec.describe IsoDoc do
|
|
30
30
|
<terms id="I" obligation="normative">
|
31
31
|
<title>Normal Terms</title>
|
32
32
|
<term id="J">
|
33
|
-
<preferred>Term2</preferred>
|
33
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
34
34
|
</term>
|
35
35
|
</terms>
|
36
36
|
<definitions id="K">
|
@@ -249,13 +249,18 @@ RSpec.describe IsoDoc do
|
|
249
249
|
</body>
|
250
250
|
</html>
|
251
251
|
OUTPUT
|
252
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
253
|
-
.
|
254
|
-
|
252
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
253
|
+
.convert("test", input, true))
|
254
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
255
|
+
.to be_equivalent_to xmlpp(presxml)
|
256
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
257
|
+
.convert("test", presxml, true)))
|
258
|
+
.to be_equivalent_to xmlpp(html)
|
255
259
|
end
|
256
260
|
|
257
261
|
it "defaults to English" do
|
258
|
-
output = IsoDoc::Iso::PresentationXMLConvert.new({})
|
262
|
+
output = IsoDoc::Iso::PresentationXMLConvert.new({})
|
263
|
+
.convert("test", <<~"INPUT", true)
|
259
264
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
260
265
|
<bibdata>
|
261
266
|
<language>tlh</language>
|
@@ -283,7 +288,7 @@ RSpec.describe IsoDoc do
|
|
283
288
|
<terms id="I" obligation="normative">
|
284
289
|
<title>Normal Terms</title>
|
285
290
|
<term id="J">
|
286
|
-
<preferred>Term2</preferred>
|
291
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
287
292
|
</term>
|
288
293
|
</terms>
|
289
294
|
<definitions id="K">
|
@@ -334,7 +339,8 @@ RSpec.describe IsoDoc do
|
|
334
339
|
</bibliography>
|
335
340
|
</iso-standard>
|
336
341
|
INPUT
|
337
|
-
expect(xmlpp(output)
|
342
|
+
expect(xmlpp(output)
|
343
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
338
344
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
339
345
|
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
340
346
|
<bibdata>
|
@@ -457,7 +463,7 @@ RSpec.describe IsoDoc do
|
|
457
463
|
<terms id="I" obligation="normative">
|
458
464
|
<title>Normal Terms</title>
|
459
465
|
<term id="J">
|
460
|
-
<preferred>Term2</preferred>
|
466
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
461
467
|
</term>
|
462
468
|
</terms>
|
463
469
|
<definitions id="K">
|
@@ -686,9 +692,13 @@ RSpec.describe IsoDoc do
|
|
686
692
|
</body>
|
687
693
|
</html>
|
688
694
|
OUTPUT
|
689
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
690
|
-
.
|
691
|
-
|
695
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
696
|
+
.convert("test", input, true))
|
697
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
698
|
+
.to be_equivalent_to xmlpp(presxml)
|
699
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
700
|
+
.convert("test", presxml, true)))
|
701
|
+
.to be_equivalent_to xmlpp(html)
|
692
702
|
end
|
693
703
|
|
694
704
|
it "processes Simplified Chinese" do
|
@@ -728,7 +738,7 @@ RSpec.describe IsoDoc do
|
|
728
738
|
<terms id="I" obligation="normative">
|
729
739
|
<title>Normal Terms</title>
|
730
740
|
<term id="J">
|
731
|
-
<preferred>Term2</preferred>
|
741
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
732
742
|
</term>
|
733
743
|
</terms>
|
734
744
|
<definitions id="K">
|
@@ -989,8 +999,12 @@ RSpec.describe IsoDoc do
|
|
989
999
|
</body>
|
990
1000
|
</html>
|
991
1001
|
OUTPUT
|
992
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
993
|
-
.
|
994
|
-
|
1002
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
1003
|
+
.convert("test", input, true))
|
1004
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
1005
|
+
.to be_equivalent_to xmlpp(presxml)
|
1006
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
1007
|
+
.convert("test", presxml, true)))
|
1008
|
+
.to be_equivalent_to xmlpp(html)
|
995
1009
|
end
|
996
1010
|
end
|