metanorma-standoc 1.6.0 → 1.6.5
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 +32 -0
- data/lib/asciidoctor/standoc/cleanup.rb +52 -4
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +25 -0
- data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
- data/lib/asciidoctor/standoc/cleanup_ref.rb +18 -25
- data/lib/asciidoctor/standoc/cleanup_terms.rb +3 -0
- data/lib/asciidoctor/standoc/converter.rb +61 -3
- data/lib/asciidoctor/standoc/front.rb +9 -3
- data/lib/asciidoctor/standoc/front_contributor.rb +34 -10
- data/lib/asciidoctor/standoc/isodoc.rng +29 -44
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +45 -63
- data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
- data/lib/asciidoctor/standoc/ref.rb +24 -36
- data/lib/asciidoctor/standoc/ref_sect.rb +16 -8
- data/lib/asciidoctor/standoc/section.rb +5 -9
- data/lib/asciidoctor/standoc/table.rb +12 -0
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
- data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
- data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +6 -3
- data/spec/asciidoctor-standoc/base_spec.rb +127 -8
- data/spec/asciidoctor-standoc/blocks_spec.rb +8 -8
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1514 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +450 -1554
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +22 -31
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_json2text_spec.rb +1 -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 +378 -169
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +1 -1
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -8
- data/spec/asciidoctor-standoc/refs_spec.rb +350 -101
- data/spec/asciidoctor-standoc/section_spec.rb +11 -11
- 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/support/shared_examples/structured_data_2_text_preprocessor.rb +156 -4
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -233
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -58
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -58
- 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 +276 -158
- metadata +61 -14
- data/.github/workflows/macos.yml +0 -41
- data/.github/workflows/ubuntu.yml +0 -45
- data/.github/workflows/windows.yml +0 -43
- data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +0 -123
- data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +0 -44
- data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +0 -46
@@ -44,6 +44,79 @@ 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
|
+
INPUT
|
57
|
+
#{BLANK_HDR}
|
58
|
+
<sections>
|
59
|
+
<p id='_'>
|
60
|
+
<index-xref also='true'>
|
61
|
+
<primary>B</primary>
|
62
|
+
<target>
|
63
|
+
C
|
64
|
+
<sub>x</sub>
|
65
|
+
</target>
|
66
|
+
</index-xref>
|
67
|
+
<index-xref also='false'>
|
68
|
+
<primary>D</primary>
|
69
|
+
<secondary>
|
70
|
+
<em>E</em>
|
71
|
+
</secondary>
|
72
|
+
<target>F</target>
|
73
|
+
</index-xref>
|
74
|
+
<index-xref also='true'>
|
75
|
+
<primary>G</primary>
|
76
|
+
<secondary>H</secondary>
|
77
|
+
<tertiary>I</tertiary>
|
78
|
+
<target>J</target>
|
79
|
+
</index-xref>
|
80
|
+
</p>
|
81
|
+
</sections>
|
82
|
+
</standard-document>
|
83
|
+
OUTPUT
|
84
|
+
end
|
85
|
+
|
86
|
+
it "processes the Asciidoctor::Standoc variant macros" do
|
87
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
88
|
+
#{ASCIIDOC_BLANK_HDR}
|
89
|
+
== lang:en[English] lang:fr-Latn[Français]
|
90
|
+
|
91
|
+
this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
|
92
|
+
|
93
|
+
INPUT
|
94
|
+
#{BLANK_HDR}
|
95
|
+
<sections>
|
96
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
97
|
+
<title>
|
98
|
+
<variant lang='en'>English</variant>
|
99
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
100
|
+
</title>
|
101
|
+
<p id='_'>
|
102
|
+
this
|
103
|
+
<variant>
|
104
|
+
<variant lang='en'>English</variant>
|
105
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
106
|
+
</variant>
|
107
|
+
section is
|
108
|
+
<variant>
|
109
|
+
<variant lang='en'>silly</variant>
|
110
|
+
<variant lang='fr'>fou</variant>
|
111
|
+
</variant>
|
112
|
+
</p>
|
113
|
+
</clause>
|
114
|
+
</sections>
|
115
|
+
</standard-document>
|
116
|
+
OUTPUT
|
117
|
+
end
|
118
|
+
|
119
|
+
|
47
120
|
it "processes the Asciidoctor::Standoc concept macros" do
|
48
121
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
122
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -295,13 +368,11 @@ OUTPUT
|
|
295
368
|
<formula id='_'>
|
296
369
|
<stem type='MathML'>
|
297
370
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
298
|
-
<mover>
|
371
|
+
<mover accent="true">
|
299
372
|
<mrow>
|
300
373
|
<mi>X</mi>
|
301
374
|
</mrow>
|
302
|
-
<mrow>
|
303
375
|
<mo>¯</mo>
|
304
|
-
</mrow>
|
305
376
|
</mover>
|
306
377
|
<mo>′</mo>
|
307
378
|
<mo>=</mo>
|
@@ -361,198 +432,336 @@ OUTPUT
|
|
361
432
|
OUTPUT
|
362
433
|
end
|
363
434
|
|
364
|
-
it "processes the
|
365
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))
|
435
|
+
it "processes the footnoteblock macro" do
|
436
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
366
437
|
#{ASCIIDOC_BLANK_HDR}
|
367
438
|
|
368
|
-
[
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
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>
|
439
|
+
footnoteblock:[id1]
|
440
|
+
|
441
|
+
[[id1]]
|
442
|
+
[NOTE]
|
443
|
+
--
|
444
|
+
|===
|
445
|
+
|a |b
|
446
|
+
|
447
|
+
|c |d
|
448
|
+
|===
|
410
449
|
|
450
|
+
* A
|
451
|
+
* B
|
452
|
+
* C
|
453
|
+
--
|
454
|
+
INPUT
|
455
|
+
#{BLANK_HDR}
|
456
|
+
<sections>
|
457
|
+
<p id="_">
|
458
|
+
<fn reference='1'>
|
459
|
+
<table id='_'>
|
460
|
+
<thead>
|
461
|
+
<tr>
|
462
|
+
<th valign='top' align='left'>a</th>
|
463
|
+
<th valign='top' align='left'>b</th>
|
464
|
+
</tr>
|
465
|
+
</thead>
|
466
|
+
<tbody>
|
467
|
+
<tr>
|
468
|
+
<td valign='top' align='left'>c</td>
|
469
|
+
<td valign='top' align='left'>d</td>
|
470
|
+
</tr>
|
471
|
+
</tbody>
|
472
|
+
</table>
|
473
|
+
<ul id='_'>
|
474
|
+
<li>
|
475
|
+
<p id='_'>A</p>
|
476
|
+
</li>
|
477
|
+
<li>
|
478
|
+
<p id='_'>B</p>
|
479
|
+
</li>
|
480
|
+
<li>
|
481
|
+
<p id='_'>C</p>
|
482
|
+
</li>
|
483
|
+
</ul>
|
484
|
+
</fn>
|
485
|
+
</p>
|
486
|
+
</sections>
|
411
487
|
</standard-document>
|
412
488
|
OUTPUT
|
413
489
|
end
|
414
490
|
|
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
|
491
|
+
it "processes the footnoteblock macro with failed reference" do
|
492
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
449
493
|
#{ASCIIDOC_BLANK_HDR}
|
450
494
|
|
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
|
495
|
+
footnoteblock:[id1]
|
462
496
|
|
463
|
-
|
464
|
-
|
465
|
-
|
497
|
+
[[id2]]
|
498
|
+
[NOTE]
|
499
|
+
--
|
500
|
+
|===
|
501
|
+
|a |b
|
466
502
|
|
467
|
-
|
468
|
-
|
469
|
-
@startuml
|
470
|
-
Alice -> Bob: Authentication Request
|
471
|
-
Bob --> Alice: Authentication Response
|
503
|
+
|c |d
|
504
|
+
|===
|
472
505
|
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
506
|
+
* A
|
507
|
+
* B
|
508
|
+
* C
|
509
|
+
--
|
477
510
|
INPUT
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
511
|
+
#{BLANK_HDR}
|
512
|
+
<sections>
|
513
|
+
<p id='_'>
|
514
|
+
<fn reference='1'>[ERROR]</fn>
|
515
|
+
</p>
|
516
|
+
<note id='id2'>
|
517
|
+
<table id='_'>
|
518
|
+
<thead>
|
519
|
+
<tr>
|
520
|
+
<th valign='top' align='left'>a</th>
|
521
|
+
<th valign='top' align='left'>b</th>
|
522
|
+
</tr>
|
523
|
+
</thead>
|
524
|
+
<tbody>
|
525
|
+
<tr>
|
526
|
+
<td valign='top' align='left'>c</td>
|
527
|
+
<td valign='top' align='left'>d</td>
|
528
|
+
</tr>
|
529
|
+
</tbody>
|
530
|
+
</table>
|
531
|
+
<ul id='_'>
|
532
|
+
<li>
|
533
|
+
<p id='_'>A</p>
|
534
|
+
</li>
|
535
|
+
<li>
|
536
|
+
<p id='_'>B</p>
|
537
|
+
</li>
|
538
|
+
<li>
|
539
|
+
<p id='_'>C</p>
|
540
|
+
</li>
|
541
|
+
</ul>
|
542
|
+
</note>
|
543
|
+
</sections>
|
488
544
|
</standard-document>
|
489
545
|
OUTPUT
|
490
546
|
end
|
491
547
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
548
|
+
describe 'term inline macros' do
|
549
|
+
subject(:convert) do
|
550
|
+
xmlpp(
|
551
|
+
strip_guid(
|
552
|
+
Asciidoctor.convert(
|
553
|
+
input, backend: :standoc, header_footer: true)))
|
554
|
+
end
|
555
|
+
let(:input) do
|
556
|
+
<<~XML
|
557
|
+
#{ASCIIDOC_BLANK_HDR}
|
558
|
+
== Terms and Definitions
|
496
559
|
|
497
|
-
|
498
|
-
....
|
499
|
-
@startuml
|
500
|
-
Alice -> Bob: Authentication Request
|
501
|
-
Bob --> Alice: Authentication Response
|
560
|
+
=== name2
|
502
561
|
|
503
|
-
|
504
|
-
Alice <-- Bob: another authentication Response
|
505
|
-
@enduml
|
506
|
-
....
|
507
|
-
INPUT
|
562
|
+
== Main
|
508
563
|
|
509
|
-
|
510
|
-
|
511
|
-
|
564
|
+
term:[name,name2] is a term
|
565
|
+
XML
|
566
|
+
end
|
567
|
+
let(:output) do
|
568
|
+
<<~XML
|
569
|
+
#{BLANK_HDR}
|
570
|
+
<sections>
|
571
|
+
<terms id='_' obligation='normative'>
|
572
|
+
<title>Terms and definitions</title>
|
573
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
574
|
+
<term id='term-name2'>
|
575
|
+
<preferred>name2</preferred>
|
576
|
+
</term>
|
577
|
+
</terms>
|
578
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
579
|
+
<title>Main</title>
|
580
|
+
<p id='_'>
|
581
|
+
<em>name</em>
|
582
|
+
(
|
583
|
+
<xref target='term-name2'/>
|
584
|
+
) is a term
|
585
|
+
</p>
|
586
|
+
</clause>
|
587
|
+
</sections>
|
588
|
+
</standard-document>
|
589
|
+
XML
|
590
|
+
end
|
512
591
|
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
Alice -> Bob: Authentication Request
|
517
|
-
Bob --> Alice: Authentication Response
|
592
|
+
it 'converts macro into the correct xml' do
|
593
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
594
|
+
end
|
518
595
|
|
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
|
596
|
+
context 'default params' do
|
597
|
+
let(:input) do
|
598
|
+
<<~XML
|
599
|
+
#{ASCIIDOC_BLANK_HDR}
|
600
|
+
|
601
|
+
== Terms and Definitions
|
602
|
+
|
603
|
+
=== name
|
537
604
|
|
538
|
-
|
605
|
+
== Main
|
539
606
|
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
607
|
+
term:[name] is a term
|
608
|
+
XML
|
609
|
+
end
|
610
|
+
let(:output) do
|
611
|
+
<<~XML
|
612
|
+
#{BLANK_HDR}
|
613
|
+
<sections>
|
614
|
+
<terms id='_' obligation='normative'>
|
615
|
+
<title>Terms and definitions</title>
|
616
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
617
|
+
<term id='term-name'>
|
618
|
+
<preferred>name</preferred>
|
619
|
+
</term>
|
620
|
+
</terms>
|
621
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
622
|
+
<title>Main</title>
|
623
|
+
<p id='_'>
|
624
|
+
<em>name</em>
|
625
|
+
(
|
626
|
+
<xref target='term-name' />
|
627
|
+
) is a term
|
628
|
+
</p>
|
629
|
+
</clause>
|
630
|
+
</sections>
|
631
|
+
</standard-document>
|
632
|
+
XML
|
633
|
+
end
|
634
|
+
|
635
|
+
it 'uses `name` as termref name' do
|
636
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
637
|
+
end
|
544
638
|
end
|
545
|
-
end
|
546
639
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
640
|
+
context 'multiply exising ids in document' do
|
641
|
+
let(:input) do
|
642
|
+
<<~XML
|
643
|
+
#{ASCIIDOC_BLANK_HDR}
|
644
|
+
|
645
|
+
== Terms and Definitions
|
646
|
+
|
647
|
+
=== name
|
648
|
+
=== name2
|
649
|
+
|
650
|
+
[[term-name]]
|
651
|
+
== Main
|
552
652
|
|
553
|
-
|
554
|
-
|
555
|
-
|
653
|
+
paragraph
|
654
|
+
|
655
|
+
[[term-name2]]
|
656
|
+
== Second
|
657
|
+
|
658
|
+
term:[name] is a term
|
659
|
+
term:[name2] is a term
|
660
|
+
XML
|
661
|
+
end
|
662
|
+
let(:output) do
|
663
|
+
<<~XML
|
664
|
+
#{BLANK_HDR}
|
665
|
+
<sections>
|
666
|
+
<terms id='_' obligation='normative'>
|
667
|
+
<title>Terms and definitions</title>
|
668
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
669
|
+
<term id='term-name-1'>
|
670
|
+
<preferred>name</preferred>
|
671
|
+
</term>
|
672
|
+
<term id='term-name2-1'>
|
673
|
+
<preferred>name2</preferred>
|
674
|
+
</term>
|
675
|
+
</terms>
|
676
|
+
<clause id='term-name' inline-header='false' obligation='normative'>
|
677
|
+
<title>Main</title>
|
678
|
+
<p id='_'>paragraph</p>
|
679
|
+
</clause>
|
680
|
+
<clause id='term-name2' inline-header='false' obligation='normative'>
|
681
|
+
<title>Second</title>
|
682
|
+
<p id='_'>
|
683
|
+
<em>name</em>
|
684
|
+
(
|
685
|
+
<xref target='term-name-1' />
|
686
|
+
) is a term
|
687
|
+
<em>name2</em>
|
688
|
+
(
|
689
|
+
<xref target='term-name2-1' />
|
690
|
+
) is a term
|
691
|
+
</p>
|
692
|
+
</clause>
|
693
|
+
</sections>
|
694
|
+
</standard-document>
|
695
|
+
XML
|
696
|
+
end
|
697
|
+
|
698
|
+
it 'generates unique ids which do not match existing ids' do
|
699
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
700
|
+
end
|
556
701
|
end
|
557
|
-
|
702
|
+
|
703
|
+
context 'when missing actual ref' do
|
704
|
+
let(:input) do
|
705
|
+
<<~XML
|
706
|
+
#{ASCIIDOC_BLANK_HDR}
|
707
|
+
|
708
|
+
== Terms and Definitions
|
709
|
+
|
710
|
+
=== name identity
|
711
|
+
|
712
|
+
[[name-check]]
|
713
|
+
=== name check
|
714
|
+
|
715
|
+
paragraph
|
716
|
+
|
717
|
+
term:[name check] is a term
|
718
|
+
|
719
|
+
term:[name identity] is a term
|
720
|
+
|
721
|
+
Moreover, term:[missing] is a term
|
722
|
+
XML
|
723
|
+
end
|
724
|
+
let(:output) do
|
725
|
+
<<~XML
|
726
|
+
#{BLANK_HDR}
|
727
|
+
<sections>
|
728
|
+
<terms id='_' obligation='normative'>
|
729
|
+
<title>Terms and definitions</title>
|
730
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
731
|
+
<term id='term-name-identity'>
|
732
|
+
<preferred>name identity</preferred>
|
733
|
+
</term>
|
734
|
+
<term id='name-check'>
|
735
|
+
<preferred>name check</preferred>
|
736
|
+
<definition>
|
737
|
+
<p id='_'>paragraph</p>
|
738
|
+
<p id='_'>
|
739
|
+
<em>name check</em>
|
740
|
+
(
|
741
|
+
<xref target='name-check'/>
|
742
|
+
) is a term
|
743
|
+
</p>
|
744
|
+
<p id='_'>
|
745
|
+
<em>name identity</em>
|
746
|
+
(
|
747
|
+
<xref target='term-name-identity'/>
|
748
|
+
) is a term
|
749
|
+
</p>
|
750
|
+
<p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
|
751
|
+
</p>
|
752
|
+
</definition>
|
753
|
+
</term>
|
754
|
+
</terms>
|
755
|
+
</sections>
|
756
|
+
</standard-document>
|
757
|
+
XML
|
758
|
+
end
|
759
|
+
|
760
|
+
it 'generates unique ids which do not match existing ids' do
|
761
|
+
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
762
|
+
end
|
763
|
+
end
|
764
|
+
|
765
|
+
end
|
766
|
+
|
558
767
|
end
|