metanorma-standoc 2.2.0 → 2.2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +12 -0
  3. data/lib/metanorma/standoc/blocks.rb +25 -15
  4. data/lib/metanorma/standoc/cleanup_biblio.rb +14 -8
  5. data/lib/metanorma/standoc/cleanup_reqt.rb +3 -136
  6. data/lib/metanorma/standoc/front.rb +6 -1
  7. data/lib/metanorma/standoc/front_contributor.rb +0 -10
  8. data/lib/metanorma/standoc/macros_inline.rb +1 -1
  9. data/lib/metanorma/standoc/reqt.rb +19 -75
  10. data/lib/metanorma/standoc/section.rb +35 -3
  11. data/lib/metanorma/standoc/utils.rb +9 -43
  12. data/lib/metanorma/standoc/validate.rb +1 -69
  13. data/lib/metanorma/standoc/validate_table.rb +91 -0
  14. data/lib/metanorma/standoc/version.rb +1 -1
  15. data/metanorma-standoc.gemspec +2 -2
  16. data/spec/metanorma/biblio_spec.rb +9 -9
  17. data/spec/metanorma/blocks_spec.rb +20 -266
  18. data/spec/metanorma/cleanup_blocks_spec.rb +0 -168
  19. data/spec/metanorma/macros_concept_spec.rb +1033 -0
  20. data/spec/metanorma/macros_spec.rb +1 -1031
  21. data/spec/metanorma/refs_spec.rb +0 -2
  22. data/spec/metanorma/reqt_spec.rb +130 -0
  23. data/spec/metanorma/section_spec.rb +5 -0
  24. data/spec/metanorma/validate_spec.rb +46 -6
  25. data/spec/vcr_cassettes/bsi16341.yml +80 -52
  26. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +94 -94
  27. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
  28. data/spec/vcr_cassettes/hide_refs.yml +74 -74
  29. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  30. data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
  31. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +30 -30
  32. data/spec/vcr_cassettes/isobib_get_123_2.yml +23 -23
  33. data/spec/vcr_cassettes/isobib_get_123_2001.yml +9 -9
  34. data/spec/vcr_cassettes/isobib_get_124.yml +10 -10
  35. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +30 -60
  36. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  37. data/spec/vcr_cassettes/std-link.yml +11 -11
  38. metadata +10 -7
@@ -13,7 +13,7 @@ RSpec.describe Metanorma::Standoc do
13
13
  autonumber:table[3]
14
14
  add:[a <<clause>>] del:[B]
