metanorma-standoc 1.11.0 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/lib/asciidoctor/standoc/base.rb +4 -100
- data/lib/asciidoctor/standoc/blocks.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup.rb +2 -1
- data/lib/asciidoctor/standoc/cleanup_block.rb +1 -2
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
- data/lib/asciidoctor/standoc/cleanup_inline.rb +14 -4
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +3 -3
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
- data/lib/asciidoctor/standoc/cleanup_terms.rb +58 -21
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +50 -19
- data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
- data/lib/asciidoctor/standoc/front.rb +1 -1
- data/lib/asciidoctor/standoc/inline.rb +13 -11
- data/lib/asciidoctor/standoc/isodoc.rng +68 -18
- data/lib/asciidoctor/standoc/lists.rb +1 -3
- data/lib/asciidoctor/standoc/ref.rb +101 -75
- data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
- data/lib/asciidoctor/standoc/ref_sect.rb +18 -7
- data/lib/asciidoctor/standoc/render.rb +117 -0
- data/lib/asciidoctor/standoc/reqt.rb +1 -1
- data/lib/asciidoctor/standoc/section.rb +20 -15
- data/lib/asciidoctor/standoc/utils.rb +0 -16
- data/lib/asciidoctor/standoc/validate.rb +1 -1
- data/lib/isodoc/html/htmlstyle.css +1 -1
- data/lib/isodoc/html/htmlstyle.scss +1 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +3 -3
- data/spec/asciidoctor/blocks_spec.rb +99 -17
- data/spec/asciidoctor/cleanup_blocks_spec.rb +24 -0
- data/spec/asciidoctor/cleanup_sections_spec.rb +1 -1
- data/spec/asciidoctor/cleanup_spec.rb +6 -6
- data/spec/asciidoctor/cleanup_terms_spec.rb +448 -89
- data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
- data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
- data/spec/asciidoctor/inline_spec.rb +5 -5
- data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
- data/spec/asciidoctor/macros_spec.rb +2 -2
- data/spec/asciidoctor/refs_dl_spec.rb +4 -4
- data/spec/asciidoctor/refs_spec.rb +858 -498
- data/spec/asciidoctor/section_spec.rb +32 -3
- data/spec/spec_helper.rb +2 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +179 -179
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +14 -14
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +96 -96
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +108 -108
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
- metadata +9 -8
@@ -355,7 +355,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
355
355
|
<term id='term-term1'>
|
356
356
|
<preferred><expression><name>Term1</name></expression></preferred>
|
357
357
|
<definition>
|
358
|
-
<
|
358
|
+
<verbal-definition>
|
359
359
|
<p id='_'>first definition</p>
|
360
360
|
<termsource status='identical' type="authoritative">
|
361
361
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
@@ -366,10 +366,10 @@ RSpec.describe Asciidoctor::Standoc do
|
|
366
366
|
</localityStack>
|
367
367
|
</origin>
|
368
368
|
</termsource>
|
369
|
-
</
|
369
|
+
</verbal-definition>
|
370
370
|
</definition>
|
371
371
|
<definition>
|
372
|
-
<
|
372
|
+
<verbal-definition>
|
373
373
|
<p id='_'>second definition</p>
|
374
374
|
<termsource status='identical' type="authoritative">
|
375
375
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
@@ -380,7 +380,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
380
380
|
</localityStack>
|
381
381
|
</origin>
|
382
382
|
</termsource>
|
383
|
-
</
|
383
|
+
</verbal-definition>
|
384
384
|
</definition>
|
385
385
|
<termnote id='_'>
|
386
386
|
<p id='_'>This is a note</p>
|
@@ -514,6 +514,59 @@ RSpec.describe Asciidoctor::Standoc do
|
|
514
514
|
.to be_equivalent_to xmlpp(output)
|
515
515
|
end
|
516
516
|
|
517
|
+
it "processes nested terms" do
|
518
|
+
input = <<~INPUT
|
519
|
+
#{ASCIIDOC_BLANK_HDR}
|
520
|
+
== Terms and Definitions
|
521
|
+
|
522
|
+
[.term]
|
523
|
+
=== Term1
|
524
|
+
|
525
|
+
definition
|
526
|
+
|
527
|
+
NOTE: Note 1
|
528
|
+
|
529
|
+
==== Term11
|
530
|
+
definition2
|
531
|
+
|
532
|
+
NOTE: Note 2
|
533
|
+
INPUT
|
534
|
+
output = <<~OUTPUT
|
535
|
+
#{BLANK_HDR}
|
536
|
+
<sections>
|
537
|
+
<clause id='_' obligation='normative'>
|
538
|
+
<title>Terms and definitions</title>
|
539
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
540
|
+
<terms id='_' obligation='normative'>
|
541
|
+
<title>Term1</title>
|
542
|
+
<p id='_'>definition</p>
|
543
|
+
<note id='_'>
|
544
|
+
<p id='_'>Note 1</p>
|
545
|
+
</note>
|
546
|
+
<term id='term-term11'>
|
547
|
+
<preferred>
|
548
|
+
<expression>
|
549
|
+
<name>Term11</name>
|
550
|
+
</expression>
|
551
|
+
</preferred>
|
552
|
+
<definition>
|
553
|
+
<verbal-definition>
|
554
|
+
<p id='_'>definition2</p>
|
555
|
+
</verbal-definition>
|
556
|
+
</definition>
|
557
|
+
<termnote id='_'>
|
558
|
+
<p id='_'>Note 2</p>
|
559
|
+
</termnote>
|
560
|
+
</term>
|
561
|
+
</terms>
|
562
|
+
</clause>
|
563
|
+
</sections>
|
564
|
+
</standard-document>
|
565
|
+
OUTPUT
|
566
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
567
|
+
.to be_equivalent_to xmlpp(output)
|
568
|
+
end
|
569
|
+
|
517
570
|
it "processes notes" do
|
518
571
|
input = <<~INPUT
|
519
572
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -1201,7 +1254,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1201
1254
|
the following terms and definitions apply.</p>
|
1202
1255
|
<term id="term-term1">
|
1203
1256
|
<preferred><expression><name>Term1</name></expression></preferred>
|
1204
|
-
<definition><
|
1257
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1205
1258
|
<termsource status="identical" type="authoritative">
|
1206
1259
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1207
1260
|
<localityStack>
|
@@ -1220,9 +1273,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1220
1273
|
<term id='term-term2'>
|
1221
1274
|
<preferred><expression><name>Term2</name></expression></preferred>
|
1222
1275
|
<definition>
|
1223
|
-
<
|
1276
|
+
<verbal-definition>
|
1224
1277
|
<p id='_'>Definition</p>
|
1225
|
-
</
|
1278
|
+
</verbal-definition>
|
1226
1279
|
</definition>
|
1227
1280
|
<termsource status='identical' type="authoritative">
|
1228
1281
|
<origin citeas=''>
|
@@ -1276,7 +1329,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1276
1329
|
the following terms and definitions apply.</p>
|
1277
1330
|
<term id="term-term1">
|
1278
1331
|
<preferred><expression><name>Term1</name></expression></preferred>
|
1279
|
-
<definition><
|
1332
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1280
1333
|
<termsource status="modified" type="authoritative">
|
1281
1334
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1282
1335
|
<localityStack>
|
@@ -1290,9 +1343,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1290
1343
|
</term>
|
1291
1344
|
<term id='term-term2'>
|
1292
1345
|
<preferred><expression><name>Term2</name></expression></preferred>
|
1293
|
-
<definition><
|
1346
|
+
<definition><verbal-definition>
|
1294
1347
|
<p id='_'>Definition</p>
|
1295
|
-
</
|
1348
|
+
</verbal-definition></definition>
|
1296
1349
|
<termsource status='modified' type="authoritative">
|
1297
1350
|
<origin citeas=''>
|
1298
1351
|
<termref base='IEV' target='xyz'/>
|
@@ -1342,7 +1395,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1342
1395
|
<name>Term1</name>
|
1343
1396
|
</expression>
|
1344
1397
|
</preferred>
|
1345
|
-
<definition><
|
1398
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1346
1399
|
<termsource status='generalisation' type='authoritative'>
|
1347
1400
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
1348
1401
|
<localityStack>
|
@@ -1362,9 +1415,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1362
1415
|
<name>Term2</name>
|
1363
1416
|
</expression>
|
1364
1417
|
</preferred>
|
1365
|
-
<definition><
|
1418
|
+
<definition><verbal-definition>
|
1366
1419
|
<p id='_'>Definition</p>
|
1367
|
-
</
|
1420
|
+
</verbal-definition></definition>
|
1368
1421
|
<termsource status='modified' type='lineage'>
|
1369
1422
|
<origin citeas=''>
|
1370
1423
|
<termref base='IEV' target='xyz'/>
|
@@ -1391,7 +1444,7 @@ OUTPUT
|
|
1391
1444
|
====
|
1392
1445
|
INPUT
|
1393
1446
|
output = <<~"OUTPUT"
|
1394
|
-
|
1447
|
+
#{BLANK_HDR}
|
1395
1448
|
<sections>
|
1396
1449
|
<recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
|
1397
1450
|
<label>/ogc/recommendation/wfs/2</label>
|
@@ -1399,7 +1452,8 @@ OUTPUT
|
|
1399
1452
|
<subject>developer, implementer</subject>
|
1400
1453
|
<inherit>/ss/584/2015/level/1</inherit>
|
1401
1454
|
<inherit>/ss/584/2015/level/2</inherit>
|
1402
|
-
<description><p id="_">I recommend this</p
|
1455
|
+
<description><p id="_">I recommend this</p>
|
1456
|
+
</description>
|
1403
1457
|
</recommendation>
|
1404
1458
|
</sections>
|
1405
1459
|
</standard-document>
|
@@ -1417,6 +1471,9 @@ OUTPUT
|
|
1417
1471
|
.Title
|
1418
1472
|
====
|
1419
1473
|
I recommend this
|
1474
|
+
|
1475
|
+
. http://www.example.com[]
|
1476
|
+
. <<ABC>>
|
1420
1477
|
====
|
1421
1478
|
INPUT
|
1422
1479
|
output = <<~OUTPUT
|
@@ -1425,7 +1482,20 @@ OUTPUT
|
|
1425
1482
|
<requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1426
1483
|
<title>Title</title>
|
1427
1484
|
<inherit>/ss/584/2015/level/1 & /ss/584/2015/level/2</inherit>
|
1428
|
-
<description><p id="_">I recommend this</p
|
1485
|
+
<description><p id="_">I recommend this</p>
|
1486
|
+
<ol id='_' type='arabic'>
|
1487
|
+
<li>
|
1488
|
+
<p id='_'>
|
1489
|
+
<link target='http://www.example.com'/>
|
1490
|
+
</p>
|
1491
|
+
</li>
|
1492
|
+
<li>
|
1493
|
+
<p id='_'>
|
1494
|
+
<xref target='ABC'/>
|
1495
|
+
</p>
|
1496
|
+
</li>
|
1497
|
+
</ol>
|
1498
|
+
</description>
|
1429
1499
|
</requirement>
|
1430
1500
|
</sections>
|
1431
1501
|
</standard-document>
|
@@ -1473,6 +1543,9 @@ OUTPUT
|
|
1473
1543
|
[.permission]
|
1474
1544
|
=====
|
1475
1545
|
I also permit this
|
1546
|
+
|
1547
|
+
. List
|
1548
|
+
. List
|
1476
1549
|
=====
|
1477
1550
|
|
1478
1551
|
[requirement,type="general",label="/req/core/quantities-uom"]
|
@@ -1488,7 +1561,16 @@ OUTPUT
|
|
1488
1561
|
<p id="_">Example 2</p>
|
1489
1562
|
</example></description>
|
1490
1563
|
<permission id="_">
|
1491
|
-
<description><p id="_">I also permit this</p
|
1564
|
+
<description><p id="_">I also permit this</p>
|
1565
|
+
<ol id='_' type='arabic'>
|
1566
|
+
<li>
|
1567
|
+
<p id='_'>List</p>
|
1568
|
+
</li>
|
1569
|
+
<li>
|
1570
|
+
<p id='_'>List</p>
|
1571
|
+
</li>
|
1572
|
+
</ol>
|
1573
|
+
</description>
|
1492
1574
|
</permission>
|
1493
1575
|
<requirement id='_' type='general'>
|
1494
1576
|
<label>/req/core/quantities-uom</label>
|
@@ -1015,4 +1015,28 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1015
1015
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1016
1016
|
.to be_equivalent_to xmlpp(output)
|
1017
1017
|
end
|
1018
|
+
|
1019
|
+
it "updates anchor reference along with anchor to match content" do
|
1020
|
+
input = <<~INPUT
|
1021
|
+
#{ASCIIDOC_BLANK_HDR}
|
1022
|
+
|
1023
|
+
[[samplecode]]
|
1024
|
+
.Sample Code
|
1025
|
+
====
|
1026
|
+
|
1027
|
+
[source,ruby]
|
1028
|
+
--
|
1029
|
+
puts "Hello, world."
|
1030
|
+
%w{a b c}.each do |x| <1>
|
1031
|
+
puts x
|
1032
|
+
end
|
1033
|
+
--
|
1034
|
+
<1> This is an annotation
|
1035
|
+
====
|
1036
|
+
INPUT
|
1037
|
+
output = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
|
1038
|
+
callout_id = output.at("//xmlns:callout/@target").text
|
1039
|
+
annotation_id = output.at("//xmlns:annotation/@id").text
|
1040
|
+
expect(callout_id).to eq(annotation_id)
|
1041
|
+
end
|
1018
1042
|
end
|
@@ -29,7 +29,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
29
29
|
</ul>
|
30
30
|
<term id="term-time">
|
31
31
|
<preferred><expression><name>Time</name></expression></preferred>
|
32
|
-
<definition><
|
32
|
+
<definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
|
33
33
|
</term></terms>
|
34
34
|
</sections>
|
35
35
|
</standard-document>
|
@@ -426,7 +426,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
426
426
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
427
427
|
<term id="term-term1">
|
428
428
|
<preferred><expression><name>Term1</name></expression></preferred>
|
429
|
-
<definition><
|
429
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
430
430
|
<termsource status="identical" type="authoritative">
|
431
431
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
432
432
|
<localityStack>
|
@@ -545,7 +545,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
545
545
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
546
546
|
<term id="term-automation1">
|
547
547
|
<preferred><expression><name>Automation1</name></expression></preferred>
|
548
|
-
<definition><
|
548
|
+
<definition><verbal-definition><p id='_'>Definition 1</p></verbal-definition></definition>
|
549
549
|
<termsource status="identical" type="authoritative">
|
550
550
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
551
551
|
<localityStack>
|
@@ -556,7 +556,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
556
556
|
</term>
|
557
557
|
<term id="term-automation2">
|
558
558
|
<preferred><expression><name>Automation2</name></expression></preferred>
|
559
|
-
<definition><
|
559
|
+
<definition><verbal-definition><p id='_'>Definition 2</p></verbal-definition></definition>
|
560
560
|
<termsource status="identical" type="authoritative">
|
561
561
|
<origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
|
562
562
|
<localityStack>
|
@@ -567,7 +567,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
567
567
|
</term>
|
568
568
|
<term id="term-automation3">
|
569
569
|
<preferred><expression><name>Automation3</name></expression></preferred>
|
570
|
-
<definition><
|
570
|
+
<definition><verbal-definition><p id='_'>Definition 3</p></verbal-definition></definition>
|
571
571
|
<termsource status="identical" type="authoritative">
|
572
572
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
573
573
|
<localityStack>
|
@@ -579,7 +579,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
579
579
|
<title>Normative references</title>
|
580
580
|
#{NORM_REF_BOILERPLATE}
|
581
581
|
<bibitem type="standard" id="IEC60050-102">
|
582
|
-
<fetched
|
582
|
+
<fetched/>
|
583
583
|
<title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
|
584
584
|
<title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics — General concepts and linear algebra</title>
|
585
585
|
<title type='main' format='text/plain' language='en' script='Latn'>International Electrotechnical Vocabulary (IEV) — Part 102: Mathematics — General concepts and linear algebra</title>
|
@@ -618,7 +618,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
618
618
|
</copyright>
|
619
619
|
<place>Geneva</place>
|
620
620
|
</bibitem><bibitem type="standard" id="IEC60050-103">
|
621
|
-
<fetched
|
621
|
+
<fetched/>
|
622
622
|
<title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
|
623
623
|
<title type="title-part" format="text/plain" language="en" script="Latn">Part 103: Mathematics — Functions</title>
|
624
624
|
<title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) — Part 103: Mathematics — Functions</title>
|