metanorma-standoc 2.1.5 → 2.2.1

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