metanorma-standoc 1.6.1 → 1.7.0
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 +66 -0
- data/README.adoc +1 -3
- data/lib/asciidoctor/standoc/base.rb +8 -16
- data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
- data/lib/asciidoctor/standoc/cleanup.rb +52 -4
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +47 -20
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_inline.rb +9 -3
- data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
- data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
- data/lib/asciidoctor/standoc/converter.rb +71 -1
- data/lib/asciidoctor/standoc/front.rb +6 -0
- data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
- data/lib/asciidoctor/standoc/inline.rb +6 -5
- data/lib/asciidoctor/standoc/isodoc.rng +36 -43
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +55 -59
- data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
- data/lib/asciidoctor/standoc/ref.rb +19 -25
- data/lib/asciidoctor/standoc/ref_sect.rb +4 -3
- data/lib/asciidoctor/standoc/section.rb +21 -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 +5 -3
- data/spec/asciidoctor-standoc/base_spec.rb +14 -4
- data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1519 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +416 -1554
- data/spec/asciidoctor-standoc/converter_spec.rb +8 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +2 -5
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +16 -9
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
- data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +408 -169
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +6 -6
- data/spec/asciidoctor-standoc/refs_spec.rb +112 -65
- data/spec/asciidoctor-standoc/section_spec.rb +17 -12
- data/spec/asciidoctor-standoc/table_spec.rb +86 -0
- data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
- data/spec/fixtures/diagram_definitions.lutaml +22 -0
- data/spec/fixtures/test.exp +121 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +59 -243
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +281 -157
- metadata +45 -11
- data/.github/workflows/macos.yml +0 -41
- data/.github/workflows/ubuntu.yml +0 -45
- data/.github/workflows/windows.yml +0 -43
@@ -44,6 +44,109 @@ 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
|
+
|
116
|
+
it "processes the Asciidoctor::Standoc variant macros" do
|
117
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
118
|
+
#{ASCIIDOC_BLANK_HDR}
|
119
|
+
== lang:en[English] lang:fr-Latn[Français]
|
120
|
+
|
121
|
+
this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
|
122
|
+
|
123
|
+
INPUT
|
124
|
+
#{BLANK_HDR}
|
125
|
+
<sections>
|
126
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
127
|
+
<title>
|
128
|
+
<variant lang='en'>English</variant>
|
129
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
130
|
+
</title>
|
131
|
+
<p id='_'>
|
132
|
+
this
|
133
|
+
<variant>
|
134
|
+
<variant lang='en'>English</variant>
|
135
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
136
|
+
</variant>
|
137
|
+
section is
|
138
|
+
<variant>
|
139
|
+
<variant lang='en'>silly</variant>
|
140
|
+
<variant lang='fr'>fou</variant>
|
141
|
+
</variant>
|
142
|
+
</p>
|
143
|
+
</clause>
|
144
|
+
</sections>
|
145
|
+
</standard-document>
|
146
|
+
OUTPUT
|
147
|
+
end
|
148
|
+
|
149
|
+
|
47
150
|
it "processes the Asciidoctor::Standoc concept macros" do
|
48
151
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
152
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -295,13 +398,11 @@ OUTPUT
|
|
295
398
|
<formula id='_'>
|
296
399
|
<stem type='MathML'>
|
297
400
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
298
|
-
<mover>
|
401
|
+
<mover accent="true">
|
299
402
|
<mrow>
|
300
403
|
<mi>X</mi>
|
301
404
|
</mrow>
|
302
|
-
<mrow>
|
303
405
|
<mo>¯</mo>
|
304
|
-
</mrow>
|
305
406
|
</mover>
|
306
407
|
<mo>′</mo>
|
307
408
|
<mo>=</mo>
|
@@ -361,198 +462,336 @@ OUTPUT
|
|
361
462
|
OUTPUT
|
362
463
|
end
|
363
464
|
|
364
|
-
it "processes the
|
365
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))
|
465
|
+
it "processes the footnoteblock macro" do
|
466
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
366
467
|
#{ASCIIDOC_BLANK_HDR}
|
367
468
|
|
368
|
-
[
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
Alice <-- Bob: another authentication Response
|
376
|
-
@enduml
|
377
|
-
....
|
378
|
-
|
379
|
-
[plantuml]
|
380
|
-
....
|
381
|
-
Alice -> Bob: Authentication Request
|
382
|
-
Bob --> Alice: Authentication Response
|
383
|
-
|
384
|
-
Alice -> Bob: Another authentication Request
|
385
|
-
Alice <-- Bob: another authentication Response
|
386
|
-
....
|
387
|
-
|
388
|
-
[plantuml]
|
389
|
-
....
|
390
|
-
@startuml filename
|
391
|
-
Alice -> Bob: Authentication Request
|
392
|
-
Bob --> Alice: Authentication Response
|
393
|
-
|
394
|
-
Alice -> Bob: Another authentication Request
|
395
|
-
Alice <-- Bob: another authentication Response
|
396
|
-
@enduml
|
397
|
-
....
|
398
|
-
INPUT
|
399
|
-
#{BLANK_HDR}
|
400
|
-
<sections><figure id="_">
|
401
|
-
<image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
402
|
-
</figure>
|
403
|
-
<figure id="_">
|
404
|
-
<image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
405
|
-
</figure>
|
406
|
-
<figure id="_">
|
407
|
-
<image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
408
|
-
</figure>
|
409
|
-
</sections>
|
469
|
+
footnoteblock:[id1]
|
470
|
+
|
471
|
+
[[id1]]
|
472
|
+
[NOTE]
|
473
|
+
--
|
474
|
+
|===
|
475
|
+
|a |b
|
410
476
|
|
477
|
+
|c |d
|
478
|
+
|===
|
479
|
+
|
480
|
+
* A
|
481
|
+
* B
|
482
|
+
* C
|
483
|
+
--
|
484
|
+
INPUT
|
485
|
+
#{BLANK_HDR}
|
486
|
+
<sections>
|
487
|
+
<p id="_">
|
488
|
+
<fn reference='1'>
|
489
|
+
<table id='_'>
|
490
|
+
<thead>
|
491
|
+
<tr>
|
492
|
+
<th valign='top' align='left'>a</th>
|
493
|
+
<th valign='top' align='left'>b</th>
|
494
|
+
</tr>
|
495
|
+
</thead>
|
496
|
+
<tbody>
|
497
|
+
<tr>
|
498
|
+
<td valign='top' align='left'>c</td>
|
499
|
+
<td valign='top' align='left'>d</td>
|
500
|
+
</tr>
|
501
|
+
</tbody>
|
502
|
+
</table>
|
503
|
+
<ul id='_'>
|
504
|
+
<li>
|
505
|
+
<p id='_'>A</p>
|
506
|
+
</li>
|
507
|
+
<li>
|
508
|
+
<p id='_'>B</p>
|
509
|
+
</li>
|
510
|
+
<li>
|
511
|
+
<p id='_'>C</p>
|
512
|
+
</li>
|
513
|
+
</ul>
|
514
|
+
</fn>
|
515
|
+
</p>
|
516
|
+
</sections>
|
411
517
|
</standard-document>
|
412
518
|
OUTPUT
|
413
519
|
end
|
414
520
|
|
415
|
-
|
416
|
-
|
417
|
-
= Document title
|
418
|
-
Author
|
419
|
-
:docfile: test.adoc
|
420
|
-
:nodoc:
|
421
|
-
:novalid:
|
422
|
-
:no-isobib:
|
423
|
-
:imagesdir: spec/assets
|
424
|
-
|
425
|
-
[plantuml]
|
426
|
-
....
|
427
|
-
@startuml
|
428
|
-
Alice -> Bob: Authentication Request
|
429
|
-
Bob --> Alice: Authentication Response
|
430
|
-
|
431
|
-
Alice -> Bob: Another authentication Request
|
432
|
-
Alice <-- Bob: another authentication Response
|
433
|
-
@enduml
|
434
|
-
....
|
435
|
-
INPUT
|
436
|
-
#{BLANK_HDR}
|
437
|
-
<sections>
|
438
|
-
<figure id="_">
|
439
|
-
<image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
440
|
-
</figure>
|
441
|
-
</sections>
|
442
|
-
</standard-document>
|
443
|
-
OUTPUT
|
444
|
-
end
|
445
|
-
|
446
|
-
it "processes the PlantUML macro with PlantUML disabled" do
|
447
|
-
mock_plantuml_disabled
|
448
|
-
expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr
|
521
|
+
it "processes the footnoteblock macro with failed reference" do
|
522
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
449
523
|
#{ASCIIDOC_BLANK_HDR}
|
450
524
|
|
451
|
-
[
|
452
|
-
....
|
453
|
-
@startuml
|
454
|
-
Alice -> Bob: Authentication Request
|
455
|
-
Bob --> Alice: Authentication Response
|
456
|
-
|
457
|
-
Alice -> Bob: Another authentication Request
|
458
|
-
Alice <-- Bob: another authentication Response
|
459
|
-
@enduml
|
460
|
-
....
|
461
|
-
INPUT
|
525
|
+
footnoteblock:[id1]
|
462
526
|
|
463
|
-
|
464
|
-
|
465
|
-
|
527
|
+
[[id2]]
|
528
|
+
[NOTE]
|
529
|
+
--
|
530
|
+
|===
|
531
|
+
|a |b
|
466
532
|
|
467
|
-
|
468
|
-
|
469
|
-
@startuml
|
470
|
-
Alice -> Bob: Authentication Request
|
471
|
-
Bob --> Alice: Authentication Response
|
533
|
+
|c |d
|
534
|
+
|===
|
472
535
|
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
536
|
+
* A
|
537
|
+
* B
|
538
|
+
* C
|
539
|
+
--
|
477
540
|
INPUT
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
541
|
+
#{BLANK_HDR}
|
542
|
+
<sections>
|
543
|
+
<p id='_'>
|
544
|
+
<fn reference='1'>[ERROR]</fn>
|
545
|
+
</p>
|
546
|
+
<note id='id2'>
|
547
|
+
<table id='_'>
|
548
|
+
<thead>
|
549
|
+
<tr>
|
550
|
+
<th valign='top' align='left'>a</th>
|
551
|
+
<th valign='top' align='left'>b</th>
|
552
|
+
</tr>
|
553
|
+
</thead>
|
554
|
+
<tbody>
|
555
|
+
<tr>
|
556
|
+
<td valign='top' align='left'>c</td>
|
557
|
+
<td valign='top' align='left'>d</td>
|
558
|
+
</tr>
|
559
|
+
</tbody>
|
560
|
+
</table>
|
561
|
+
<ul id='_'>
|
562
|
+
<li>
|
563
|
+
<p id='_'>A</p>
|
564
|
+
</li>
|
565
|
+
<li>
|
566
|
+
<p id='_'>B</p>
|
567
|
+
</li>
|
568
|
+
<li>
|
569
|
+
<p id='_'>C</p>
|
570
|
+
</li>
|
571
|
+
</ul>
|
572
|
+
</note>
|
573
|
+
</sections>
|
488
574
|
</standard-document>
|
489
575
|
OUTPUT
|
490
576
|
end
|
491
577
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
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)))
|
584
|
+
end
|
585
|
+
let(:input) do
|
586
|
+
<<~XML
|
587
|
+
#{ASCIIDOC_BLANK_HDR}
|
588
|
+
== Terms and Definitions
|
496
589
|
|
497
|
-
|
498
|
-
....
|
499
|
-
@startuml
|
500
|
-
Alice -> Bob: Authentication Request
|
501
|
-
Bob --> Alice: Authentication Response
|
590
|
+
=== name2
|
502
591
|
|
503
|
-
|
504
|
-
Alice <-- Bob: another authentication Response
|
505
|
-
@enduml
|
506
|
-
....
|
507
|
-
INPUT
|
592
|
+
== Main
|
508
593
|
|
509
|
-
|
510
|
-
|
511
|
-
|
594
|
+
term:[name,name2] is a term
|
595
|
+
XML
|
596
|
+
end
|
597
|
+
let(:output) do
|
598
|
+
<<~XML
|
599
|
+
#{BLANK_HDR}
|
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>
|
608
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
609
|
+
<title>Main</title>
|
610
|
+
<p id='_'>
|
611
|
+
<em>name</em>
|
612
|
+
(
|
613
|
+
<xref target='term-name2'/>
|
614
|
+
) is a term
|
615
|
+
</p>
|
616
|
+
</clause>
|
617
|
+
</sections>
|
618
|
+
</standard-document>
|
619
|
+
XML
|
620
|
+
end
|
512
621
|
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
Alice -> Bob: Authentication Request
|
517
|
-
Bob --> Alice: Authentication Response
|
622
|
+
it 'converts macro into the correct xml' do
|
623
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
624
|
+
end
|
518
625
|
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
Alice -> Bob: Authentication Request
|
528
|
-
Bob --> Alice: Authentication Response
|
529
|
-
|
530
|
-
Alice -> Bob: Another authentication Request
|
531
|
-
Alice <-- Bob: another authentication Response
|
532
|
-
@enduml</sourcecode>
|
533
|
-
</sections>
|
534
|
-
</standard-document>
|
535
|
-
OUTPUT
|
536
|
-
end
|
626
|
+
context 'default params' do
|
627
|
+
let(:input) do
|
628
|
+
<<~XML
|
629
|
+
#{ASCIIDOC_BLANK_HDR}
|
630
|
+
|
631
|
+
== Terms and Definitions
|
632
|
+
|
633
|
+
=== name
|
537
634
|
|
538
|
-
|
635
|
+
== Main
|
539
636
|
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
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
|
544
668
|
end
|
545
|
-
end
|
546
669
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
670
|
+
context 'multiply exising ids in document' do
|
671
|
+
let(:input) do
|
672
|
+
<<~XML
|
673
|
+
#{ASCIIDOC_BLANK_HDR}
|
674
|
+
|
675
|
+
== Terms and Definitions
|
676
|
+
|
677
|
+
=== name
|
678
|
+
=== name2
|
679
|
+
|
680
|
+
[[term-name]]
|
681
|
+
== Main
|
552
682
|
|
553
|
-
|
554
|
-
|
555
|
-
|
683
|
+
paragraph
|
684
|
+
|
685
|
+
[[term-name2]]
|
686
|
+
== Second
|
687
|
+
|
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
|
556
731
|
end
|
557
|
-
|
732
|
+
|
733
|
+
context 'when missing actual ref' do
|
734
|
+
let(:input) do
|
735
|
+
<<~XML
|
736
|
+
#{ASCIIDOC_BLANK_HDR}
|
737
|
+
|
738
|
+
== Terms and Definitions
|
739
|
+
|
740
|
+
=== name identity
|
741
|
+
|
742
|
+
[[name-check]]
|
743
|
+
=== name check
|
744
|
+
|
745
|
+
paragraph
|
746
|
+
|
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
|
793
|
+
end
|
794
|
+
|
795
|
+
end
|
796
|
+
|
558
797
|
end
|