metanorma-standoc 1.10.8 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/asciidoctor/standoc/base.rb +5 -4
- data/lib/asciidoctor/standoc/cleanup.rb +20 -11
- data/lib/asciidoctor/standoc/cleanup_inline.rb +20 -7
- data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -21
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +37 -77
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +162 -0
- data/lib/asciidoctor/standoc/converter.rb +2 -0
- data/lib/asciidoctor/standoc/inline.rb +7 -5
- data/lib/asciidoctor/standoc/isodoc.rng +218 -27
- data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
- data/lib/asciidoctor/standoc/macros_terms.rb +49 -5
- data/lib/asciidoctor/standoc/ref_sect.rb +24 -17
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
- data/lib/asciidoctor/standoc/terms.rb +12 -2
- data/lib/asciidoctor/standoc/utils.rb +36 -23
- data/lib/asciidoctor/standoc/validate.rb +24 -15
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor/base_spec.rb +4 -3
- data/spec/asciidoctor/blocks_spec.rb +149 -21
- data/spec/asciidoctor/cleanup_sections_spec.rb +7 -7
- data/spec/asciidoctor/cleanup_spec.rb +21 -195
- data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
- data/spec/asciidoctor/inline_spec.rb +2 -2
- data/spec/asciidoctor/macros_plantuml_spec.rb +36 -1
- data/spec/asciidoctor/macros_spec.rb +189 -112
- data/spec/asciidoctor/refs_spec.rb +2 -24
- data/spec/asciidoctor/section_spec.rb +18 -18
- data/spec/asciidoctor/validate_spec.rb +59 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +46 -46
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +32 -32
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -65
- metadata +8 -5
@@ -353,10 +353,11 @@ RSpec.describe Asciidoctor::Standoc do
|
|
353
353
|
<title>Terms and definitions</title>
|
354
354
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
355
355
|
<term id='term-term1'>
|
356
|
-
<preferred>Term1</preferred>
|
356
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
357
357
|
<definition>
|
358
|
+
<verbaldefinition>
|
358
359
|
<p id='_'>first definition</p>
|
359
|
-
<termsource status='identical'>
|
360
|
+
<termsource status='identical' type="authoritative">
|
360
361
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
361
362
|
<localityStack>
|
362
363
|
<locality type='section'>
|
@@ -365,10 +366,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
365
366
|
</localityStack>
|
366
367
|
</origin>
|
367
368
|
</termsource>
|
369
|
+
</verbaldefinition>
|
368
370
|
</definition>
|
369
371
|
<definition>
|
372
|
+
<verbaldefinition>
|
370
373
|
<p id='_'>second definition</p>
|
371
|
-
<termsource status='identical'>
|
374
|
+
<termsource status='identical' type="authoritative">
|
372
375
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
373
376
|
<localityStack>
|
374
377
|
<locality type='section'>
|
@@ -377,11 +380,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
377
380
|
</localityStack>
|
378
381
|
</origin>
|
379
382
|
</termsource>
|
383
|
+
</verbaldefinition>
|
380
384
|
</definition>
|
381
385
|
<termnote id='_'>
|
382
386
|
<p id='_'>This is a note</p>
|
383
387
|
</termnote>
|
384
|
-
<termsource status='identical'>
|
388
|
+
<termsource status='identical' type="authoritative">
|
385
389
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
386
390
|
<localityStack>
|
387
391
|
<locality type='section'>
|
@@ -420,7 +424,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
420
424
|
<title>Terms and definitions</title>
|
421
425
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
422
426
|
<term id="term-term1">
|
423
|
-
<preferred>Term1</preferred>
|
427
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
424
428
|
<termnote id="_">
|
425
429
|
<p id="_">This is a note</p>
|
426
430
|
</termnote>
|
@@ -495,7 +499,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
495
499
|
<terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
|
496
500
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
497
501
|
<term id="term-term1">
|
498
|
-
<preferred>Term1</preferred>
|
502
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
499
503
|
</term>
|
500
504
|
<definitions id="_" obligation="normative" type="symbols">
|
501
505
|
<title>Symbols</title>
|
@@ -653,7 +657,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
653
657
|
<title>Terms and definitions</title>
|
654
658
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
655
659
|
<term id="term-term1">
|
656
|
-
<preferred>Term1</preferred>
|
660
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
657
661
|
<termexample id="ABC" tag='X' multilingual-rendering='common'>
|
658
662
|
<p id="_">This is an example</p>
|
659
663
|
</termexample></term>
|
@@ -713,7 +717,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
713
717
|
<sections>
|
714
718
|
<terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
|
715
719
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p><term id="term-term1">
|
716
|
-
<preferred>Term1</preferred>
|
720
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
717
721
|
</term>
|
718
722
|
<definitions id="_" obligation="normative" type="symbols">
|
719
723
|
<title>Symbols</title>
|
@@ -1010,6 +1014,50 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1010
1014
|
INPUT
|
1011
1015
|
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1012
1016
|
.to include '<image src="data:image/png;base64'
|
1017
|
+
|
1018
|
+
input = <<~INPUT
|
1019
|
+
= Document title
|
1020
|
+
Author
|
1021
|
+
:docfile: test.adoc
|
1022
|
+
:nodoc:
|
1023
|
+
:novalid:
|
1024
|
+
:no-isobib:
|
1025
|
+
:data-uri-image: true
|
1026
|
+
|
1027
|
+
.Split-it-right sample divider
|
1028
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1029
|
+
INPUT
|
1030
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1031
|
+
.to include '<image src="data:image/png;base64'
|
1032
|
+
|
1033
|
+
input = <<~INPUT
|
1034
|
+
= Document title
|
1035
|
+
Author
|
1036
|
+
:docfile: test.adoc
|
1037
|
+
:nodoc:
|
1038
|
+
:novalid:
|
1039
|
+
:no-isobib:
|
1040
|
+
:data-uri-image: false
|
1041
|
+
|
1042
|
+
.Split-it-right sample divider
|
1043
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1044
|
+
INPUT
|
1045
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1046
|
+
.not_to include '<image src="data:image/png;base64'
|
1047
|
+
|
1048
|
+
input = <<~INPUT
|
1049
|
+
= Document title
|
1050
|
+
Author
|
1051
|
+
:docfile: test.adoc
|
1052
|
+
:nodoc:
|
1053
|
+
:novalid:
|
1054
|
+
:no-isobib:
|
1055
|
+
|
1056
|
+
.Split-it-right sample divider
|
1057
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1058
|
+
INPUT
|
1059
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1060
|
+
.to include '<image src="data:image/png;base64'
|
1013
1061
|
end
|
1014
1062
|
|
1015
1063
|
it "accepts attributes on paragraphs" do
|
@@ -1124,6 +1172,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1124
1172
|
|
1125
1173
|
=== Term1
|
1126
1174
|
|
1175
|
+
Definition 0
|
1176
|
+
|
1127
1177
|
[.source]
|
1128
1178
|
<<ISO2191,section=1>>
|
1129
1179
|
|
@@ -1150,15 +1200,16 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1150
1200
|
<title>Terms and definitions</title><p id="_">For the purposes of this document,
|
1151
1201
|
the following terms and definitions apply.</p>
|
1152
1202
|
<term id="term-term1">
|
1153
|
-
<preferred>Term1</preferred>
|
1154
|
-
<
|
1203
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1204
|
+
<definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
|
1205
|
+
<termsource status="identical" type="authoritative">
|
1155
1206
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1156
1207
|
<localityStack>
|
1157
1208
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
1158
1209
|
</localityStack>
|
1159
1210
|
</origin>
|
1160
1211
|
</termsource>
|
1161
|
-
<termsource status="identical">
|
1212
|
+
<termsource status="identical" type="authoritative">
|
1162
1213
|
<origin bibitemid="ISO2191" type="inline" citeas="" case='capital' droploc='true'>
|
1163
1214
|
<localityStack>
|
1164
1215
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -1167,21 +1218,23 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1167
1218
|
</termsource>
|
1168
1219
|
</term>
|
1169
1220
|
<term id='term-term2'>
|
1170
|
-
<preferred>Term2</preferred>
|
1221
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
1171
1222
|
<definition>
|
1223
|
+
<verbaldefinition>
|
1172
1224
|
<p id='_'>Definition</p>
|
1225
|
+
</verbaldefinition>
|
1173
1226
|
</definition>
|
1174
|
-
<termsource status='identical'>
|
1227
|
+
<termsource status='identical' type="authoritative">
|
1175
1228
|
<origin citeas=''>
|
1176
1229
|
<termref base='IEV' target='xyz'/>
|
1177
1230
|
</origin>
|
1178
1231
|
</termsource>
|
1179
|
-
<termsource status='identical'>
|
1232
|
+
<termsource status='identical' type="authoritative">
|
1180
1233
|
<origin citeas=''>
|
1181
1234
|
<termref base='IEV' target='xyz'/>
|
1182
1235
|
</origin>
|
1183
1236
|
</termsource>
|
1184
|
-
<termsource status='identical'>
|
1237
|
+
<termsource status='identical' type="authoritative">
|
1185
1238
|
<origin citeas=''>
|
1186
1239
|
<termref base='IEV' target='xyz'/>
|
1187
1240
|
</origin>
|
@@ -1202,6 +1255,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1202
1255
|
|
1203
1256
|
=== Term1
|
1204
1257
|
|
1258
|
+
Definition 0
|
1259
|
+
|
1205
1260
|
[.source]
|
1206
1261
|
<<ISO2191,section=1>>, with adjustments
|
1207
1262
|
|
@@ -1220,8 +1275,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1220
1275
|
<p id="_">For the purposes of this document,
|
1221
1276
|
the following terms and definitions apply.</p>
|
1222
1277
|
<term id="term-term1">
|
1223
|
-
<preferred>Term1</preferred>
|
1224
|
-
<
|
1278
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1279
|
+
<definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
|
1280
|
+
<termsource status="modified" type="authoritative">
|
1225
1281
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1226
1282
|
<localityStack>
|
1227
1283
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -1233,11 +1289,11 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1233
1289
|
</termsource>
|
1234
1290
|
</term>
|
1235
1291
|
<term id='term-term2'>
|
1236
|
-
<preferred>Term2</preferred>
|
1237
|
-
<definition>
|
1292
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
1293
|
+
<definition><verbaldefinition>
|
1238
1294
|
<p id='_'>Definition</p>
|
1239
|
-
</definition>
|
1240
|
-
<termsource status='modified'>
|
1295
|
+
</verbaldefinition></definition>
|
1296
|
+
<termsource status='modified' type="authoritative">
|
1241
1297
|
<origin citeas=''>
|
1242
1298
|
<termref base='IEV' target='xyz'/>
|
1243
1299
|
</origin>
|
@@ -1254,6 +1310,78 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1254
1310
|
.to be_equivalent_to xmlpp(output)
|
1255
1311
|
end
|
1256
1312
|
|
1313
|
+
|
1314
|
+
it "processes term source attributes" do
|
1315
|
+
input = <<~INPUT
|
1316
|
+
#{ASCIIDOC_BLANK_HDR}
|
1317
|
+
== Terms and Definitions
|
1318
|
+
|
1319
|
+
=== Term1
|
1320
|
+
|
1321
|
+
Definition 0
|
1322
|
+
|
1323
|
+
[.source,status=generalisation]
|
1324
|
+
<<ISO2191,section=1>>, with adjustments
|
1325
|
+
|
1326
|
+
=== Term2
|
1327
|
+
|
1328
|
+
Definition
|
1329
|
+
|
1330
|
+
[.source,type=lineage]
|
1331
|
+
{{<<IEV:xyz>>}}, with adjustments
|
1332
|
+
INPUT
|
1333
|
+
output = <<~OUTPUT
|
1334
|
+
#{BLANK_HDR}
|
1335
|
+
<sections>
|
1336
|
+
<terms id='_' obligation='normative'>
|
1337
|
+
<title>Terms and definitions</title>
|
1338
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1339
|
+
<term id='term-term1'>
|
1340
|
+
<preferred>
|
1341
|
+
<expression>
|
1342
|
+
<name>Term1</name>
|
1343
|
+
</expression>
|
1344
|
+
</preferred>
|
1345
|
+
<definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
|
1346
|
+
<termsource status='generalisation' type='authoritative'>
|
1347
|
+
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
1348
|
+
<localityStack>
|
1349
|
+
<locality type='section'>
|
1350
|
+
<referenceFrom>1</referenceFrom>
|
1351
|
+
</locality>
|
1352
|
+
</localityStack>
|
1353
|
+
</origin>
|
1354
|
+
<modification>
|
1355
|
+
<p id='_'>with adjustments</p>
|
1356
|
+
</modification>
|
1357
|
+
</termsource>
|
1358
|
+
</term>
|
1359
|
+
<term id='term-term2'>
|
1360
|
+
<preferred>
|
1361
|
+
<expression>
|
1362
|
+
<name>Term2</name>
|
1363
|
+
</expression>
|
1364
|
+
</preferred>
|
1365
|
+
<definition><verbaldefinition>
|
1366
|
+
<p id='_'>Definition</p>
|
1367
|
+
</verbaldefinition></definition>
|
1368
|
+
<termsource status='modified' type='lineage'>
|
1369
|
+
<origin citeas=''>
|
1370
|
+
<termref base='IEV' target='xyz'/>
|
1371
|
+
</origin>
|
1372
|
+
<modification>
|
1373
|
+
<p id='_'>with adjustments</p>
|
1374
|
+
</modification>
|
1375
|
+
</termsource>
|
1376
|
+
</term>
|
1377
|
+
</terms>
|
1378
|
+
</sections>
|
1379
|
+
</standard-document>
|
1380
|
+
OUTPUT
|
1381
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1382
|
+
.to be_equivalent_to xmlpp(output)
|
1383
|
+
end
|
1384
|
+
|
1257
1385
|
it "processes recommendation" do
|
1258
1386
|
input = <<~"INPUT"
|
1259
1387
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -28,8 +28,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
28
28
|
</li>
|
29
29
|
</ul>
|
30
30
|
<term id="term-time">
|
31
|
-
<preferred>Time</preferred>
|
32
|
-
<definition><p id="_">This paragraph is extraneous</p></definition>
|
31
|
+
<preferred><expression><name>Time</name></expression></preferred>
|
32
|
+
<definition><verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition></definition>
|
33
33
|
</term></terms>
|
34
34
|
</sections>
|
35
35
|
</standard-document>
|
@@ -521,7 +521,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
521
521
|
</title>
|
522
522
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
523
523
|
<term id='term-term1'>
|
524
|
-
<preferred>Term1</preferred>
|
524
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
525
525
|
</term>
|
526
526
|
</terms>
|
527
527
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -796,7 +796,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
796
796
|
<title>Terms and definitions</title>
|
797
797
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
798
798
|
<term id='term-term1'>
|
799
|
-
<preferred>Term1</preferred>
|
799
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
800
800
|
</term>
|
801
801
|
</terms>
|
802
802
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1033,7 +1033,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1033
1033
|
s’appliquent.
|
1034
1034
|
</p>
|
1035
1035
|
<term id='term-term1'>
|
1036
|
-
<preferred>Term1</preferred>
|
1036
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1037
1037
|
</term>
|
1038
1038
|
</terms>
|
1039
1039
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1267,7 +1267,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1267
1267
|
<title>术语和定义</title>
|
1268
1268
|
<p id='_'>下列术语和定义适用于本文件。</p>
|
1269
1269
|
<term id='term-term1'>
|
1270
|
-
<preferred>Term1</preferred>
|
1270
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1271
1271
|
</term>
|
1272
1272
|
</terms>
|
1273
1273
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1501,7 +1501,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1501
1501
|
<title>Terms and definitions</title>
|
1502
1502
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1503
1503
|
<term id='term-term1'>
|
1504
|
-
<preferred>Term1</preferred>
|
1504
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1505
1505
|
</term>
|
1506
1506
|
</terms>
|
1507
1507
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -213,141 +213,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
213
213
|
.to be_equivalent_to xmlpp(output)
|
214
214
|
end
|
215
215
|
|
216
|
-
it "processes stem-only terms as admitted" do
|
217
|
-
input = <<~INPUT
|
218
|
-
#{ASCIIDOC_BLANK_HDR}
|
219
|
-
== Terms and Definitions
|
220
|
-
|
221
|
-
=== stem:[t_90]
|
222
|
-
|
223
|
-
stem:[t_91]
|
224
|
-
|
225
|
-
Time
|
226
|
-
INPUT
|
227
|
-
output = <<~OUTPUT
|
228
|
-
#{BLANK_HDR}
|
229
|
-
<sections>
|
230
|
-
<terms id="_" obligation="normative">
|
231
|
-
<title>Terms and definitions</title>
|
232
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
233
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
234
|
-
<mrow>
|
235
|
-
<mi>t</mi>
|
236
|
-
</mrow>
|
237
|
-
<mrow>
|
238
|
-
<mn>90</mn>
|
239
|
-
</mrow>
|
240
|
-
</msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
241
|
-
<mrow>
|
242
|
-
<mi>t</mi>
|
243
|
-
</mrow>
|
244
|
-
<mrow>
|
245
|
-
<mn>91</mn>
|
246
|
-
</mrow>
|
247
|
-
</msub></math></stem></admitted>
|
248
|
-
<definition><p id="_">Time</p></definition></term>
|
249
|
-
</terms>
|
250
|
-
</sections>
|
251
|
-
</standard-document>
|
252
|
-
OUTPUT
|
253
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
254
|
-
.to be_equivalent_to xmlpp(output)
|
255
|
-
end
|
256
|
-
|
257
|
-
it "moves term domains out of the term definition paragraph" do
|
258
|
-
input = <<~INPUT
|
259
|
-
#{ASCIIDOC_BLANK_HDR}
|
260
|
-
== Terms and Definitions
|
261
|
-
|
262
|
-
=== Tempus
|
263
|
-
|
264
|
-
domain:[relativity] Time
|
265
|
-
|
266
|
-
=== Tempus1
|
267
|
-
|
268
|
-
Time2
|
269
|
-
|
270
|
-
domain:[relativity2]
|
271
|
-
INPUT
|
272
|
-
output = <<~OUTPUT
|
273
|
-
#{BLANK_HDR}
|
274
|
-
<sections>
|
275
|
-
<terms id="_" obligation="normative">
|
276
|
-
<title>Terms and definitions</title>
|
277
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
278
|
-
<term id="term-tempus">
|
279
|
-
<preferred>Tempus</preferred>
|
280
|
-
<domain>relativity</domain><definition><p id="_"> Time</p></definition>
|
281
|
-
</term>
|
282
|
-
<term id='term-tempus1'>
|
283
|
-
<preferred>Tempus1</preferred>
|
284
|
-
<domain>relativity2</domain>
|
285
|
-
<definition>
|
286
|
-
<p id='_'>Time2</p>
|
287
|
-
<p id='_'> </p>
|
288
|
-
</definition>
|
289
|
-
</term>
|
290
|
-
</terms>
|
291
|
-
</sections>
|
292
|
-
</standard-document>
|
293
|
-
OUTPUT
|
294
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
295
|
-
.to be_equivalent_to xmlpp(output)
|
296
|
-
end
|
297
|
-
|
298
|
-
it "permits multiple blocks in term definition paragraph" do
|
299
|
-
input = <<~INPUT
|
300
|
-
= Document title
|
301
|
-
Author
|
302
|
-
:docfile: test.adoc
|
303
|
-
:nodoc:
|
304
|
-
:novalid:
|
305
|
-
:stem:
|
306
|
-
|
307
|
-
== Terms and Definitions
|
308
|
-
|
309
|
-
=== stem:[t_90]
|
310
|
-
|
311
|
-
[stem]
|
312
|
-
++++
|
313
|
-
t_A
|
314
|
-
++++
|
315
|
-
|
316
|
-
This paragraph is extraneous
|
317
|
-
INPUT
|
318
|
-
output = <<~OUTPUT
|
319
|
-
#{BLANK_HDR}
|
320
|
-
<sections>
|
321
|
-
<terms id="_" obligation="normative">
|
322
|
-
<title>Terms and definitions</title>
|
323
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
324
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
325
|
-
<mrow>
|
326
|
-
<mi>t</mi>
|
327
|
-
</mrow>
|
328
|
-
<mrow>
|
329
|
-
<mn>90</mn>
|
330
|
-
</mrow>
|
331
|
-
</msub></math></stem></preferred><definition><formula id="_">
|
332
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
333
|
-
<mrow>
|
334
|
-
<mi>t</mi>
|
335
|
-
</mrow>
|
336
|
-
<mrow>
|
337
|
-
<mi>A</mi>
|
338
|
-
</mrow>
|
339
|
-
</msub></math></stem>
|
340
|
-
</formula>
|
341
|
-
<p id="_">This paragraph is extraneous</p></definition>
|
342
|
-
</term>
|
343
|
-
</terms>
|
344
|
-
</sections>
|
345
|
-
</standard-document>
|
346
|
-
OUTPUT
|
347
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
348
|
-
.to be_equivalent_to xmlpp(output)
|
349
|
-
end
|
350
|
-
|
351
216
|
it "converts xrefs to references into erefs" do
|
352
217
|
input = <<~INPUT
|
353
218
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -548,6 +413,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
548
413
|
|
549
414
|
=== Term1
|
550
415
|
|
416
|
+
Definition 0
|
417
|
+
|
551
418
|
[.source]
|
552
419
|
<<ISO2191,section=1>>
|
553
420
|
INPUT
|
@@ -558,8 +425,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
558
425
|
<title>Terms and definitions</title>
|
559
426
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
560
427
|
<term id="term-term1">
|
561
|
-
<preferred>Term1</preferred>
|
562
|
-
<
|
428
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
429
|
+
<definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
|
430
|
+
<termsource status="identical" type="authoritative">
|
563
431
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
564
432
|
<localityStack>
|
565
433
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -630,57 +498,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
630
498
|
.to be_equivalent_to xmlpp(output)
|
631
499
|
end
|
632
500
|
|
633
|
-
it "rearranges term note, term example, term source" do
|
634
|
-
input = <<~INPUT
|
635
|
-
#{ASCIIDOC_BLANK_HDR}
|
636
|
-
|
637
|
-
== Terms and definitions
|
638
|
-
|
639
|
-
=== Term
|
640
|
-
|
641
|
-
[.source]
|
642
|
-
<<ISO2191,section=1>>
|
643
|
-
|
644
|
-
NOTE: Note
|
645
|
-
|
646
|
-
[example]
|
647
|
-
Example 1
|
648
|
-
|
649
|
-
NOTE: Note 2
|
650
|
-
|
651
|
-
[example]
|
652
|
-
Example 2
|
653
|
-
INPUT
|
654
|
-
output = <<~OUTPUT
|
655
|
-
#{BLANK_HDR}
|
656
|
-
<sections>
|
657
|
-
<terms id="_" obligation="normative">
|
658
|
-
<title>Terms and definitions</title>
|
659
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
660
|
-
<term id="term-term"><preferred>Term</preferred>
|
661
|
-
<termnote id="_">
|
662
|
-
<p id="_">Note</p>
|
663
|
-
</termnote><termnote id="_">
|
664
|
-
<p id="_">Note 2</p>
|
665
|
-
</termnote><termexample id="_">
|
666
|
-
<p id="_">Example 1</p>
|
667
|
-
</termexample><termexample id="_">
|
668
|
-
<p id="_">Example 2</p>
|
669
|
-
</termexample><termsource status="identical">
|
670
|
-
<origin bibitemid="ISO2191" type="inline" citeas="">
|
671
|
-
<localityStack>
|
672
|
-
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
673
|
-
</localityStack>
|
674
|
-
</origin>
|
675
|
-
</termsource></term>
|
676
|
-
</terms>
|
677
|
-
</sections>
|
678
|
-
</standard-document>
|
679
|
-
OUTPUT
|
680
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
681
|
-
.to be_equivalent_to xmlpp(output)
|
682
|
-
end
|
683
|
-
|
684
501
|
it "separates IEV citations by top-level clause" do
|
685
502
|
FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
|
686
503
|
FileUtils.mv File.expand_path("~/.relaton/cache"),
|
@@ -702,16 +519,22 @@ RSpec.describe Asciidoctor::Standoc do
|
|
702
519
|
== Terms and definitions
|
703
520
|
=== Automation1
|
704
521
|
|
522
|
+
Definition 1
|
523
|
+
|
705
524
|
[.source]
|
706
525
|
<<iev,clause="103-01-02">>
|
707
526
|
|
708
527
|
=== Automation2
|
709
528
|
|
529
|
+
Definition 2
|
530
|
+
|
710
531
|
[.source]
|
711
532
|
<<iev,clause="102-01-02">>
|
712
533
|
|
713
534
|
=== Automation3
|
714
535
|
|
536
|
+
Definition 3
|
537
|
+
|
715
538
|
[.source]
|
716
539
|
<<iev,clause="103-01-02">>
|
717
540
|
INPUT
|
@@ -721,8 +544,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
721
544
|
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
722
545
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
723
546
|
<term id="term-automation1">
|
724
|
-
<preferred>Automation1</preferred>
|
725
|
-
<
|
547
|
+
<preferred><expression><name>Automation1</name></expression></preferred>
|
548
|
+
<definition><verbaldefinition><p id='_'>Definition 1</p></verbaldefinition></definition>
|
549
|
+
<termsource status="identical" type="authoritative">
|
726
550
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
727
551
|
<localityStack>
|
728
552
|
<locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
|
@@ -731,8 +555,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
731
555
|
</termsource>
|
732
556
|
</term>
|
733
557
|
<term id="term-automation2">
|
734
|
-
<preferred>Automation2</preferred>
|
735
|
-
<
|
558
|
+
<preferred><expression><name>Automation2</name></expression></preferred>
|
559
|
+
<definition><verbaldefinition><p id='_'>Definition 2</p></verbaldefinition></definition>
|
560
|
+
<termsource status="identical" type="authoritative">
|
736
561
|
<origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
|
737
562
|
<localityStack>
|
738
563
|
<locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
|
@@ -741,8 +566,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
741
566
|
</termsource>
|
742
567
|
</term>
|
743
568
|
<term id="term-automation3">
|
744
|
-
<preferred>Automation3</preferred>
|
745
|
-
<
|
569
|
+
<preferred><expression><name>Automation3</name></expression></preferred>
|
570
|
+
<definition><verbaldefinition><p id='_'>Definition 3</p></verbaldefinition></definition>
|
571
|
+
<termsource status="identical" type="authoritative">
|
746
572
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
747
573
|
<localityStack>
|
748
574
|
<locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
|
@@ -1987,7 +1813,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1987
1813
|
====
|
1988
1814
|
INPUT
|
1989
1815
|
output = <<~OUTPUT
|
1990
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version=
|
1816
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version="#{Metanorma::Standoc::VERSION}">
|
1991
1817
|
<bibdata type='standard'>
|
1992
1818
|
<title language='en' format='text/plain'>Document title</title>
|
1993
1819
|
<language>en</language>
|