metanorma-standoc 1.11.3 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -31
- data/.gitignore +23 -0
- data/Gemfile +0 -1
- data/lib/asciidoctor/standoc/base.rb +2 -145
- data/lib/asciidoctor/standoc/blocks.rb +2 -238
- data/lib/asciidoctor/standoc/blocks_notes.rb +2 -100
- data/lib/asciidoctor/standoc/cleanup.rb +2 -208
- data/lib/asciidoctor/standoc/cleanup_amend.rb +2 -53
- data/lib/asciidoctor/standoc/cleanup_block.rb +2 -172
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -212
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +2 -108
- data/lib/asciidoctor/standoc/cleanup_image.rb +2 -69
- data/lib/asciidoctor/standoc/cleanup_inline.rb +2 -189
- data/lib/asciidoctor/standoc/cleanup_maths.rb +2 -221
- data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -169
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +2 -103
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -110
- data/lib/asciidoctor/standoc/cleanup_section.rb +2 -184
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -91
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +2 -47
- data/lib/asciidoctor/standoc/cleanup_table.rb +2 -67
- data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -139
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +2 -192
- data/lib/asciidoctor/standoc/cleanup_text.rb +2 -95
- data/lib/asciidoctor/standoc/cleanup_toc.rb +3 -0
- data/lib/asciidoctor/standoc/cleanup_xref.rb +2 -106
- data/lib/asciidoctor/standoc/converter.rb +2 -123
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +2 -56
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +2 -102
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +3 -404
- data/lib/asciidoctor/standoc/deprecated.rb +5 -0
- data/lib/asciidoctor/standoc/front.rb +2 -219
- data/lib/asciidoctor/standoc/front_contributor.rb +2 -191
- data/lib/asciidoctor/standoc/inline.rb +2 -231
- data/lib/asciidoctor/standoc/lists.rb +2 -119
- data/lib/asciidoctor/standoc/macros.rb +2 -203
- data/lib/asciidoctor/standoc/macros_form.rb +2 -62
- data/lib/asciidoctor/standoc/macros_note.rb +2 -44
- data/lib/asciidoctor/standoc/macros_plantuml.rb +2 -112
- data/lib/asciidoctor/standoc/macros_terms.rb +2 -180
- data/lib/asciidoctor/standoc/ref.rb +2 -251
- data/lib/asciidoctor/standoc/ref_sect.rb +2 -153
- data/lib/asciidoctor/standoc/ref_utility.rb +2 -0
- data/lib/asciidoctor/standoc/render.rb +2 -116
- data/lib/asciidoctor/standoc/reqt.rb +2 -89
- data/lib/asciidoctor/standoc/section.rb +2 -194
- data/lib/asciidoctor/standoc/table.rb +2 -84
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +2 -178
- data/lib/asciidoctor/standoc/terms.rb +2 -153
- data/lib/asciidoctor/standoc/utils.rb +2 -100
- data/lib/asciidoctor/standoc/validate.rb +2 -157
- data/lib/asciidoctor/standoc/validate_section.rb +2 -54
- data/lib/isodoc/html/htmlstyle.css +44 -29
- data/lib/isodoc/html/htmlstyle.scss +17 -12
- data/lib/metanorma/standoc/base.rb +163 -0
- data/lib/{asciidoctor → metanorma}/standoc/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/standoc/biblio.rng +2 -2
- data/lib/metanorma/standoc/blocks.rb +239 -0
- data/lib/metanorma/standoc/blocks_notes.rb +101 -0
- data/lib/metanorma/standoc/cleanup.rb +157 -0
- data/lib/metanorma/standoc/cleanup_amend.rb +54 -0
- data/lib/metanorma/standoc/cleanup_block.rb +173 -0
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +213 -0
- data/lib/metanorma/standoc/cleanup_footnotes.rb +109 -0
- data/lib/metanorma/standoc/cleanup_image.rb +70 -0
- data/lib/metanorma/standoc/cleanup_inline.rb +190 -0
- data/lib/metanorma/standoc/cleanup_maths.rb +222 -0
- data/lib/metanorma/standoc/cleanup_ref.rb +170 -0
- data/lib/metanorma/standoc/cleanup_ref_dl.rb +104 -0
- data/lib/metanorma/standoc/cleanup_reqt.rb +111 -0
- data/lib/metanorma/standoc/cleanup_section.rb +212 -0
- data/lib/metanorma/standoc/cleanup_section_names.rb +92 -0
- data/lib/metanorma/standoc/cleanup_symbols.rb +48 -0
- data/lib/metanorma/standoc/cleanup_table.rb +68 -0
- data/lib/metanorma/standoc/cleanup_terms.rb +140 -0
- data/lib/metanorma/standoc/cleanup_terms_designations.rb +199 -0
- data/lib/metanorma/standoc/cleanup_text.rb +74 -0
- data/lib/metanorma/standoc/cleanup_toc.rb +98 -0
- data/lib/metanorma/standoc/cleanup_xref.rb +107 -0
- data/lib/metanorma/standoc/converter.rb +126 -0
- data/lib/metanorma/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
- data/lib/metanorma/standoc/datamodel/diagram_preprocessor.rb +103 -0
- data/lib/metanorma/standoc/datamodel/plantuml_renderer.rb +409 -0
- data/lib/metanorma/standoc/front.rb +224 -0
- data/lib/metanorma/standoc/front_contributor.rb +192 -0
- data/lib/metanorma/standoc/inline.rb +232 -0
- data/lib/{asciidoctor → metanorma}/standoc/isodoc.rng +104 -3
- data/lib/metanorma/standoc/lists.rb +120 -0
- data/lib/metanorma/standoc/macros.rb +205 -0
- data/lib/metanorma/standoc/macros_embed.rb +72 -0
- data/lib/metanorma/standoc/macros_form.rb +63 -0
- data/lib/metanorma/standoc/macros_note.rb +45 -0
- data/lib/metanorma/standoc/macros_plantuml.rb +113 -0
- data/lib/metanorma/standoc/macros_terms.rb +194 -0
- data/lib/metanorma/standoc/ref.rb +243 -0
- data/lib/metanorma/standoc/ref_sect.rb +153 -0
- data/lib/{asciidoctor/standoc/ref_date_id.rb → metanorma/standoc/ref_utility.rb} +43 -5
- data/lib/metanorma/standoc/render.rb +115 -0
- data/lib/metanorma/standoc/reqt.rb +90 -0
- data/lib/{asciidoctor → metanorma}/standoc/reqt.rng +0 -0
- data/lib/metanorma/standoc/section.rb +209 -0
- data/lib/metanorma/standoc/table.rb +85 -0
- data/lib/metanorma/standoc/term_lookup_cleanup.rb +179 -0
- data/lib/metanorma/standoc/terms.rb +160 -0
- data/lib/metanorma/standoc/utils.rb +101 -0
- data/lib/metanorma/standoc/validate.rb +158 -0
- data/lib/metanorma/standoc/validate_section.rb +55 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/model_representation.adoc.erb +0 -0
- data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -0
- data/lib/metanorma-standoc.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/assets/a1.adoc +8 -0
- data/spec/assets/a2.adoc +8 -0
- data/spec/assets/a3.adoc +9 -0
- data/spec/assets/a4.adoc +4 -0
- data/spec/{asciidoctor → metanorma}/base_spec.rb +499 -407
- data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/cleanup_blocks_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/cleanup_sections_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +5 -5
- data/spec/{asciidoctor → metanorma}/cleanup_terms_spec.rb +227 -119
- data/spec/{asciidoctor → metanorma}/datamodel/attributes_table_preprocessor_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/datamodel/diagram_preprocessor_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/inline_spec.rb +170 -1
- data/spec/{asciidoctor → metanorma}/isobib_cache_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/macros_json2text_spec.rb +0 -0
- data/spec/{asciidoctor → metanorma}/macros_plantuml_spec.rb +3 -3
- data/spec/{asciidoctor → metanorma}/macros_spec.rb +97 -6
- data/spec/{asciidoctor → metanorma}/macros_yaml2text_spec.rb +0 -0
- data/spec/metanorma/refs_dl_spec.rb +863 -0
- data/spec/{asciidoctor → metanorma}/refs_spec.rb +522 -15
- data/spec/{asciidoctor → metanorma}/section_spec.rb +59 -1
- data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/validate_spec.rb +2 -2
- 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/hide_refs.yml +599 -0
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -24
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_124.yml +10 -10
- 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 +88 -32
- data/spec/asciidoctor/refs_dl_spec.rb +0 -864
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Metanorma::Standoc do
|
4
4
|
it "handles spacing around markup" do
|
5
5
|
input = <<~INPUT
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -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}
|
@@ -266,7 +266,7 @@ ISO_123_DATED = <<~XML.freeze
|
|
266
266
|
</bibdata>
|
267
267
|
XML
|
268
268
|
|
269
|
-
RSpec.describe
|
269
|
+
RSpec.describe Metanorma::Standoc do
|
270
270
|
it "does not activate biblio caches if isobib disabled" do
|
271
271
|
FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
|
272
272
|
FileUtils.mv(File.expand_path("~/.relaton/cache"),
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Metanorma::Standoc do
|
4
4
|
it "processes the PlantUML macro" do
|
5
5
|
input = <<~INPUT
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -383,14 +383,14 @@ RSpec.describe Asciidoctor::Standoc do
|
|
383
383
|
private
|
384
384
|
|
385
385
|
def mock_plantuml_disabled
|
386
|
-
expect(
|
386
|
+
expect(Metanorma::Standoc::PlantUMLBlockMacroBackend)
|
387
387
|
.to receive(:plantuml_installed?) do
|
388
388
|
raise "PlantUML not installed"
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
392
|
def mock_localdir_unwritable
|
393
|
-
expect(
|
393
|
+
expect(Metanorma::Standoc::Utils).to receive(:localdir) do
|
394
394
|
"/"
|
395
395
|
end.exactly(2).times
|
396
396
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
RSpec.describe
|
4
|
-
it "processes the
|
3
|
+
RSpec.describe Metanorma::Standoc do
|
4
|
+
it "processes the Metanorma::Standoc inline macros" do
|
5
5
|
input = <<~INPUT
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
7
7
|
preferred:[term0]
|
8
8
|
alt:[term1]
|
9
|
+
admitted:[term1a]
|
9
10
|
deprecated:[term2]
|
10
11
|
domain:[term3]
|
11
12
|
inherit:[<<ref1>>]
|
@@ -23,6 +24,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
23
24
|
<title>Foreword</title>
|
24
25
|
<preferred><expression><name>term0</name></expression></preferred>
|
25
26
|
<admitted><expression><name>term1</name></expression></admitted>
|
27
|
+
<admitted><expression><name>term1a</name></expression></admitted>
|
26
28
|
<deprecates><expression><name>term2</name></expression></deprecates>
|
27
29
|
<domain>term3</domain>
|
28
30
|
<inherit>
|
@@ -55,7 +57,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
55
57
|
.to be_equivalent_to xmlpp(output)
|
56
58
|
end
|
57
59
|
|
58
|
-
it "processes the
|
60
|
+
it "processes the Metanorma::Standoc index macros" do
|
59
61
|
input = <<~INPUT
|
60
62
|
#{ASCIIDOC_BLANK_HDR}
|
61
63
|
index:also[]
|
@@ -127,7 +129,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
127
129
|
.to be_equivalent_to xmlpp(output)
|
128
130
|
end
|
129
131
|
|
130
|
-
it "processes the
|
132
|
+
it "processes the Metanorma::Standoc variant macros" do
|
131
133
|
input = <<~INPUT
|
132
134
|
#{ASCIIDOC_BLANK_HDR}
|
133
135
|
== lang:en[English] lang:fr-Latn[Français]
|
@@ -163,7 +165,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
163
165
|
.to be_equivalent_to xmlpp(output)
|
164
166
|
end
|
165
167
|
|
166
|
-
it "processes the
|
168
|
+
it "processes the Metanorma::Standoc concept and related macros" do
|
167
169
|
input = <<~INPUT
|
168
170
|
#{ASCIIDOC_BLANK_HDR}
|
169
171
|
|
@@ -332,7 +334,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
332
334
|
.to be_equivalent_to xmlpp(output)
|
333
335
|
end
|
334
336
|
|
335
|
-
it "processes the
|
337
|
+
it "processes the Metanorma::Standoc concept macros for acronyms" do
|
336
338
|
input = <<~INPUT
|
337
339
|
#{ASCIIDOC_BLANK_HDR}
|
338
340
|
|
@@ -1302,6 +1304,95 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1302
1304
|
.to be_equivalent_to xmlpp(output)
|
1303
1305
|
end
|
1304
1306
|
|
1307
|
+
it "processes embed macro" do
|
1308
|
+
input = <<~INPUT
|
1309
|
+
#{ASCIIDOC_BLANK_HDR}
|
1310
|
+
|
1311
|
+
[[clause1]]
|
1312
|
+
== Clause 1
|
1313
|
+
|
1314
|
+
embed::spec/assets/xref_error.adoc[]
|
1315
|
+
INPUT
|
1316
|
+
output = <<~OUTPUT
|
1317
|
+
#{BLANK_HDR}
|
1318
|
+
<sections>
|
1319
|
+
<clause id='clause1' inline-header='false' obligation='normative'>
|
1320
|
+
<title>Clause 1</title>
|
1321
|
+
</clause>
|
1322
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1323
|
+
<title>Clause</title>
|
1324
|
+
<p id='_'>
|
1325
|
+
<xref target='a'>b</xref>
|
1326
|
+
</p>
|
1327
|
+
</clause>
|
1328
|
+
</sections>
|
1329
|
+
</standard-document>
|
1330
|
+
OUTPUT
|
1331
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1332
|
+
.to be_equivalent_to xmlpp(output)
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
it "processes embed macro with overwriting" do
|
1336
|
+
input = <<~INPUT
|
1337
|
+
#{ASCIIDOC_BLANK_HDR}
|
1338
|
+
|
1339
|
+
[[clause1]]
|
1340
|
+
== Clause
|
1341
|
+
|
1342
|
+
embed::spec/assets/xref_error.adoc[]
|
1343
|
+
INPUT
|
1344
|
+
output = <<~OUTPUT
|
1345
|
+
#{BLANK_HDR}
|
1346
|
+
<sections>
|
1347
|
+
<clause id='clause1' inline-header='false' obligation='normative'>
|
1348
|
+
<title>Clause</title>
|
1349
|
+
</clause>
|
1350
|
+
</sections>
|
1351
|
+
</standard-document>
|
1352
|
+
OUTPUT
|
1353
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1354
|
+
.to be_equivalent_to xmlpp(output)
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
it "processes recursive embed macro with includes" do
|
1358
|
+
input = <<~INPUT
|
1359
|
+
#{ASCIIDOC_BLANK_HDR}
|
1360
|
+
|
1361
|
+
[[clause1]]
|
1362
|
+
== Clause
|
1363
|
+
|
1364
|
+
embed::spec/assets/a1.adoc[]
|
1365
|
+
INPUT
|
1366
|
+
output = <<~OUTPUT
|
1367
|
+
#{BLANK_HDR}
|
1368
|
+
<sections>
|
1369
|
+
<clause id='clause1' inline-header='false' obligation='normative'>
|
1370
|
+
<title>Clause</title>
|
1371
|
+
</clause>
|
1372
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1373
|
+
<title>Clause 1</title>
|
1374
|
+
<p id='_'>X</p>
|
1375
|
+
</clause>
|
1376
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1377
|
+
<title>Clause 2</title>
|
1378
|
+
<p id='_'>X</p>
|
1379
|
+
</clause>
|
1380
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1381
|
+
<title>Clause 3</title>
|
1382
|
+
<p id='_'>X</p>
|
1383
|
+
</clause>
|
1384
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1385
|
+
<title>Clause 4</title>
|
1386
|
+
<p id='_'>X</p>
|
1387
|
+
</clause>
|
1388
|
+
</sections>
|
1389
|
+
</standard-document>
|
1390
|
+
OUTPUT
|
1391
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1392
|
+
.to be_equivalent_to xmlpp(output)
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
|
1305
1396
|
describe "term inline macros" do
|
1306
1397
|
subject(:convert) do
|
1307
1398
|
xmlpp(
|
File without changes
|