metanorma-standoc 1.11.3 → 1.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +12 -6
- data/lib/asciidoctor/standoc/front.rb +12 -8
- data/lib/asciidoctor/standoc/isodoc.rng +6 -2
- data/lib/asciidoctor/standoc/render.rb +8 -10
- data/lib/asciidoctor/standoc/section.rb +13 -0
- data/lib/asciidoctor/standoc/terms.rb +7 -1
- data/lib/isodoc/html/htmlstyle.css +19 -10
- data/lib/isodoc/html/htmlstyle.scss +10 -10
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +48 -0
- data/spec/asciidoctor/cleanup_terms_spec.rb +109 -1
- data/spec/asciidoctor/inline_spec.rb +169 -0
- data/spec/asciidoctor/refs_spec.rb +39 -1
- data/spec/asciidoctor/section_spec.rb +33 -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 +11 -11
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +85 -85
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- 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 +45 -45
- metadata +2 -2
@@ -389,6 +389,61 @@ RSpec.describe Asciidoctor::Standoc do
|
|
389
389
|
.to be_equivalent_to(output)
|
390
390
|
end
|
391
391
|
|
392
|
+
it "processes formatting within crossreferences" do
|
393
|
+
input = <<~INPUT
|
394
|
+
#{ASCIIDOC_BLANK_HDR}
|
395
|
+
[[reference]]
|
396
|
+
== Section
|
397
|
+
|
398
|
+
<<reference,_reference_>>
|
399
|
+
<<reference,_**reference**_>>
|
400
|
+
<<reference,_A_ stem:[x^2]>>
|
401
|
+
<<reference,_A_ footnote:[_B_]>>
|
402
|
+
INPUT
|
403
|
+
output = <<~OUTPUT
|
404
|
+
#{BLANK_HDR}
|
405
|
+
<sections>
|
406
|
+
<clause id="reference" inline-header="false" obligation="normative">
|
407
|
+
<title>Section</title>
|
408
|
+
<p id="_"><xref target="reference"><em>reference</em></xref>
|
409
|
+
<xref target="reference"><em><strong>reference</strong></em></xref>
|
410
|
+
<xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
|
411
|
+
<xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
|
412
|
+
</clause>
|
413
|
+
</sections>
|
414
|
+
</standard-document>
|
415
|
+
OUTPUT
|
416
|
+
expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
417
|
+
.to be_equivalent_to(output)
|
418
|
+
end
|
419
|
+
|
420
|
+
it "processes formatting within crossreferences to non-existent anchor" do
|
421
|
+
input = <<~INPUT
|
422
|
+
#{ASCIIDOC_BLANK_HDR}
|
423
|
+
== Section
|
424
|
+
|
425
|
+
<<reference,_reference_>>
|
426
|
+
<<reference,_**reference**_>>
|
427
|
+
<<reference,_A_ stem:[x^2]>>
|
428
|
+
<<reference,_A_ footnote:[_B_]>>
|
429
|
+
INPUT
|
430
|
+
output = <<~OUTPUT
|
431
|
+
#{BLANK_HDR}
|
432
|
+
<sections>
|
433
|
+
<clause id="_" inline-header="false" obligation="normative">
|
434
|
+
<title>Section</title>
|
435
|
+
<p id="_"><xref target="reference"><em>reference</em></xref>
|
436
|
+
<xref target="reference"><em><strong>reference</strong></em></xref>
|
437
|
+
<xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
|
438
|
+
<xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
|
439
|
+
</clause>
|
440
|
+
</sections>
|
441
|
+
</standard-document>
|
442
|
+
OUTPUT
|
443
|
+
expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
444
|
+
.to be_equivalent_to(output)
|
445
|
+
end
|
446
|
+
|
392
447
|
it "processes bibliographic anchors" do
|
393
448
|
input = <<~INPUT
|
394
449
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -423,6 +478,120 @@ RSpec.describe Asciidoctor::Standoc do
|
|
423
478
|
.to be_equivalent_to(output)
|
424
479
|
end
|
425
480
|
|
481
|
+
it "processes formatting within bibliographic references" do
|
482
|
+
input = <<~INPUT
|
483
|
+
#{ASCIIDOC_BLANK_HDR}
|
484
|
+
== Section
|
485
|
+
|
486
|
+
<<reference,_reference_>>
|
487
|
+
<<reference,_**reference**_>>
|
488
|
+
<<reference,_A_ stem:[x^2]>>
|
489
|
+
<<reference,_A_ footnote:[_B_]>>
|
490
|
+
<<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
|
491
|
+
|
492
|
+
[bibliography]
|
493
|
+
== Normative References
|
494
|
+
|
495
|
+
* [[[reference,ABC]]] Reference
|
496
|
+
INPUT
|
497
|
+
output = <<~OUTPUT
|
498
|
+
#{BLANK_HDR}
|
499
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
500
|
+
<title>Section</title>
|
501
|
+
<p id="_"><eref type="inline" bibitemid="reference" citeas="ABC"><em>reference</em></eref>
|
502
|
+
<eref type="inline" bibitemid="reference" citeas="ABC"><em><strong>reference</strong></em></eref>
|
503
|
+
<eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></eref>
|
504
|
+
<eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></eref>
|
505
|
+
<eref type="inline" bibitemid="reference" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2"><p id="_">Superseded by ISO 9000:2015.</p></fn></eref></p>
|
506
|
+
</clause>
|
507
|
+
</sections><bibliography><references id="_" normative="true" obligation="informative">
|
508
|
+
<title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
509
|
+
<bibitem id="reference">
|
510
|
+
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
511
|
+
<docidentifier>ABC</docidentifier>
|
512
|
+
</bibitem>
|
513
|
+
</references></bibliography>
|
514
|
+
</standard-document>
|
515
|
+
OUTPUT
|
516
|
+
expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
517
|
+
.to be_equivalent_to(output)
|
518
|
+
end
|
519
|
+
|
520
|
+
it "processes formatting within term sources" do
|
521
|
+
input = <<~INPUT
|
522
|
+
#{ASCIIDOC_BLANK_HDR}
|
523
|
+
== Terms and Definitions
|
524
|
+
|
525
|
+
=== Term1
|
526
|
+
|
527
|
+
[.source]
|
528
|
+
<<reference,_reference_>>
|
529
|
+
|
530
|
+
[.source]
|
531
|
+
<<reference,_**reference**_>>
|
532
|
+
|
533
|
+
[.source]
|
534
|
+
<<reference,_A_ stem:[x^2]>>
|
535
|
+
|
536
|
+
[.source]
|
537
|
+
<<reference,_A_ footnote:[_B_]>>
|
538
|
+
|
539
|
+
[.source]
|
540
|
+
<<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
|
541
|
+
|
542
|
+
[bibliography]
|
543
|
+
== Normative References
|
544
|
+
|
545
|
+
* [[[reference,ABC]]] Reference
|
546
|
+
INPUT
|
547
|
+
output = <<~OUTPUT
|
548
|
+
#{BLANK_HDR}
|
549
|
+
<sections><terms id="_" obligation="normative">
|
550
|
+
<title>Terms and definitions</title><p id="_">For the purposes of this document,
|
551
|
+
the following terms and definitions apply.</p>
|
552
|
+
|
553
|
+
<term id="term-term1"><preferred><expression><name>Term1</name></expression><termsource status="identical" type="authoritative">
|
554
|
+
<origin bibitemid="reference" type="inline" citeas="ABC">
|
555
|
+
<em>reference</em>
|
556
|
+
</origin>
|
557
|
+
</termsource><termsource status="identical" type="authoritative">
|
558
|
+
<origin bibitemid="reference" type="inline" citeas="ABC">
|
559
|
+
<em>
|
560
|
+
<strong>reference</strong>
|
561
|
+
</em>
|
562
|
+
</origin>
|
563
|
+
</termsource><termsource status="identical" type="authoritative">
|
564
|
+
<origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></origin>
|
565
|
+
</termsource><termsource status="identical" type="authoritative">
|
566
|
+
<origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em><fn reference="1">
|
567
|
+
<p id="_">
|
568
|
+
<em>B</em>
|
569
|
+
</p>
|
570
|
+
</fn></origin>
|
571
|
+
</termsource><termsource status="identical" type="authoritative">
|
572
|
+
<origin bibitemid="reference" type="inline" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2">
|
573
|
+
<p id="_">Superseded by ISO 9000:2015.</p>
|
574
|
+
</fn></origin>
|
575
|
+
</termsource></preferred>
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
</term>
|
580
|
+
</terms>
|
581
|
+
</sections><bibliography><references id="_" normative="true" obligation="informative">
|
582
|
+
<title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
583
|
+
<bibitem id="reference">
|
584
|
+
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
585
|
+
<docidentifier>ABC</docidentifier>
|
586
|
+
|
587
|
+
</bibitem>
|
588
|
+
</references></bibliography>
|
589
|
+
</standard-document>
|
590
|
+
OUTPUT
|
591
|
+
expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
592
|
+
.to be_equivalent_to(output)
|
593
|
+
end
|
594
|
+
|
426
595
|
it "processes footnotes" do
|
427
596
|
input = <<~INPUT
|
428
597
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -735,7 +735,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
735
735
|
end
|
736
736
|
|
737
737
|
it "processes dated ISO reference and joint ISO/IEC references" do
|
738
|
-
VCR.use_cassette("dated_iso_ref_joint_iso_iec",
|
738
|
+
VCR.use_cassette("dated_iso_ref_joint_iso_iec",
|
739
|
+
match_requests_on: %i[method uri body]) do
|
739
740
|
input = <<~INPUT
|
740
741
|
#{ISOBIB_BLANK_HDR}
|
741
742
|
[bibliography]
|
@@ -1980,6 +1981,43 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1980
1981
|
end
|
1981
1982
|
end
|
1982
1983
|
|
1984
|
+
it "processes formatting within bibliographic references" do
|
1985
|
+
VCR.use_cassette "isobib_get_123_1" do
|
1986
|
+
input = <<~INPUT
|
1987
|
+
#{ISOBIB_BLANK_HDR}
|
1988
|
+
[bibliography]
|
1989
|
+
== Normative References
|
1990
|
+
|
1991
|
+
* [[[reference,ISO 123]]] _Standard_
|
1992
|
+
|
1993
|
+
== Section
|
1994
|
+
|
1995
|
+
<<reference,_reference_>>
|
1996
|
+
<<reference,_**reference**_>>
|
1997
|
+
<<reference,_A_ stem:[x^2]>>
|
1998
|
+
<<reference,_A_ footnote:[_B_]>>
|
1999
|
+
<<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
|
2000
|
+
|
2001
|
+
INPUT
|
2002
|
+
output = <<~OUTPUT
|
2003
|
+
#{BLANK_HDR}
|
2004
|
+
<sections>
|
2005
|
+
<clause id="_" inline-header="false" obligation="normative">
|
2006
|
+
<title>Section</title>
|
2007
|
+
<p id="_"><eref type="inline" bibitemid="reference" citeas="ISO 123"><em>reference</em></eref>
|
2008
|
+
<eref type="inline" bibitemid="reference" citeas="ISO 123"><em><strong>reference</strong></em></eref>
|
2009
|
+
<eref type="inline" bibitemid="reference" citeas="ISO 123"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></eref>
|
2010
|
+
<eref type="inline" bibitemid="reference" citeas="ISO 123"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></eref>
|
2011
|
+
<eref type="inline" bibitemid="reference" citeas="ISO 123"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2"><p id="_">Superseded by ISO 9000:2015.</p></fn></eref></p>
|
2012
|
+
</clause></sections>
|
2013
|
+
</standard-document>
|
2014
|
+
OUTPUT
|
2015
|
+
a = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
|
2016
|
+
a.at("//xmlns:bibliography").remove
|
2017
|
+
expect((strip_guid(a.to_xml))).to be_equivalent_to(output)
|
2018
|
+
end
|
2019
|
+
end
|
2020
|
+
|
1983
2021
|
private
|
1984
2022
|
|
1985
2023
|
def mock_isobib_get_123
|
@@ -1259,4 +1259,37 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1259
1259
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1260
1260
|
.to be_equivalent_to xmlpp(output)
|
1261
1261
|
end
|
1262
|
+
|
1263
|
+
it "handles floating titles" do
|
1264
|
+
input = <<~INPUT
|
1265
|
+
#{ASCIIDOC_BLANK_HDR}
|
1266
|
+
|
1267
|
+
== Clause 1
|
1268
|
+
|
1269
|
+
[discrete]
|
1270
|
+
== I am a _floating_ title
|
1271
|
+
|
1272
|
+
=== Clause 2
|
1273
|
+
|
1274
|
+
INPUT
|
1275
|
+
output = <<~OUTPUT
|
1276
|
+
#{BLANK_HDR}
|
1277
|
+
<sections>
|
1278
|
+
<clause id="_" inline-header="false" obligation="normative">
|
1279
|
+
<title>Clause 1</title>
|
1280
|
+
<p id='_' type='floating-title'>
|
1281
|
+
I am a
|
1282
|
+
<em>floating</em>
|
1283
|
+
title
|
1284
|
+
</p>
|
1285
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1286
|
+
<title>Clause 2</title>
|
1287
|
+
</clause>
|
1288
|
+
</clause>
|
1289
|
+
</sections>
|
1290
|
+
</standard-document>
|
1291
|
+
OUTPUT
|
1292
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1293
|
+
.to be_equivalent_to xmlpp(output)
|
1294
|
+
end
|
1262
1295
|
end
|