metanorma-standoc 2.0.3 → 2.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/standoc/base.rb +73 -23
- data/lib/metanorma/standoc/blocks.rb +1 -1
- data/lib/metanorma/standoc/blocks_notes.rb +2 -2
- data/lib/metanorma/standoc/cleanup_amend.rb +33 -30
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +29 -5
- data/lib/metanorma/standoc/cleanup_ref.rb +31 -2
- data/lib/metanorma/standoc/cleanup_ref_dl.rb +25 -16
- data/lib/metanorma/standoc/cleanup_section.rb +1 -1
- data/lib/metanorma/standoc/cleanup_terms_designations.rb +4 -2
- data/lib/metanorma/standoc/cleanup_text.rb +39 -17
- data/lib/metanorma/standoc/cleanup_xref.rb +70 -8
- data/lib/metanorma/standoc/converter.rb +2 -1
- data/lib/metanorma/standoc/inline.rb +21 -12
- data/lib/metanorma/standoc/isodoc.rng +63 -3
- data/lib/metanorma/standoc/macros.rb +14 -2
- data/lib/metanorma/standoc/macros_embed.rb +35 -14
- data/lib/metanorma/standoc/macros_note.rb +4 -3
- data/lib/metanorma/standoc/processor.rb +6 -1
- data/lib/metanorma/standoc/ref.rb +14 -15
- data/lib/metanorma/standoc/ref_utility.rb +6 -5
- data/lib/metanorma/standoc/render.rb +7 -3
- data/lib/metanorma/standoc/table.rb +8 -10
- data/lib/metanorma/standoc/term_lookup_cleanup.rb +10 -6
- data/lib/metanorma/standoc/utils.rb +3 -1
- data/lib/metanorma/standoc/validate.rb +79 -10
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/assets/a2.adoc +4 -2
- data/spec/assets/a3.adoc +2 -2
- data/spec/assets/a3a.adoc +7 -0
- data/spec/metanorma/base_spec.rb +1 -1
- data/spec/metanorma/cleanup_spec.rb +31 -20
- data/spec/metanorma/cleanup_terms_spec.rb +16 -4
- data/spec/metanorma/inline_spec.rb +31 -0
- data/spec/metanorma/macros_plantuml_spec.rb +41 -42
- data/spec/metanorma/macros_spec.rb +206 -4
- data/spec/metanorma/processor_spec.rb +17 -13
- data/spec/metanorma/refs_spec.rb +129 -2
- data/spec/metanorma/validate_spec.rb +108 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +45 -45
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
- data/spec/vcr_cassettes/hide_refs.yml +39 -39
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +28 -28
- 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 +18 -18
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +75 -65
- metadata +10 -9
@@ -748,7 +748,7 @@ RSpec.describe Metanorma::Standoc do
|
|
748
748
|
<definitions id='clause1' obligation='normative'>
|
749
749
|
<title>Symbols and abbreviated terms</title>
|
750
750
|
<dl id='_'>
|
751
|
-
<dt id='symbol-
|
751
|
+
<dt id='symbol-__x230a_-x-__x230b_'>
|
752
752
|
<stem type='MathML'>
|
753
753
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
754
754
|
<mo>⌊</mo>
|
@@ -770,7 +770,7 @@ RSpec.describe Metanorma::Standoc do
|
|
770
770
|
function.
|
771
771
|
</p>
|
772
772
|
</dd>
|
773
|
-
<dt id='symbol-
|
773
|
+
<dt id='symbol-__x2308_-x-__x2309_'>
|
774
774
|
<stem type='MathML'>
|
775
775
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
776
776
|
<mo>⌈</mo>
|
@@ -1364,8 +1364,70 @@ RSpec.describe Metanorma::Standoc do
|
|
1364
1364
|
embed::spec/assets/a1.adoc[]
|
1365
1365
|
INPUT
|
1366
1366
|
output = <<~OUTPUT
|
1367
|
-
#{
|
1368
|
-
|
1367
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
1368
|
+
<bibdata type='standard'>
|
1369
|
+
<title language='en' format='text/plain'>Document title</title>
|
1370
|
+
<language>en</language>
|
1371
|
+
<script>Latn</script>
|
1372
|
+
<status>
|
1373
|
+
<stage>published</stage>
|
1374
|
+
</status>
|
1375
|
+
<copyright>
|
1376
|
+
<from>2022</from>
|
1377
|
+
</copyright>
|
1378
|
+
<ext>
|
1379
|
+
<doctype>article</doctype>
|
1380
|
+
</ext>
|
1381
|
+
<relation type='derivedFrom'>
|
1382
|
+
<bibitem>
|
1383
|
+
<title language='en' format='text/plain'>A2</title>
|
1384
|
+
<language>en</language>
|
1385
|
+
<script>Latn</script>
|
1386
|
+
<status>
|
1387
|
+
<stage>published</stage>
|
1388
|
+
</status>
|
1389
|
+
<copyright>
|
1390
|
+
<from>2022</from>
|
1391
|
+
</copyright>
|
1392
|
+
<ext>
|
1393
|
+
<doctype>article</doctype>
|
1394
|
+
</ext>
|
1395
|
+
<relation type='derivedFrom'>
|
1396
|
+
<bibitem>
|
1397
|
+
<title language='en' format='text/plain'>A3</title>
|
1398
|
+
<language>en</language>
|
1399
|
+
<script>Latn</script>
|
1400
|
+
<status>
|
1401
|
+
<stage>published</stage>
|
1402
|
+
</status>
|
1403
|
+
<copyright>
|
1404
|
+
<from>2022</from>
|
1405
|
+
</copyright>
|
1406
|
+
<ext>
|
1407
|
+
<doctype>article</doctype>
|
1408
|
+
</ext>
|
1409
|
+
</bibitem>
|
1410
|
+
</relation>
|
1411
|
+
<relation type='derivedFrom'>
|
1412
|
+
<bibitem>
|
1413
|
+
<title language='en' format='text/plain'>A3a</title>
|
1414
|
+
<language>en</language>
|
1415
|
+
<script>Latn</script>
|
1416
|
+
<status>
|
1417
|
+
<stage>published</stage>
|
1418
|
+
</status>
|
1419
|
+
<copyright>
|
1420
|
+
<from>2022</from>
|
1421
|
+
</copyright>
|
1422
|
+
<ext>
|
1423
|
+
<doctype>article</doctype>
|
1424
|
+
</ext>
|
1425
|
+
</bibitem>
|
1426
|
+
</relation>
|
1427
|
+
</bibitem>
|
1428
|
+
</relation>
|
1429
|
+
</bibdata>
|
1430
|
+
<sections>
|
1369
1431
|
<clause id='clause1' inline-header='false' obligation='normative'>
|
1370
1432
|
<title>Clause</title>
|
1371
1433
|
</clause>
|
@@ -1381,6 +1443,10 @@ RSpec.describe Metanorma::Standoc do
|
|
1381
1443
|
<title>Clause 3</title>
|
1382
1444
|
<p id='_'>X</p>
|
1383
1445
|
</clause>
|
1446
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1447
|
+
<title>Clause 3a</title>
|
1448
|
+
<p id='_'>X</p>
|
1449
|
+
</clause>
|
1384
1450
|
<clause id='_' inline-header='false' obligation='normative'>
|
1385
1451
|
<title>Clause 4</title>
|
1386
1452
|
<p id='_'>X</p>
|
@@ -1392,6 +1458,142 @@ RSpec.describe Metanorma::Standoc do
|
|
1392
1458
|
.to be_equivalent_to xmlpp(output)
|
1393
1459
|
end
|
1394
1460
|
|
1461
|
+
it "processes std-link macro" do
|
1462
|
+
VCR.use_cassette "std-link" do
|
1463
|
+
input = <<~INPUT
|
1464
|
+
#{ISOBIB_BLANK_HDR}
|
1465
|
+
|
1466
|
+
[[clause1]]
|
1467
|
+
== Clause
|
1468
|
+
|
1469
|
+
std-link:[ISO 131]
|
1470
|
+
std-link:[iso:std:iso:13485:en,droploc%clause=4,text]
|
1471
|
+
INPUT
|
1472
|
+
output = <<~OUTPUT
|
1473
|
+
#{BLANK_HDR}
|
1474
|
+
<sections>
|
1475
|
+
<clause id='clause1' inline-header='false' obligation='normative'>
|
1476
|
+
<title>Clause</title>
|
1477
|
+
<p id='_'>
|
1478
|
+
<eref type='inline' bibitemid='_' citeas='ISO 131'/>
|
1479
|
+
<eref type='inline' droploc='true' bibitemid='_' citeas='iso:std:iso:13485:en'>
|
1480
|
+
<localityStack>
|
1481
|
+
<locality type='clause'>
|
1482
|
+
<referenceFrom>4</referenceFrom>
|
1483
|
+
</locality>
|
1484
|
+
</localityStack>
|
1485
|
+
text
|
1486
|
+
</eref>
|
1487
|
+
</p>
|
1488
|
+
</clause>
|
1489
|
+
</sections>
|
1490
|
+
<bibliography>
|
1491
|
+
<references hidden='true' normative='true'>
|
1492
|
+
<bibitem id='_' type='standard' hidden="true">
|
1493
|
+
<fetched/>
|
1494
|
+
<title type='title-intro' format='text/plain' language='en' script='Latn'>Acoustics</title>
|
1495
|
+
<title type='title-main' format='text/plain' language='en' script='Latn'>Expression of physical and subjective magnitudes of sound or noise in air</title>
|
1496
|
+
<title type='main' format='text/plain' language='en' script='Latn'>
|
1497
|
+
Acoustics — Expression of physical and subjective magnitudes of sound
|
1498
|
+
or noise in air
|
1499
|
+
</title>
|
1500
|
+
<uri type='src'>https://www.iso.org/standard/3944.html</uri>
|
1501
|
+
<uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
|
1502
|
+
<docidentifier type='ISO' primary='true'>ISO 131</docidentifier>
|
1503
|
+
<docidentifier type='URN'>urn:iso:std:iso:131:stage-95.99:ed-1:en</docidentifier>
|
1504
|
+
<docnumber>131</docnumber>
|
1505
|
+
<contributor>
|
1506
|
+
<role type='publisher'/>
|
1507
|
+
<organization>
|
1508
|
+
<name>International Organization for Standardization</name>
|
1509
|
+
<abbreviation>ISO</abbreviation>
|
1510
|
+
<uri>www.iso.org</uri>
|
1511
|
+
</organization>
|
1512
|
+
</contributor>
|
1513
|
+
<edition>1</edition>
|
1514
|
+
<language>en</language>
|
1515
|
+
<script>Latn</script>
|
1516
|
+
<status>
|
1517
|
+
<stage>95</stage>
|
1518
|
+
<substage>99</substage>
|
1519
|
+
</status>
|
1520
|
+
<copyright>
|
1521
|
+
<from>1979</from>
|
1522
|
+
<owner>
|
1523
|
+
<organization>
|
1524
|
+
<name>ISO</name>
|
1525
|
+
</organization>
|
1526
|
+
</owner>
|
1527
|
+
</copyright>
|
1528
|
+
<relation type='obsoletes'>
|
1529
|
+
<bibitem type='standard'>
|
1530
|
+
<formattedref format='text/plain'>ISO/R 357:1963</formattedref>
|
1531
|
+
</bibitem>
|
1532
|
+
</relation>
|
1533
|
+
<relation type='instance'>
|
1534
|
+
<bibitem type='standard'>
|
1535
|
+
<fetched/>
|
1536
|
+
<title type='title-intro' format='text/plain' language='en' script='Latn'>Acoustics</title>
|
1537
|
+
<title type='title-main' format='text/plain' language='en' script='Latn'>Expression of physical and subjective magnitudes of sound or noise in air</title>
|
1538
|
+
<title type='main' format='text/plain' language='en' script='Latn'>
|
1539
|
+
Acoustics — Expression of physical and subjective magnitudes of
|
1540
|
+
sound or noise in air
|
1541
|
+
</title>
|
1542
|
+
<uri type='src'>https://www.iso.org/standard/3944.html</uri>
|
1543
|
+
<uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
|
1544
|
+
<docidentifier type='ISO' primary='true'>ISO 131:1979</docidentifier>
|
1545
|
+
<docidentifier type='URN'>urn:iso:std:iso:131:stage-95.99:ed-1:en</docidentifier>
|
1546
|
+
<docnumber>131</docnumber>
|
1547
|
+
<date type='published'>
|
1548
|
+
<on>1979-11</on>
|
1549
|
+
</date>
|
1550
|
+
<contributor>
|
1551
|
+
<role type='publisher'/>
|
1552
|
+
<organization>
|
1553
|
+
<name>International Organization for Standardization</name>
|
1554
|
+
<abbreviation>ISO</abbreviation>
|
1555
|
+
<uri>www.iso.org</uri>
|
1556
|
+
</organization>
|
1557
|
+
</contributor>
|
1558
|
+
<edition>1</edition>
|
1559
|
+
<language>en</language>
|
1560
|
+
<script>Latn</script>
|
1561
|
+
<status>
|
1562
|
+
<stage>95</stage>
|
1563
|
+
<substage>99</substage>
|
1564
|
+
</status>
|
1565
|
+
<copyright>
|
1566
|
+
<from>1979</from>
|
1567
|
+
<owner>
|
1568
|
+
<organization>
|
1569
|
+
<name>ISO</name>
|
1570
|
+
</organization>
|
1571
|
+
</owner>
|
1572
|
+
</copyright>
|
1573
|
+
<relation type='obsoletes'>
|
1574
|
+
<bibitem type='standard'>
|
1575
|
+
<formattedref format='text/plain'>ISO/R 357:1963</formattedref>
|
1576
|
+
</bibitem>
|
1577
|
+
</relation>
|
1578
|
+
<place>Geneva</place>
|
1579
|
+
</bibitem>
|
1580
|
+
</relation>
|
1581
|
+
<place>Geneva</place>
|
1582
|
+
</bibitem>
|
1583
|
+
<bibitem id='_' hidden="true">
|
1584
|
+
<formattedref format='application/x-isodoc+xml'/>
|
1585
|
+
<docidentifier type='ISO'>iso:std:iso:13485:en</docidentifier>
|
1586
|
+
<docnumber>13485:en</docnumber>
|
1587
|
+
</bibitem>
|
1588
|
+
</references>
|
1589
|
+
</bibliography>
|
1590
|
+
</standard-document>
|
1591
|
+
OUTPUT
|
1592
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
|
1593
|
+
.gsub(%r{ bibitemid="_[^"]+"}, ' bibitemid="_"')))
|
1594
|
+
.to be_equivalent_to xmlpp(output)
|
1595
|
+
end
|
1596
|
+
end
|
1395
1597
|
|
1396
1598
|
describe "term inline macros" do
|
1397
1599
|
subject(:convert) do
|
@@ -23,13 +23,16 @@ RSpec.describe Metanorma::Standoc::Processor do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "generates IsoDoc XML from a blank document" do
|
26
|
-
|
26
|
+
input = <<~INPUT
|
27
27
|
#{ASCIIDOC_BLANK_HDR}
|
28
28
|
INPUT
|
29
|
+
output = <<~"OUTPUT"
|
29
30
|
#{BLANK_HDR}
|
30
31
|
<sections/>
|
31
32
|
</iso-standard>
|
32
33
|
OUTPUT
|
34
|
+
expect(processor.input_to_isodoc(input, "test"))
|
35
|
+
.to be_equivalent_to output
|
33
36
|
end
|
34
37
|
|
35
38
|
it "generates HTML from IsoDoc XML" do
|
@@ -45,16 +48,17 @@ RSpec.describe Metanorma::Standoc::Processor do
|
|
45
48
|
</sections>
|
46
49
|
</iso-standard>
|
47
50
|
INPUT
|
48
|
-
expect(File.read("test.html", encoding: "utf-8")
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
expect(File.read("test.html", encoding: "utf-8")
|
52
|
+
.gsub(%r{^.*<main}m, "<main")
|
53
|
+
.gsub(%r{</main>.*}m, "</main>"))
|
54
|
+
.to be_equivalent_to <<~"OUTPUT"
|
55
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
56
|
+
<p class="zzSTDTitle1"></p>
|
57
|
+
<div id="H"><h1>Terms, Definitions, Symbols and Abbreviated Terms</h1><h2 class="TermNum" id="J"></h2>
|
58
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
59
|
+
</div>
|
60
|
+
</main>
|
61
|
+
OUTPUT
|
58
62
|
end
|
59
63
|
|
60
64
|
it "generates HTML from IsoDoc XML" do
|
@@ -70,8 +74,8 @@ RSpec.describe Metanorma::Standoc::Processor do
|
|
70
74
|
</sections>
|
71
75
|
</iso-standard>
|
72
76
|
INPUT
|
73
|
-
expect(File.read("test.doc",
|
74
|
-
|
77
|
+
expect(File.read("test.doc", encoding: "utf-8"))
|
78
|
+
.to match(/Terms, Definitions, Symbols and Abbreviated Terms/)
|
75
79
|
end
|
76
80
|
|
77
81
|
it "generates XML from IsoDoc XML" do
|
data/spec/metanorma/refs_spec.rb
CHANGED
@@ -2496,12 +2496,12 @@ RSpec.describe Metanorma::Standoc do
|
|
2496
2496
|
* [[[iso124,(*A*.footnote:[hello])XYZ]]] _Standard_
|
2497
2497
|
INPUT
|
2498
2498
|
output = <<~OUTPUT
|
2499
|
-
|
2499
|
+
#{BLANK_HDR}
|
2500
2500
|
<preface>
|
2501
2501
|
<foreword id='_' obligation='informative'>
|
2502
2502
|
<title>Foreword</title>
|
2503
2503
|
<p id='_'>
|
2504
|
-
<eref type='inline' bibitemid='iso124' citeas='[&#x3c;strong&#x3e;A&#x3c;/strong&#x3e;.&#x3c;fn reference=&#x22;1&#x22;&#x3e;&#
|
2504
|
+
<eref type='inline' bibitemid='iso124' citeas='[&#x3c;strong&#x3e;A&#x3c;/strong&#x3e;.&#x3c;fn reference=&#x22;1&#x22;&#x3e;&#x3c;p&#x3e;hello&#x3c;/p&#x3e;&#xa;&#x3c;/fn&#x3e;]'/>
|
2505
2505
|
</p>
|
2506
2506
|
</foreword>
|
2507
2507
|
</preface>
|
@@ -2532,6 +2532,133 @@ RSpec.describe Metanorma::Standoc do
|
|
2532
2532
|
.to be_equivalent_to xmlpp(output)
|
2533
2533
|
end
|
2534
2534
|
|
2535
|
+
it "processes combinations of crossreferences" do
|
2536
|
+
input = <<~INPUT
|
2537
|
+
#{ASCIIDOC_BLANK_HDR}
|
2538
|
+
== Section
|
2539
|
+
|
2540
|
+
<<ref1,clause=3;to!clause=5>>
|
2541
|
+
<<ref1,from!clause=3;to!clause=5,text>>
|
2542
|
+
<<ref1,clause=3;clause=5>>
|
2543
|
+
<<ref1,clause=3;and!clause=5>>
|
2544
|
+
<<ref1,clause=3;or!clause=5,text>>
|
2545
|
+
<<ref1,from!clause=3;to!clause=5;and!clause=8;to!clause=10>>
|
2546
|
+
|
2547
|
+
[bibliography]
|
2548
|
+
== Bibliography
|
2549
|
+
|
2550
|
+
* [[[ref1,XYZ]]] _Standard_
|
2551
|
+
INPUT
|
2552
|
+
output = <<~OUTPUT
|
2553
|
+
#{BLANK_HDR}
|
2554
|
+
<sections>
|
2555
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
2556
|
+
<title>Section</title>
|
2557
|
+
<p id='_'>
|
2558
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2559
|
+
<localityStack connective='from'>
|
2560
|
+
<locality type='clause'>
|
2561
|
+
<referenceFrom>3</referenceFrom>
|
2562
|
+
</locality>
|
2563
|
+
</localityStack>
|
2564
|
+
<localityStack connective='to'>
|
2565
|
+
<locality type='clause'>
|
2566
|
+
<referenceFrom>5</referenceFrom>
|
2567
|
+
</locality>
|
2568
|
+
</localityStack>
|
2569
|
+
</eref>
|
2570
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2571
|
+
<localityStack connective='from'>
|
2572
|
+
<locality type='clause'>
|
2573
|
+
<referenceFrom>3</referenceFrom>
|
2574
|
+
</locality>
|
2575
|
+
</localityStack>
|
2576
|
+
<localityStack connective='to'>
|
2577
|
+
<locality type='clause'>
|
2578
|
+
<referenceFrom>5</referenceFrom>
|
2579
|
+
</locality>
|
2580
|
+
</localityStack>
|
2581
|
+
text
|
2582
|
+
</eref>
|
2583
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2584
|
+
<localityStack connective='and'>
|
2585
|
+
<locality type='clause'>
|
2586
|
+
<referenceFrom>3</referenceFrom>
|
2587
|
+
</locality>
|
2588
|
+
</localityStack>
|
2589
|
+
<localityStack connective='and'>
|
2590
|
+
<locality type='clause'>
|
2591
|
+
<referenceFrom>5</referenceFrom>
|
2592
|
+
</locality>
|
2593
|
+
</localityStack>
|
2594
|
+
</eref>
|
2595
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2596
|
+
<localityStack connective='and'>
|
2597
|
+
<locality type='clause'>
|
2598
|
+
<referenceFrom>3</referenceFrom>
|
2599
|
+
</locality>
|
2600
|
+
</localityStack>
|
2601
|
+
<localityStack connective='and'>
|
2602
|
+
<locality type='clause'>
|
2603
|
+
<referenceFrom>5</referenceFrom>
|
2604
|
+
</locality>
|
2605
|
+
</localityStack>
|
2606
|
+
</eref>
|
2607
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2608
|
+
<localityStack connective='and'>
|
2609
|
+
<locality type='clause'>
|
2610
|
+
<referenceFrom>3</referenceFrom>
|
2611
|
+
</locality>
|
2612
|
+
</localityStack>
|
2613
|
+
<localityStack connective='or'>
|
2614
|
+
<locality type='clause'>
|
2615
|
+
<referenceFrom>5</referenceFrom>
|
2616
|
+
</locality>
|
2617
|
+
</localityStack>
|
2618
|
+
text
|
2619
|
+
</eref>
|
2620
|
+
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2621
|
+
<localityStack connective='from'>
|
2622
|
+
<locality type='clause'>
|
2623
|
+
<referenceFrom>3</referenceFrom>
|
2624
|
+
</locality>
|
2625
|
+
</localityStack>
|
2626
|
+
<localityStack connective='to'>
|
2627
|
+
<locality type='clause'>
|
2628
|
+
<referenceFrom>5</referenceFrom>
|
2629
|
+
</locality>
|
2630
|
+
</localityStack>
|
2631
|
+
<localityStack connective='and'>
|
2632
|
+
<locality type='clause'>
|
2633
|
+
<referenceFrom>8</referenceFrom>
|
2634
|
+
</locality>
|
2635
|
+
</localityStack>
|
2636
|
+
<localityStack connective='to'>
|
2637
|
+
<locality type='clause'>
|
2638
|
+
<referenceFrom>10</referenceFrom>
|
2639
|
+
</locality>
|
2640
|
+
</localityStack>
|
2641
|
+
</eref>
|
2642
|
+
</p>
|
2643
|
+
</clause>
|
2644
|
+
</sections>
|
2645
|
+
<bibliography>
|
2646
|
+
<references id='_' normative='false' obligation='informative'>
|
2647
|
+
<title>Bibliography</title>
|
2648
|
+
<bibitem id='ref1'>
|
2649
|
+
<formattedref format='application/x-isodoc+xml'>
|
2650
|
+
<em>Standard</em>
|
2651
|
+
</formattedref>
|
2652
|
+
<docidentifier>XYZ</docidentifier>
|
2653
|
+
</bibitem>
|
2654
|
+
</references>
|
2655
|
+
</bibliography>
|
2656
|
+
</standard-document>
|
2657
|
+
OUTPUT
|
2658
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
2659
|
+
.to be_equivalent_to xmlpp(output)
|
2660
|
+
end
|
2661
|
+
|
2535
2662
|
private
|
2536
2663
|
|
2537
2664
|
def mock_isobib_get_123
|
@@ -478,6 +478,114 @@ RSpec.describe Metanorma::Standoc do
|
|
478
478
|
expect(File.exist?("test.xml")).to be false
|
479
479
|
end
|
480
480
|
|
481
|
+
it "does not warn and abort if columns and rows not out of bounds" do
|
482
|
+
FileUtils.rm_f "test.xml"
|
483
|
+
FileUtils.rm_f "test.err"
|
484
|
+
begin
|
485
|
+
input = <<~INPUT
|
486
|
+
= Document title
|
487
|
+
Author
|
488
|
+
:docfile: test.adoc
|
489
|
+
:nodoc:
|
490
|
+
|
491
|
+
== Clause
|
492
|
+
|
493
|
+
[cols="1,1,1,1"]
|
494
|
+
|===
|
495
|
+
3.2+| a | a
|
496
|
+
|
497
|
+
| a
|
498
|
+
| a | a | a | a
|
499
|
+
|===
|
500
|
+
INPUT
|
501
|
+
expect { Asciidoctor.convert(input, *OPTIONS) }.not_to raise_error(SystemExit)
|
502
|
+
rescue SystemExit
|
503
|
+
end
|
504
|
+
expect(File.read("test.err"))
|
505
|
+
.not_to include "Table exceeds maximum number of columns defined"
|
506
|
+
expect(File.read("test.err"))
|
507
|
+
.not_to include "Table rows in table are inconsistent: check rowspan"
|
508
|
+
end
|
509
|
+
|
510
|
+
xit "warns and aborts if columns out of bounds against colgroup" do
|
511
|
+
FileUtils.rm_f "test.xml"
|
512
|
+
FileUtils.rm_f "test.err"
|
513
|
+
begin
|
514
|
+
input = <<~INPUT
|
515
|
+
= Document title
|
516
|
+
Author
|
517
|
+
:docfile: test.adoc
|
518
|
+
:nodoc:
|
519
|
+
|
520
|
+
[cols="1,1,1,1"]
|
521
|
+
|===
|
522
|
+
5+| a
|
523
|
+
|
524
|
+
| a 4+| a
|
525
|
+
| a | a |a |a
|
526
|
+
|===
|
527
|
+
INPUT
|
528
|
+
expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
|
529
|
+
rescue SystemExit
|
530
|
+
end
|
531
|
+
expect(File.read("test.err"))
|
532
|
+
.to include "Table exceeds maximum number of columns defined (4)"
|
533
|
+
expect(File.read("test.err"))
|
534
|
+
.not_to include "Table rows in table are inconsistent: check rowspan"
|
535
|
+
end
|
536
|
+
|
537
|
+
xit "warns and aborts if columns out of bounds against cell count per row" do
|
538
|
+
FileUtils.rm_f "test.xml"
|
539
|
+
FileUtils.rm_f "test.err"
|
540
|
+
begin
|
541
|
+
input = <<~INPUT
|
542
|
+
= Document title
|
543
|
+
Author
|
544
|
+
:docfile: test.adoc
|
545
|
+
:nodoc:
|
546
|
+
|
547
|
+
|===
|
548
|
+
2.3+| a | a
|
549
|
+
|
550
|
+
| a | a | a
|
551
|
+
| a | a | a
|
552
|
+
|===
|
553
|
+
INPUT
|
554
|
+
expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
|
555
|
+
rescue SystemExit
|
556
|
+
end
|
557
|
+
expect(File.read("test.err"))
|
558
|
+
.to include "Table exceeds maximum number of columns defined (3)"
|
559
|
+
expect(File.read("test.err"))
|
560
|
+
.not_to include "Table rows in table are inconsistent: check rowspan"
|
561
|
+
end
|
562
|
+
|
563
|
+
it "warns and aborts if rows out of bounds" do
|
564
|
+
FileUtils.rm_f "test.xml"
|
565
|
+
FileUtils.rm_f "test.err"
|
566
|
+
begin
|
567
|
+
input = <<~INPUT
|
568
|
+
= Document title
|
569
|
+
Author
|
570
|
+
:docfile: test.adoc
|
571
|
+
:nodoc:
|
572
|
+
|
573
|
+
|===
|
574
|
+
.4+| a | a | a | a
|
575
|
+
|
576
|
+
| a | a | a
|
577
|
+
| a | a | a
|
578
|
+
|===
|
579
|
+
INPUT
|
580
|
+
expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
|
581
|
+
rescue SystemExit
|
582
|
+
end
|
583
|
+
expect(File.read("test.err"))
|
584
|
+
.not_to include "Table exceeds maximum number of columns defined"
|
585
|
+
expect(File.read("test.err"))
|
586
|
+
.to include "Table rows in table are inconsistent: check rowspan"
|
587
|
+
end
|
588
|
+
|
481
589
|
it "err file succesfully created for docfile path" do
|
482
590
|
FileUtils.rm_rf "test"
|
483
591
|
FileUtils.mkdir_p "test"
|