metanorma-standoc 1.6.4 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +17 -0
- data/lib/asciidoctor/standoc/base.rb +8 -16
- data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
- data/lib/asciidoctor/standoc/cleanup.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_block.rb +0 -8
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +33 -20
- data/lib/asciidoctor/standoc/cleanup_inline.rb +3 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
- data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
- data/lib/asciidoctor/standoc/converter.rb +4 -49
- data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
- data/lib/asciidoctor/standoc/inline.rb +7 -5
- data/lib/asciidoctor/standoc/isodoc.rng +48 -3
- data/lib/asciidoctor/standoc/macros.rb +30 -61
- data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
- data/lib/asciidoctor/standoc/ref.rb +12 -21
- data/lib/asciidoctor/standoc/section.rb +22 -20
- data/lib/asciidoctor/standoc/table.rb +12 -0
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
- data/lib/asciidoctor/standoc/utils.rb +2 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -2
- data/spec/asciidoctor-standoc/base_spec.rb +14 -8
- data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +18 -13
- data/spec/asciidoctor-standoc/cleanup_spec.rb +75 -11
- data/spec/asciidoctor-standoc/inline_spec.rb +4 -5
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +1 -1
- data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +258 -277
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +4 -4
- data/spec/asciidoctor-standoc/section_spec.rb +155 -12
- data/spec/asciidoctor-standoc/table_spec.rb +146 -0
- data/spec/fixtures/diagram_definitions.lutaml +4 -4
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -49
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
- data/spec/vcr_cassettes/isobib_get_124.yml +14 -14
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +71 -75
- metadata +7 -18
@@ -44,6 +44,75 @@ RSpec.describe Asciidoctor::Standoc do
|
|
44
44
|
OUTPUT
|
45
45
|
end
|
46
46
|
|
47
|
+
it "processes the Asciidoctor::Standoc index macros" do
|
48
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
|
+
#{ASCIIDOC_BLANK_HDR}
|
50
|
+
index:also[]
|
51
|
+
index:see[A]
|
52
|
+
index:also[B,C~x~]
|
53
|
+
index:see[D,_E_,F]
|
54
|
+
index:also[G,H,I,J]
|
55
|
+
index:see[K,L,M,N,O]
|
56
|
+
index-range:id2[P]
|
57
|
+
index-range:id3[((_P_))]
|
58
|
+
index-range:id3[(((Q, R, S)))]
|
59
|
+
|
60
|
+
Text [[id2]]
|
61
|
+
|
62
|
+
Text [[id3]]
|
63
|
+
INPUT
|
64
|
+
#{BLANK_HDR}
|
65
|
+
<sections>
|
66
|
+
<p id='_'>
|
67
|
+
<index-xref also='true'>
|
68
|
+
<primary>B</primary>
|
69
|
+
<target>
|
70
|
+
C
|
71
|
+
<sub>x</sub>
|
72
|
+
</target>
|
73
|
+
</index-xref>
|
74
|
+
<index-xref also='false'>
|
75
|
+
<primary>D</primary>
|
76
|
+
<secondary>
|
77
|
+
<em>E</em>
|
78
|
+
</secondary>
|
79
|
+
<target>F</target>
|
80
|
+
</index-xref>
|
81
|
+
<index-xref also='true'>
|
82
|
+
<primary>G</primary>
|
83
|
+
<secondary>H</secondary>
|
84
|
+
<tertiary>I</tertiary>
|
85
|
+
<target>J</target>
|
86
|
+
</index-xref>
|
87
|
+
P
|
88
|
+
<index to="id2">
|
89
|
+
<primary>P</primary>
|
90
|
+
</index>
|
91
|
+
<em>P</em>
|
92
|
+
<index to="id3">
|
93
|
+
<primary>
|
94
|
+
<em>P</em>
|
95
|
+
</primary>
|
96
|
+
</index>
|
97
|
+
<index to="id3">
|
98
|
+
<primary>Q</primary>
|
99
|
+
<secondary>R</secondary>
|
100
|
+
<tertiary>S</tertiary>
|
101
|
+
</index>
|
102
|
+
</p>
|
103
|
+
<p id='_'>
|
104
|
+
Text
|
105
|
+
<bookmark id='id2'/>
|
106
|
+
</p>
|
107
|
+
<p id='_'>
|
108
|
+
Text
|
109
|
+
<bookmark id='id3'/>
|
110
|
+
</p>
|
111
|
+
</sections>
|
112
|
+
</standard-document>
|
113
|
+
OUTPUT
|
114
|
+
end
|
115
|
+
|
47
116
|
it "processes the Asciidoctor::Standoc variant macros" do
|
48
117
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
118
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -329,13 +398,11 @@ OUTPUT
|
|
329
398
|
<formula id='_'>
|
330
399
|
<stem type='MathML'>
|
331
400
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
332
|
-
<mover>
|
401
|
+
<mover accent="true">
|
333
402
|
<mrow>
|
334
403
|
<mi>X</mi>
|
335
404
|
</mrow>
|
336
|
-
<mrow>
|
337
405
|
<mo>¯</mo>
|
338
|
-
</mrow>
|
339
406
|
</mover>
|
340
407
|
<mo>′</mo>
|
341
408
|
<mo>=</mo>
|
@@ -508,309 +575,223 @@ OUTPUT
|
|
508
575
|
OUTPUT
|
509
576
|
end
|
510
577
|
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
@startuml
|
518
|
-
Alice -> Bob: Authentication Request
|
519
|
-
Bob --> Alice: Authentication Response
|
520
|
-
|
521
|
-
Alice -> Bob: Another authentication Request
|
522
|
-
Alice <-- Bob: another authentication Response
|
523
|
-
@enduml
|
524
|
-
....
|
525
|
-
|
526
|
-
[plantuml]
|
527
|
-
....
|
528
|
-
Alice -> Bob: Authentication Request
|
529
|
-
Bob --> Alice: Authentication Response
|
530
|
-
|
531
|
-
Alice -> Bob: Another authentication Request
|
532
|
-
Alice <-- Bob: another authentication Response
|
533
|
-
....
|
534
|
-
|
535
|
-
[plantuml]
|
536
|
-
....
|
537
|
-
@startuml filename
|
538
|
-
Alice -> Bob: Authentication Request
|
539
|
-
Bob --> Alice: Authentication Response
|
540
|
-
|
541
|
-
Alice -> Bob: Another authentication Request
|
542
|
-
Alice <-- Bob: another authentication Response
|
543
|
-
@enduml
|
544
|
-
....
|
545
|
-
INPUT
|
546
|
-
#{BLANK_HDR}
|
547
|
-
<sections><figure id="_">
|
548
|
-
<image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
549
|
-
</figure>
|
550
|
-
<figure id="_">
|
551
|
-
<image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
552
|
-
</figure>
|
553
|
-
<figure id="_">
|
554
|
-
<image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
555
|
-
</figure>
|
556
|
-
</sections>
|
557
|
-
|
558
|
-
</standard-document>
|
559
|
-
OUTPUT
|
560
|
-
end
|
561
|
-
|
562
|
-
it "processes the PlantUML macro with imagesdir" do
|
563
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
564
|
-
= Document title
|
565
|
-
Author
|
566
|
-
:docfile: test.adoc
|
567
|
-
:nodoc:
|
568
|
-
:novalid:
|
569
|
-
:no-isobib:
|
570
|
-
:imagesdir: spec/assets
|
571
|
-
|
572
|
-
[plantuml]
|
573
|
-
....
|
574
|
-
@startuml
|
575
|
-
Alice -> Bob: Authentication Request
|
576
|
-
Bob --> Alice: Authentication Response
|
577
|
-
|
578
|
-
Alice -> Bob: Another authentication Request
|
579
|
-
Alice <-- Bob: another authentication Response
|
580
|
-
@enduml
|
581
|
-
....
|
582
|
-
INPUT
|
583
|
-
#{BLANK_HDR}
|
584
|
-
<sections>
|
585
|
-
<figure id="_">
|
586
|
-
<image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
587
|
-
</figure>
|
588
|
-
</sections>
|
589
|
-
</standard-document>
|
590
|
-
OUTPUT
|
578
|
+
describe 'term inline macros' do
|
579
|
+
subject(:convert) do
|
580
|
+
xmlpp(
|
581
|
+
strip_guid(
|
582
|
+
Asciidoctor.convert(
|
583
|
+
input, backend: :standoc, header_footer: true)))
|
591
584
|
end
|
592
|
-
|
593
|
-
context 'when lutaml_diagram' do
|
594
585
|
let(:input) do
|
595
|
-
<<~
|
596
|
-
|
597
|
-
|
598
|
-
:docfile: test.adoc
|
599
|
-
:nodoc:
|
600
|
-
:novalid:
|
601
|
-
:no-isobib:
|
602
|
-
:imagesdir: spec/assets
|
603
|
-
|
604
|
-
[lutaml_diagram]
|
605
|
-
....
|
606
|
-
diagram MyView {
|
607
|
-
fontname "Arial"
|
608
|
-
title "my diagram"
|
609
|
-
class Foo {}
|
610
|
-
}
|
611
|
-
....
|
612
|
-
OUTPUT
|
613
|
-
end
|
614
|
-
let(:output) do
|
615
|
-
<<~"OUTPUT"
|
616
|
-
#{BLANK_HDR}
|
617
|
-
<sections>
|
618
|
-
<figure id="_">
|
619
|
-
<image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
620
|
-
</figure>
|
621
|
-
</sections>
|
622
|
-
</standard-document>
|
623
|
-
OUTPUT
|
624
|
-
end
|
586
|
+
<<~XML
|
587
|
+
#{ASCIIDOC_BLANK_HDR}
|
588
|
+
== Terms and Definitions
|
625
589
|
|
626
|
-
|
627
|
-
expect(
|
628
|
-
xmlpp(
|
629
|
-
strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
|
630
|
-
.gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
|
631
|
-
.to(be_equivalent_to xmlpp(output))
|
632
|
-
end
|
633
|
-
end
|
590
|
+
=== name2
|
634
591
|
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
<<~"OUTPUT"
|
640
|
-
= Document title
|
641
|
-
Author
|
642
|
-
:docfile: test.adoc
|
643
|
-
:nodoc:
|
644
|
-
:novalid:
|
645
|
-
:no-isobib:
|
646
|
-
:imagesdir: spec/assets
|
647
|
-
|
648
|
-
[lutaml_uml_attributes_table,#{example_file},AttributeProfile]
|
649
|
-
OUTPUT
|
592
|
+
== Main
|
593
|
+
|
594
|
+
term:[name,name2] is a term
|
595
|
+
XML
|
650
596
|
end
|
651
597
|
let(:output) do
|
652
|
-
<<~
|
653
|
-
|
598
|
+
<<~XML
|
599
|
+
#{BLANK_HDR}
|
654
600
|
<sections>
|
601
|
+
<terms id='_' obligation='normative'>
|
602
|
+
<title>Terms and definitions</title>
|
603
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
604
|
+
<term id='term-name2'>
|
605
|
+
<preferred>name2</preferred>
|
606
|
+
</term>
|
607
|
+
</terms>
|
655
608
|
<clause id='_' inline-header='false' obligation='normative'>
|
656
|
-
<title>
|
657
|
-
<
|
658
|
-
<name
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
<th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
|
664
|
-
<th valign='top' align='left'>Max Occur</th>
|
665
|
-
<th valign='top' align='left'>Data Type</th>
|
666
|
-
</tr>
|
667
|
-
</thead>
|
668
|
-
<tbody>
|
669
|
-
<tr>
|
670
|
-
<td valign='top' align='left'>addressClassProfile</td>
|
671
|
-
<td valign='top' align='left'>TODO: enum ‘s definition</td>
|
672
|
-
<td valign='top' align='left'>M</td>
|
673
|
-
<td valign='top' align='left'>1</td>
|
674
|
-
<td valign='top' align='left'>
|
675
|
-
<tt>CharacterString</tt>
|
676
|
-
</td>
|
677
|
-
</tr>
|
678
|
-
<tr>
|
679
|
-
<td valign='top' align='left'>imlicistAttributeProfile</td>
|
680
|
-
<td valign='top' align='left'>this is attribute definition with multiply lines</td>
|
681
|
-
<td valign='top' align='left'>M</td>
|
682
|
-
<td valign='top' align='left'>1</td>
|
683
|
-
<td valign='top' align='left'>
|
684
|
-
<tt>CharacterString</tt>
|
685
|
-
</td>
|
686
|
-
</tr>
|
687
|
-
</tbody>
|
688
|
-
</table>
|
609
|
+
<title>Main</title>
|
610
|
+
<p id='_'>
|
611
|
+
<em>name</em>
|
612
|
+
(
|
613
|
+
<xref target='term-name2'/>
|
614
|
+
) is a term
|
615
|
+
</p>
|
689
616
|
</clause>
|
690
617
|
</sections>
|
691
618
|
</standard-document>
|
692
|
-
|
619
|
+
XML
|
693
620
|
end
|
694
621
|
|
695
|
-
it
|
696
|
-
expect(
|
697
|
-
xmlpp(
|
698
|
-
strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
|
699
|
-
.to(be_equivalent_to(xmlpp(output)))
|
622
|
+
it 'converts macro into the correct xml' do
|
623
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
700
624
|
end
|
701
|
-
end
|
702
|
-
=end
|
703
625
|
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
626
|
+
context 'default params' do
|
627
|
+
let(:input) do
|
628
|
+
<<~XML
|
629
|
+
#{ASCIIDOC_BLANK_HDR}
|
708
630
|
|
709
|
-
|
710
|
-
....
|
711
|
-
@startuml
|
712
|
-
Alice -> Bob: Authentication Request
|
713
|
-
Bob --> Alice: Authentication Response
|
631
|
+
== Terms and Definitions
|
714
632
|
|
715
|
-
|
716
|
-
Alice <-- Bob: another authentication Response
|
717
|
-
@enduml
|
718
|
-
....
|
719
|
-
INPUT
|
633
|
+
=== name
|
720
634
|
|
721
|
-
|
722
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
723
|
-
#{ASCIIDOC_BLANK_HDR}
|
635
|
+
== Main
|
724
636
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
637
|
+
term:[name] is a term
|
638
|
+
XML
|
639
|
+
end
|
640
|
+
let(:output) do
|
641
|
+
<<~XML
|
642
|
+
#{BLANK_HDR}
|
643
|
+
<sections>
|
644
|
+
<terms id='_' obligation='normative'>
|
645
|
+
<title>Terms and definitions</title>
|
646
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
647
|
+
<term id='term-name'>
|
648
|
+
<preferred>name</preferred>
|
649
|
+
</term>
|
650
|
+
</terms>
|
651
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
652
|
+
<title>Main</title>
|
653
|
+
<p id='_'>
|
654
|
+
<em>name</em>
|
655
|
+
(
|
656
|
+
<xref target='term-name' />
|
657
|
+
) is a term
|
658
|
+
</p>
|
659
|
+
</clause>
|
660
|
+
</sections>
|
661
|
+
</standard-document>
|
662
|
+
XML
|
663
|
+
end
|
664
|
+
|
665
|
+
it 'uses `name` as termref name' do
|
666
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
667
|
+
end
|
668
|
+
end
|
730
669
|
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
INPUT
|
736
|
-
#{BLANK_HDR}
|
737
|
-
<sections>
|
738
|
-
<sourcecode id="_" lang="plantuml">@startuml
|
739
|
-
Alice -> Bob: Authentication Request
|
740
|
-
Bob --> Alice: Authentication Response
|
741
|
-
|
742
|
-
Alice -> Bob: Another authentication Request
|
743
|
-
Alice <-- Bob: another authentication Response
|
744
|
-
@enduml</sourcecode>
|
745
|
-
</sections>
|
746
|
-
</standard-document>
|
747
|
-
OUTPUT
|
748
|
-
end
|
670
|
+
context 'multiply exising ids in document' do
|
671
|
+
let(:input) do
|
672
|
+
<<~XML
|
673
|
+
#{ASCIIDOC_BLANK_HDR}
|
749
674
|
|
750
|
-
|
751
|
-
mock_localdir_unwritable
|
752
|
-
expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{not writable for PlantUML}).to_stderr
|
753
|
-
#{ASCIIDOC_BLANK_HDR}
|
675
|
+
== Terms and Definitions
|
754
676
|
|
755
|
-
|
756
|
-
|
757
|
-
@startuml
|
758
|
-
Alice -> Bob: Authentication Request
|
759
|
-
Bob --> Alice: Authentication Response
|
677
|
+
=== name
|
678
|
+
=== name2
|
760
679
|
|
761
|
-
|
762
|
-
|
763
|
-
@enduml
|
764
|
-
....
|
765
|
-
INPUT
|
680
|
+
[[term-name]]
|
681
|
+
== Main
|
766
682
|
|
767
|
-
|
768
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
769
|
-
#{ASCIIDOC_BLANK_HDR}
|
683
|
+
paragraph
|
770
684
|
|
771
|
-
|
772
|
-
|
773
|
-
@startuml
|
774
|
-
Alice -> Bob: Authentication Request
|
775
|
-
Bob --> Alice: Authentication Response
|
685
|
+
[[term-name2]]
|
686
|
+
== Second
|
776
687
|
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
688
|
+
term:[name] is a term
|
689
|
+
term:[name2] is a term
|
690
|
+
XML
|
691
|
+
end
|
692
|
+
let(:output) do
|
693
|
+
<<~XML
|
694
|
+
#{BLANK_HDR}
|
695
|
+
<sections>
|
696
|
+
<terms id='_' obligation='normative'>
|
697
|
+
<title>Terms and definitions</title>
|
698
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
699
|
+
<term id='term-name-1'>
|
700
|
+
<preferred>name</preferred>
|
701
|
+
</term>
|
702
|
+
<term id='term-name2-1'>
|
703
|
+
<preferred>name2</preferred>
|
704
|
+
</term>
|
705
|
+
</terms>
|
706
|
+
<clause id='term-name' inline-header='false' obligation='normative'>
|
707
|
+
<title>Main</title>
|
708
|
+
<p id='_'>paragraph</p>
|
709
|
+
</clause>
|
710
|
+
<clause id='term-name2' inline-header='false' obligation='normative'>
|
711
|
+
<title>Second</title>
|
712
|
+
<p id='_'>
|
713
|
+
<em>name</em>
|
714
|
+
(
|
715
|
+
<xref target='term-name-1' />
|
716
|
+
) is a term
|
717
|
+
<em>name2</em>
|
718
|
+
(
|
719
|
+
<xref target='term-name2-1' />
|
720
|
+
) is a term
|
721
|
+
</p>
|
722
|
+
</clause>
|
723
|
+
</sections>
|
724
|
+
</standard-document>
|
725
|
+
XML
|
726
|
+
end
|
727
|
+
|
728
|
+
it 'generates unique ids which do not match existing ids' do
|
729
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
730
|
+
end
|
731
|
+
end
|
795
732
|
|
796
|
-
|
733
|
+
context 'when missing actual ref' do
|
734
|
+
let(:input) do
|
735
|
+
<<~XML
|
736
|
+
#{ASCIIDOC_BLANK_HDR}
|
797
737
|
|
798
|
-
|
799
|
-
expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do
|
800
|
-
raise "PlantUML not installed"
|
801
|
-
false
|
802
|
-
end
|
803
|
-
end
|
738
|
+
== Terms and Definitions
|
804
739
|
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
740
|
+
=== name identity
|
741
|
+
|
742
|
+
[[name-check]]
|
743
|
+
=== name check
|
744
|
+
|
745
|
+
paragraph
|
810
746
|
|
811
|
-
|
812
|
-
|
813
|
-
|
747
|
+
term:[name check] is a term
|
748
|
+
|
749
|
+
term:[name identity] is a term
|
750
|
+
|
751
|
+
Moreover, term:[missing] is a term
|
752
|
+
XML
|
753
|
+
end
|
754
|
+
let(:output) do
|
755
|
+
<<~XML
|
756
|
+
#{BLANK_HDR}
|
757
|
+
<sections>
|
758
|
+
<terms id='_' obligation='normative'>
|
759
|
+
<title>Terms and definitions</title>
|
760
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
761
|
+
<term id='term-name-identity'>
|
762
|
+
<preferred>name identity</preferred>
|
763
|
+
</term>
|
764
|
+
<term id='name-check'>
|
765
|
+
<preferred>name check</preferred>
|
766
|
+
<definition>
|
767
|
+
<p id='_'>paragraph</p>
|
768
|
+
<p id='_'>
|
769
|
+
<em>name check</em>
|
770
|
+
(
|
771
|
+
<xref target='name-check'/>
|
772
|
+
) is a term
|
773
|
+
</p>
|
774
|
+
<p id='_'>
|
775
|
+
<em>name identity</em>
|
776
|
+
(
|
777
|
+
<xref target='term-name-identity'/>
|
778
|
+
) is a term
|
779
|
+
</p>
|
780
|
+
<p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
|
781
|
+
</p>
|
782
|
+
</definition>
|
783
|
+
</term>
|
784
|
+
</terms>
|
785
|
+
</sections>
|
786
|
+
</standard-document>
|
787
|
+
XML
|
788
|
+
end
|
789
|
+
|
790
|
+
it 'generates unique ids which do not match existing ids' do
|
791
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
792
|
+
end
|
814
793
|
end
|
815
|
-
|
794
|
+
|
795
|
+
end
|
796
|
+
|
816
797
|
end
|