15
15
  identifier:[a http://example.com]
16
- s:category[text]
16
+ span:category[text]
17
17
 
18
18
  [bibliography]
19
19
  == Bibliography
@@ -201,643 +201,6 @@ RSpec.describe Metanorma::Standoc do
201
201
  .to be_equivalent_to xmlpp(output)
202
202
  end
203
203
 
204
- it "processes the Metanorma::Standoc concept and related macros" do
205
- input = <<~INPUT
206
- #{ASCIIDOC_BLANK_HDR}
207
-
208
- {{clause1}}
209
- term:[clause1]
210
- {{clause1,w\[o\]rd}}
211
- term:[clause1,w[o&#93;rd]
212
- {{clause1,w\[o\]rd,term}}
213
- {{blah}}
214
- term:[blah]
215
- {{blah,word}}
216
- term:[blah,word]
217
- {{blah,term,word}}
218
- {{blah,term,word,xref}}
219
- {{blah,term,word,xref,options="noital,noref,nolinkmention,nolinkref"}}
220
- {{blah,term,word,xref,options="ital,ref,linkmention,linkref"}}
221
-
222
- related:contrast[blah]
223
-
224
- [[clause1]]
225
- == Clause
226
- Terms are defined here
227
- INPUT
228
- output = <<~OUTPUT
229
- #{BLANK_HDR}
230
- <preface>
231
- <foreword id='_' obligation='informative'>
232
- <title>Foreword</title>
233
- <p id='_'>
234
- <concept>
235
- <strong>
236
- term
237
- <tt>clause1</tt>
238
- not resolved via ID
239
- <tt>clause1</tt>
240
- </strong>
241
- </concept>
242
- <concept>
243
- <strong>
244
- term
245
- <tt>clause1</tt>
246
- not resolved via ID
247
- <tt>clause1</tt>
248
- </strong>
249
- </concept>
250
- <concept>
251
- <strong>
252
- term
253
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
254
- not resolved via ID
255
- <tt>clause1</tt>
256
- </strong>
257
- </concept>
258
- <concept>
259
- <strong>
260
- term
261
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
262
- not resolved via ID
263
- <tt>clause1</tt>
264
- </strong>
265
- </concept>
266
- <concept>
267
- <strong>
268
- term
269
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
270
- not resolved via ID
271
- <tt>clause1</tt>
272
- </strong>
273
- </concept>
274
- <concept>
275
- <strong>
276
- term
277
- <tt>blah</tt>
278
- not resolved via ID
279
- <tt>blah</tt>
280
- </strong>
281
- </concept>
282
- <concept>
283
- <strong>
284
- term
285
- <tt>blah</tt>
286
- not resolved via ID
287
- <tt>blah</tt>
288
- </strong>
289
- </concept>
290
- <concept>
291
- <strong>
292
- term
293
- <tt>blah</tt>
294
- , display
295
- <tt>word</tt>
296
- not resolved via ID
297
- <tt>blah</tt>
298
- </strong>
299
- </concept>
300
- <concept>
301
- <strong>
302
- term
303
- <tt>blah</tt>
304
- , display
305
- <tt>word</tt>
306
- not resolved via ID
307
- <tt>blah</tt>
308
- </strong>
309
- </concept>
310
- <concept>
311
- <strong>
312
- term
313
- <tt>blah</tt>
314
- , display
315
- <tt>term</tt>
316
- not resolved via ID
317
- <tt>blah</tt>
318
- </strong>
319
- </concept>
320
- <concept>
321
- <strong>
322
- term
323
- <tt>blah</tt>
324
- , display
325
- <tt>term</tt>
326
- not resolved via ID
327
- <tt>blah</tt>
328
- </strong>
329
- </concept>
330
- <concept ital='false' ref='false' linkmention='false' linkref='false'>
331
- <strong>
332
- term
333
- <tt>blah</tt>
334
- , display
335
- <tt>term</tt>
336
- not resolved via ID
337
- <tt>blah</tt>
338
- </strong>
339
- </concept>
340
- <concept ital='true' ref='true' linkmention='true' linkref='true'>
341
- <strong>
342
- term
343
- <tt>blah</tt>
344
- , display
345
- <tt>term</tt>
346
- not resolved via ID
347
- <tt>blah</tt>
348
- </strong>
349
- </concept>
350
- </p>
351
- <related type='contrast'>
352
- <strong>
353
- term
354
- <tt>blah</tt>
355
- not resolved via ID
356
- <tt>blah</tt>
357
- </strong>
358
- </related>
359
- </foreword>
360
- </preface>
361
- <sections>
362
- <clause id='clause1' inline-header='false' obligation='normative'>
363
- <title>Clause</title>
364
- <p id='_'>Terms are defined here</p>
365
- </clause>
366
- </sections>
367
- </standard-document>
368
- OUTPUT
369
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
370
- .to be_equivalent_to xmlpp(output)
371
- end
372
-
373
- it "processes the Metanorma::Standoc concept macros for acronyms" do
374
- input = <<~INPUT
375
- #{ASCIIDOC_BLANK_HDR}
376
-
377
- {{Clause1}}
378
- {{Clause1,Clause 1}}
379
- {{Clause 2}}
380
- {{Clause 2,Clause 1}}
381
- {{<<Clause2>>,Clause 2}}
382
-
383
- symbol:[Clause1]
384
- symbol:[Clause1,word]
385
- symbol:[Clause 2]
386
- symbol:[Clause 2,word]
387
-
388
- {{<<Clause2>>,word}}
389
- {{<<Clause2>>,word,term}}
390
- {{<<Clause2>>,word,term,xref}}
391
- {{<<Clause2>>,word,term,xref,options="noital,noref,nolinkmention,nolinkref"}}
392
- {{<<Clause2>>,word,term,xref,options="ital,ref,linkmention,linkref"}}
393
-
394
- == Terms and definitions
395
- === Clause1
396
- == Symbols and Abbreviated Terms
397
- Clause1:: A
398
- [[Clause2]]Clause 2:: C
399
- INPUT
400
- output = <<~OUTPUT
401
- #{BLANK_HDR}
402
- <preface>
403
- <foreword id='_' obligation='informative'>
404
- <title>Foreword</title>
405
- <p id='_'>
406
- <concept>
407
- <refterm>Clause1</refterm>
408
- <renderterm>Clause1</renderterm>
409
- <xref target='term-Clause1'/>
410
- </concept>
411
- <concept>
412
- <refterm>Clause1</refterm>
413
- <renderterm>Clause 1</renderterm>
414
- <xref target='term-Clause1'/>
415
- </concept>
416
- <concept>
417
- <refterm>Clause 2</refterm>
418
- <renderterm>Clause 2</renderterm>
419
- <xref target='Clause2'/>
420
- </concept>
421
- <concept>
422
- <refterm>Clause 2</refterm>
423
- <renderterm>Clause 1</renderterm>
424
- <xref target='Clause2'/>
425
- </concept>
426
- <concept>
427
- <refterm>Clause 2</refterm>
428
- <renderterm>Clause 2</renderterm>
429
- <xref target='Clause2'/>
430
- </concept>
431
- </p><p id="_">
432
- <concept>
433
- <refterm>Clause1</refterm>
434
- <renderterm>Clause1</renderterm>
435
- <xref target='symbol-Clause1'/>
436
- </concept>
437
- <concept>
438
- <refterm>Clause1</refterm>
439
- <renderterm>word</renderterm>
440
- <xref target='symbol-Clause1'/>
441
- </concept>
442
- <concept>
443
- <refterm>Clause 2</refterm>
444
- <renderterm>Clause 2</renderterm>
445
- <xref target='Clause2'/>
446
- </concept>
447
- <concept>
448
- <refterm>Clause 2</refterm>
449
- <renderterm>word</renderterm>
450
- <xref target='Clause2'/>
451
- </concept>
452
- </p><p id="_">
453
- <concept>
454
- <refterm>word</refterm>
455
- <renderterm>word</renderterm>
456
- <xref target='Clause2'/>
457
- </concept>
458
- <concept>
459
- <refterm>word</refterm>
460
- <renderterm>term</renderterm>
461
- <xref target='Clause2'/>
462
- </concept>
463
- <concept>
464
- <refterm>word</refterm>
465
- <renderterm>term</renderterm>
466
- <xref target='Clause2'>xref</xref>
467
- </concept>
468
- <concept ital='false' ref='false' linkmention='false' linkref='false'>
469
- <refterm>word</refterm>
470
- <renderterm>term</renderterm>
471
- <xref target='Clause2'>xref</xref>
472
- </concept>
473
- <concept ital='true' ref='true' linkmention='true' linkref='true'>
474
- <refterm>word</refterm>
475
- <renderterm>term</renderterm>
476
- <xref target='Clause2'>xref</xref>
477
- </concept>
478
- </p>
479
- </foreword>
480
- </preface>
481
- <sections>
482
- <terms id='_' obligation='normative'>
483
- <title>Terms and definitions</title>
484
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
485
- <term id='term-Clause1'>
486
- <preferred><expression><name>Clause1</name></expression></preferred>
487
- </term>
488
- </terms>
489
- <definitions id='_' obligation='normative'>
490
- <title>Symbols and abbreviated terms</title>
491
- <dl id='_'>
492
- <dt id="symbol-Clause1">Clause1</dt>
493
- <dd>
494
- <p id='_'>A</p>
495
- </dd>
496
- <dt id='Clause2'>Clause 2</dt>
497
- <dd>
498
- <p id='_'>C</p>
499
- </dd>
500
- </dl>
501
- </definitions>
502
- </sections>
503
- </standard-document>
504
- OUTPUT
505
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
506
- .to be_equivalent_to xmlpp(output)
507
- end
508
-
509
- it "processes the concept and related macros with xrefs" do
510
- input = <<~INPUT
511
- #{ASCIIDOC_BLANK_HDR}
512
- {{<<clause1>>}}
513
- {{<<clause1>>,w\[o\]rd}}
514
- {{<<clause1>>,term,w\[o\]rd}}
515
- {{<<clause1>>,term,w\[o\]rd,Clause #1}}
516
-
517
- related:supersedes[<<clause1>>,term]
518
-
519
- [[clause1]]
520
- == Clause
521
- Terms are defined here
522
- INPUT
523
- output = <<~OUTPUT
524
- #{BLANK_HDR}
525
- <preface>
526
- <foreword id='_' obligation='informative'>
527
- <title>Foreword</title>
528
- <p id='_'>
529
- <concept>
530
- <xref target='clause1'/>
531
- </concept>
532
- <concept>
533
- <refterm>w[o]rd</refterm>
534
- <renderterm>w[o]rd</renderterm>
535
- <xref target='clause1'/>
536
- </concept>
537
- <concept>
538
- <refterm>term</refterm>
539
- <renderterm>w[o]rd</renderterm>
540
- <xref target='clause1'/>
541
- </concept>
542
- <concept>
543
- <refterm>term</refterm>
544
- <renderterm>w[o]rd</renderterm>
545
- <xref target='clause1'>Clause #1</xref>
546
- </concept>
547
- </p>
548
- <related type='supersedes'>
549
- <preferred>
550
- <expression>
551
- <name>term</name>
552
- </expression>
553
- </preferred>
554
- <xref target='clause1'/>
555
- </related>
556
- </foreword>
557
- </preface>
558
- <sections>
559
- <clause id='clause1' inline-header='false' obligation='normative'>
560
- <title>Clause</title>
561
- <p id='_'>Terms are defined here</p>
562
- </clause>
563
- </sections>
564
- </standard-document>
565
- OUTPUT
566
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
567
- .to be_equivalent_to xmlpp(output)
568
- end
569
-
570
- it "processes the concept and related macros with erefs" do
571
- input = <<~INPUT
572
- #{ASCIIDOC_BLANK_HDR}
573
- {{<<blah>>}}
574
- {{<<blah>>,word}}
575
- {{<<blah>>,term,word}}
576
- {{<<blah>>,term,word,Clause #1}}
577
- {{<<blah,clause=3.1>>}}
578
- {{<<blah,clause=3.1>>,word}}
579
- {{<<blah,clause=3.1>>,term,word}}
580
- {{<<blah,clause=3.1,figure=a>>}}
581
- {{<<blah,clause=3.1,figure=a>>,word}}
582
- {{<<blah,clause=3.1,figure=a>>,term,word,Clause #1}}
583
-
584
- related:narrower[<<blah,clause=3.1,figure=a>>,term]
585
-
586
- [bibliography]
587
- == Bibliography
588
- * [[[blah,blah]]] _Blah_
589
- INPUT
590
- output = <<~OUTPUT
591
- #{BLANK_HDR}
592
- <preface>
593
- <foreword id='_' obligation='informative'>
594
- <title>Foreword</title>
595
- <p id='_'>
596
- <concept>
597
- <eref bibitemid='blah'/>
598
- </concept>
599
- <concept>
600
- <refterm>word</refterm>
601
- <renderterm>word</renderterm>
602
- <eref bibitemid='blah'/>
603
- </concept>
604
- <concept>
605
- <refterm>term</refterm>
606
- <renderterm>word</renderterm>
607
- <eref bibitemid='blah'/>
608
- </concept>
609
- <concept>
610
- <refterm>term</refterm>
611
- <renderterm>word</renderterm>
612
- <eref bibitemid='blah'>Clause #1</eref>
613
- </concept>
614
- <concept>
615
- <eref bibitemid='blah'>
616
- <localityStack>
617
- <locality type='clause'>
618
- <referenceFrom>3.1</referenceFrom>
619
- </locality>
620
- </localityStack>
621
- </eref>
622
- </concept>
623
- <concept>
624
- <refterm>word</refterm>
625
- <renderterm>word</renderterm>
626
- <eref bibitemid='blah'>
627
- <localityStack>
628
- <locality type='clause'>
629
- <referenceFrom>3.1</referenceFrom>
630
- </locality>
631
- </localityStack>
632
- </eref>
633
- </concept>
634
- <concept>
635
- <refterm>term</refterm>
636
- <renderterm>word</renderterm>
637
- <eref bibitemid='blah'>
638
- <localityStack>
639
- <locality type='clause'>
640
- <referenceFrom>3.1</referenceFrom>
641
- </locality>
642
- </localityStack>
643
- </eref>
644
- </concept>
645
- <concept>
646
- <eref bibitemid='blah'>
647
- <localityStack>
648
- <locality type='clause'>
649
- <referenceFrom>3.1</referenceFrom>
650
- </locality>
651
- <locality type='figure'>
652
- <referenceFrom>a</referenceFrom>
653
- </locality>
654
- </localityStack>
655
- </eref>
656
- </concept>
657
- <concept>
658
- <refterm>word</refterm>
659
- <renderterm>word</renderterm>
660
- <eref bibitemid='blah'>
661
- <localityStack>
662
- <locality type='clause'>
663
- <referenceFrom>3.1</referenceFrom>
664
- </locality>
665
- <locality type='figure'>
666
- <referenceFrom>a</referenceFrom>
667
- </locality>
668
- </localityStack>
669
- </eref>
670
- </concept>
671
- <concept>
672
- <refterm>term</refterm>
673
- <renderterm>word</renderterm>
674
- <eref bibitemid='blah'>
675
- <localityStack>
676
- <locality type='clause'>
677
- <referenceFrom>3.1</referenceFrom>
678
- </locality>
679
- <locality type='figure'>
680
- <referenceFrom>a</referenceFrom>
681
- </locality>
682
- </localityStack>
683
- Clause #1
684
- </eref>
685
- </concept>
686
- </p>
687
- <related type='narrower'>
688
- <preferred>
689
- <expression>
690
- <name>term</name>
691
- </expression>
692
- </preferred>
693
- <eref bibitemid='blah'>
694
- <localityStack>
695
- <locality type='clause'>
696
- <referenceFrom>3.1</referenceFrom>
697
- </locality>
698
- <locality type='figure'>
699
- <referenceFrom>a</referenceFrom>
700
- </locality>
701
- </localityStack>
702
- </eref>
703
- </related>
704
- </foreword>
705
- </preface>
706
- <sections> </sections>
707
- <bibliography>
708
- <references id='_' normative='false' obligation='informative'>
709
- <title>Bibliography</title>
710
- <bibitem id='blah'>
711
- <formattedref format='application/x-isodoc+xml'>
712
- <em>Blah</em>
713
- </formattedref>
714
- <docidentifier>blah</docidentifier>
715
- </bibitem>
716
- </references>
717
- </bibliography>
718
- </standard-document>
719
- OUTPUT
720
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
721
- .to be_equivalent_to xmlpp(output)
722
- end
723
-
724
- it "processes the concept and related macros with termbase" do
725
- input = <<~INPUT
726
- #{ASCIIDOC_BLANK_HDR}
727
- {{<<IEV:135-13-13>>}}
728
- {{<<IEV:135-13-13>>,word}}
729
- {{<<IEV:135-13-13>>,term,word}}
730
- {{<<IEV:135-13-13>>,term,word,Clause #1}}
731
-
732
- related:see[<<IEV:135-13-13>>,term]
733
- INPUT
734
- output = <<~OUTPUT
735
- #{BLANK_HDR}
736
- <sections>
737
- <p id='_'>
738
- <concept>
739
- <termref base='IEV' target='135-13-13'/>
740
- </concept>
741
- <concept>
742
- <refterm>word</refterm>
743
- <renderterm>word</renderterm>
744
- <termref base='IEV' target='135-13-13'/>
745
- </concept>
746
- <concept>
747
- <refterm>term</refterm>
748
- <renderterm>word</renderterm>
749
- <termref base='IEV' target='135-13-13'/>
750
- </concept>
751
- <concept>
752
- <refterm>term</refterm>
753
- <renderterm>word</renderterm>
754
- <termref base='IEV' target='135-13-13'>Clause #1</termref>
755
- </concept>
756
- </p>
757
- <related type='see'>
758
- <preferred>
759
- <expression>
760
- <name>term</name>
761
- </expression>
762
- </preferred>
763
- <termref base='IEV' target='135-13-13'/>
764
- </related>
765
- </sections>
766
- </standard-document>
767
- OUTPUT
768
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
769
- .to be_equivalent_to xmlpp(output)
770
- end
771
-
772
- it "processes the concept macros with disambiguation for math symbols" do
773
- input = <<~INPUT
774
- #{ASCIIDOC_BLANK_HDR}
775
- [[clause1]]
776
-
777
- == Symbols and Abbreviated Terms
778
- stem:[|~ x ~|]:: A function that returns the smallest integer greater than or equal to stem:[x]; also known as the _ceiling_ function.
779
- stem:[|__ x __|]:: A function that returns the largest integer less than or equal to stem:[x]; also known as the _floor_ function.
780
- INPUT
781
- output = <<~OUTPUT
782
- #{BLANK_HDR}
783
- <sections>
784
- <definitions id='clause1' obligation='normative'>
785
- <title>Symbols and abbreviated terms</title>
786
- <dl id='_'>
787
- <dt id='symbol-__x230a_-x-__x230b_'>
788
- <stem type='MathML'>
789
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
790
- <mo>&#8970;</mo>
791
- <mi>x</mi>
792
- <mo>&#8971;</mo>
793
- </math>
794
- </stem>
795
- </dt>
796
- <dd>
797
- <p id='_'>
798
- A function that returns the largest integer less than or equal to
799
- <stem type='MathML'>
800
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
801
- <mi>x</mi>
802
- </math>
803
- </stem>
804
- ; also known as the
805
- <em>floor</em>
806
- function.
807
- </p>
808
- </dd>
809
- <dt id='symbol-__x2308_-x-__x2309_'>
810
- <stem type='MathML'>
811
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
812
- <mo>&#8968;</mo>
813
- <mi>x</mi>
814
- <mo>&#8969;</mo>
815
- </math>
816
- </stem>
817
- </dt>
818
- <dd>
819
- <p id='_'>
820
- A function that returns the smallest integer greater than or equal
821
- to
822
- <stem type='MathML'>
823
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
824
- <mi>x</mi>
825
- </math>
826
- </stem>
827
- ; also known as the
828
- <em>ceiling</em>
829
- function.
830
- </p>
831
- </dd>
832
- </dl>
833
- </definitions>
834
- </sections>
835
- </standard-document>
836
- OUTPUT
837
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
838
- .to be_equivalent_to xmlpp(output)
839
- end
840
-
841
204
  it "processes the TODO custom admonition" do
842
205
  input = <<~INPUT
843
206
  #{ASCIIDOC_BLANK_HDR}
@@ -1805,399 +1168,6 @@ RSpec.describe Metanorma::Standoc do
1805
1168
  end
1806
1169
  end
1807
1170
 
1808
- describe "term inline macros" do
1809
- subject(:convert) do
1810
- xmlpp(
1811
- strip_guid(
1812
- Asciidoctor.convert(
1813
- input, *OPTIONS
1814
- ),
1815
- ),
1816
- )
1817
- end
1818
- let(:input) do
1819
- <<~XML
1820
- #{ASCIIDOC_BLANK_HDR}
1821
- == Terms and Definitions
1822
-
1823
- === name
1824
-
1825
- == Main
1826
-
1827
- term:[name,name2] is a term
1828
-
1829
- {{name,name2}} is a term
1830
-
1831
- related:equivalent[name]
1832
- XML
1833
- end
1834
- let(:output) do
1835
- <<~XML
1836
- #{BLANK_HDR}
1837
- <sections>
1838
- <terms id='_' obligation='normative'>
1839
- <title>Terms and definitions</title>
1840
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1841
- <term id='term-name'>
1842
- <preferred><expression><name>name</name></expression></preferred>
1843
- </term>
1844
- </terms>
1845
- <clause id='_' inline-header='false' obligation='normative'>
1846
- <title>Main</title>
1847
- <p id='_'>
1848
- <concept>
1849
- <refterm>name</refterm>
1850
- <renderterm>name2</renderterm>
1851
- <xref target='term-name'/>
1852
- </concept>
1853
- is a term
1854
- </p>
1855
- <p id='_'>
1856
- <concept>
1857
- <refterm>name</refterm>
1858
- <renderterm>name2</renderterm>
1859
- <xref target='term-name'/>
1860
- </concept>
1861
- is a term
1862
- </p>
1863
- <related type='equivalent'>
1864
- <preferred>
1865
- <expression>
1866
- <name>name</name>
1867
- </expression>
1868
- </preferred>
1869
- <xref target='term-name'>name</xref>
1870
- </related>
1871
- </clause>
1872
- </sections>
1873
- </standard-document>
1874
- XML
1875
- end
1876
-
1877
- it "converts macro into the correct xml" do
1878
- expect(convert).to(be_equivalent_to(xmlpp(output)))
1879
- end
1880
-
1881
- context "default params" do
1882
- let(:input) do
1883
- <<~XML
1884
- #{ASCIIDOC_BLANK_HDR}
1885
-
1886
- == Terms and Definitions
1887
-
1888
- === name
1889
-
1890
- == Main
1891
-
1892
- term:[name] is a term
1893
-
1894
- {{name}} is a term
1895
- XML
1896
- end
1897
- let(:output) do
1898
- <<~XML
1899
- #{BLANK_HDR}
1900
- <sections>
1901
- <terms id='_' obligation='normative'>
1902
- <title>Terms and definitions</title>
1903
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1904
- <term id='term-name'>
1905
- <preferred><expression><name>name</name></expression></preferred>
1906
- </term>
1907
- </terms>
1908
- <clause id='_' inline-header='false' obligation='normative'>
1909
- <title>Main</title>
1910
- <p id='_'>
1911
- <concept>
1912
- <refterm>name</refterm>
1913
- <renderterm>name</renderterm>
1914
- <xref target='term-name'/>
1915
- </concept>
1916
- is a term
1917
- </p>
1918
- <p id='_'>
1919
- <concept>
1920
- <refterm>name</refterm>
1921
- <renderterm>name</renderterm>
1922
- <xref target='term-name'/>
1923
- </concept>
1924
- is a term
1925
- </p>
1926
- </clause>
1927
- </sections>
1928
- </standard-document>
1929
- XML
1930
- end
1931
-
1932
- it "uses `name` as termref name" do
1933
- expect(convert).to(be_equivalent_to(xmlpp(output)))
1934
- end
1935
- end
1936
-
1937
- context "terms with index terms" do
1938
- let(:input) do
1939
- <<~XML
1940
- #{ASCIIDOC_BLANK_HDR}
1941
-
1942
- == Terms and Definitions
1943
-
1944
- === name(((name)))
1945
-
1946
- == Main
1947
-
1948
- term:[name] is a term
1949
-
1950
- {{name}} is a term
1951
- XML
1952
- end
1953
- let(:output) do
1954
- <<~XML
1955
- #{BLANK_HDR}
1956
- <sections>
1957
- <terms id='_' obligation='normative'>
1958
- <title>Terms and definitions</title>
1959
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1960
- <term id='term-name'>
1961
- <preferred><expression><name>name
1962
- <index>
1963
- <primary>name</primary>
1964
- </index>
1965
- </name>
1966
- </expression></preferred>
1967
- </term>
1968
- </terms>
1969
- <clause id='_' inline-header='false' obligation='normative'>
1970
- <title>Main</title>
1971
- <p id='_'>
1972
- <concept>
1973
- <refterm>name</refterm>
1974
- <renderterm>name</renderterm>
1975
- <xref target='term-name'/>
1976
- </concept>
1977
- is a term
1978
- </p>
1979
- <p id='_'>
1980
- <concept>
1981
- <refterm>name</refterm>
1982
- <renderterm>name</renderterm>
1983
- <xref target='term-name'/>
1984
- </concept>
1985
- is a term
1986
- </p>
1987
- </clause>
1988
- </sections>
1989
- </standard-document>
1990
- XML
1991
- end
1992
-
1993
- it "strips index terms in terms anchors" do
1994
- expect(convert).to(be_equivalent_to(xmlpp(output)))
1995
- end
1996
- end
1997
-
1998
- context "multiply exising ids in document" do
1999
- let(:input) do
2000
- <<~XML
2001
- #{ASCIIDOC_BLANK_HDR}
2002
-
2003
- == Terms and Definitions
2004
-
2005
- === name
2006
- === name2
2007
-
2008
- [[term-name]]
2009
- == Main
2010
-
2011
- paragraph
2012
-
2013
- [[term-name2]]
2014
- == Second
2015
-
2016
- term:[name] is a term
2017
- term:[name2] is a term
2018
- {{name}} is a term
2019
- {{name2}} is a term
2020
- XML
2021
- end
2022
- let(:output) do
2023
- <<~XML
2024
- #{BLANK_HDR}
2025
- <sections>
2026
- <terms id='_' obligation='normative'>
2027
- <title>Terms and definitions</title>
2028
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2029
- <term id='term-name-1'>
2030
- <preferred><expression><name>name</name></expression></preferred>
2031
- </term>
2032
- <term id='term-name2-1'>
2033
- <preferred><expression><name>name2</name></expression></preferred>
2034
- </term>
2035
- </terms>
2036
- <clause id='term-name' inline-header='false' obligation='normative'>
2037
- <title>Main</title>
2038
- <p id='_'>paragraph</p>
2039
- </clause>
2040
- <clause id='term-name2' inline-header='false' obligation='normative'>
2041
- <title>Second</title>
2042
- <p id='_'>
2043
- <concept>
2044
- <refterm>name</refterm>
2045
- <renderterm>name</renderterm>
2046
- <xref target='term-name-1'/>
2047
- </concept>
2048
- is a term
2049
- <concept>
2050
- <refterm>name2</refterm>
2051
- <renderterm>name2</renderterm>
2052
- <xref target='term-name2-1'/>
2053
- </concept>
2054
- is a term
2055
- <concept>
2056
- <refterm>name</refterm>
2057
- <renderterm>name</renderterm>
2058
- <xref target='term-name-1'/>
2059
- </concept>
2060
- is a term
2061
- <concept>
2062
- <refterm>name2</refterm>
2063
- <renderterm>name2</renderterm>
2064
- <xref target='term-name2-1'/>
2065
- </concept>
2066
- is a term
2067
- </p>
2068
- </clause>
2069
- </sections>
2070
- </standard-document>
2071
- XML
2072
- end
2073
-
2074
- it "generates unique ids which do not match existing ids" do
2075
- expect(convert).to(be_equivalent_to(xmlpp(output)))
2076
- end
2077
- end
2078
-
2079
- context "when missing actual ref" do
2080
- let(:input) do
2081
- <<~XML
2082
- #{ASCIIDOC_BLANK_HDR}
2083
-
2084
- == Terms and Definitions
2085
-
2086
- === name identity
2087
-
2088
- [[name-check]]
2089
- === name check
2090
-
2091
- paragraph
2092
-
2093
- term:[name check] is a term
2094
-
2095
- term:[name identity] is a term
2096
-
2097
- Moreover, term:[missing] is a term
2098
-
2099
-
2100
- {{name check}} is a term
2101
-
2102
- {{name identity}} is a term
2103
-
2104
- Moreover, {{missing}} is a term
2105
-
2106
- related:equivalent[missing]
2107
- XML
2108
- end
2109
- let(:output) do
2110
- <<~XML
2111
- #{BLANK_HDR}
2112
- <sections>
2113
- <terms id='_' obligation='normative'>
2114
- <title>Terms and definitions</title>
2115
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2116
- <term id='term-name-identity'>
2117
- <preferred><expression><name>name identity</name></expression></preferred>
2118
- </term>
2119
- <term id='name-check'>
2120
- <preferred><expression><name>name check</name></expression></preferred>
2121
- <related type='equivalent'>
2122
- <strong>
2123
- term
2124
- <tt>missing</tt>
2125
- not resolved via ID
2126
- <tt>missing</tt>
2127
- </strong>
2128
- </related>
2129
- <definition><verbal-definition>
2130
- <p id='_'>paragraph</p>
2131
- <p id='_'>
2132
- <concept>
2133
- <refterm>name check</refterm>
2134
- <renderterm>name check</renderterm>
2135
- <xref target='name-check'/>
2136
- </concept>
2137
- is a term
2138
- </p>
2139
- <p id='_'>
2140
- <concept>
2141
- <refterm>name identity</refterm>
2142
- <renderterm>name identity</renderterm>
2143
- <xref target='term-name-identity'/>
2144
- </concept>
2145
- is a term
2146
- </p>
2147
- <p id='_'>
2148
- Moreover,
2149
- <concept>
2150
- <strong>
2151
- term
2152
- <tt>missing</tt>
2153
- not resolved via ID
2154
- <tt>missing</tt>
2155
- </strong>
2156
- </concept>
2157
- is a term
2158
- </p>
2159
- <p id='_'>
2160
- <concept>
2161
- <refterm>name check</refterm>
2162
- <renderterm>name check</renderterm>
2163
- <xref target='name-check'/>
2164
- </concept>
2165
- is a term
2166
- </p>
2167
- <p id='_'>
2168
- <concept>
2169
- <refterm>name identity</refterm>
2170
- <renderterm>name identity</renderterm>
2171
- <xref target='term-name-identity'/>
2172
- </concept>
2173
- is a term
2174
- </p>
2175
- <p id='_'>
2176
- Moreover,
2177
- <concept>
2178
- <strong>
2179
- term
2180
- <tt>missing</tt>
2181
- not resolved via ID
2182
- <tt>missing</tt>
2183
- </strong>
2184
- </concept>
2185
- is a term
2186
- </p>
2187
- </verbal-definition></definition>
2188
- </term>
2189
- </terms>
2190
- </sections>
2191
- </standard-document>
2192
- XML
2193
- end
2194
-
2195
- it "generates unique ids which do not match existing ids" do
2196
- expect(convert).to(be_equivalent_to(xmlpp(output)))
2197
- end
2198
- end
2199
- end
2200
-
2201
1171
  describe "lutaml_figure macro" do
2202
1172
  let(:example_file) { fixtures_path("test.xmi") }
2203
1173
  let(:input) do