metanorma-standoc 1.10.6 → 1.11.0.1

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +19 -23
  3. data/Rakefile +1 -1
  4. data/lib/asciidoctor/standoc/base.rb +10 -17
  5. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  6. data/lib/asciidoctor/standoc/blocks.rb +23 -23
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  8. data/lib/asciidoctor/standoc/cleanup.rb +46 -12
  9. data/lib/asciidoctor/standoc/cleanup_block.rb +3 -71
  10. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +42 -106
  12. data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
  13. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  14. data/lib/asciidoctor/standoc/cleanup_reqt.rb +5 -24
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +5 -5
  16. data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
  17. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  18. data/lib/asciidoctor/standoc/cleanup_terms.rb +37 -77
  19. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +162 -0
  20. data/lib/asciidoctor/standoc/cleanup_text.rb +5 -2
  21. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  22. data/lib/asciidoctor/standoc/converter.rb +14 -0
  23. data/lib/asciidoctor/standoc/inline.rb +7 -5
  24. data/lib/asciidoctor/standoc/isodoc.rng +419 -77
  25. data/lib/asciidoctor/standoc/lists.rb +15 -15
  26. data/lib/asciidoctor/standoc/macros.rb +14 -43
  27. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  28. data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
  29. data/lib/asciidoctor/standoc/macros_terms.rb +55 -8
  30. data/lib/asciidoctor/standoc/ref_sect.rb +26 -18
  31. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  32. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
  33. data/lib/asciidoctor/standoc/terms.rb +12 -2
  34. data/lib/asciidoctor/standoc/utils.rb +36 -23
  35. data/lib/asciidoctor/standoc/validate.rb +45 -27
  36. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  37. data/lib/metanorma/standoc/version.rb +1 -1
  38. data/metanorma-standoc.gemspec +1 -1
  39. data/spec/asciidoctor/base_spec.rb +4 -36
  40. data/spec/asciidoctor/blank_spec.rb +37 -0
  41. data/spec/asciidoctor/blocks_spec.rb +208 -49
  42. data/spec/asciidoctor/cleanup_sections_spec.rb +153 -12
  43. data/spec/asciidoctor/cleanup_spec.rb +104 -285
  44. data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
  45. data/spec/asciidoctor/inline_spec.rb +38 -2
  46. data/spec/asciidoctor/lists_spec.rb +6 -6
  47. data/spec/asciidoctor/macros_plantuml_spec.rb +37 -2
  48. data/spec/asciidoctor/macros_spec.rb +191 -114
  49. data/spec/asciidoctor/refs_spec.rb +12 -30
  50. data/spec/asciidoctor/section_spec.rb +18 -18
  51. data/spec/asciidoctor/validate_spec.rb +87 -2
  52. data/spec/fixtures/datamodel_description_sections_tree.xml +3 -2
  53. data/spec/spec_helper.rb +6 -7
  54. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
  55. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  56. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  57. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  58. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  59. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  60. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  61. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  62. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -49
  63. metadata +12 -5
@@ -0,0 +1,990 @@
1
+ require "spec_helper"
2
+ require "relaton_iec"
3
+ require "fileutils"
4
+
5
+ RSpec.describe Asciidoctor::Standoc do
6
+ it "processes term and designation metadata and term sources" do
7
+ input = <<~INPUT
8
+ #{ASCIIDOC_BLANK_HDR}
9
+ == Terms and Definitions
10
+
11
+ === First Designation
12
+
13
+ [%metadata]
14
+ language:: fr
15
+ script:: Latn
16
+ type:: prefix
17
+ isInternational:: true
18
+ abbreviationType:: acronym
19
+ pronunciation:: fəɹst
20
+ domain:: Hydraulics
21
+ subject:: pipes
22
+ usageinfo:: This is usage.
23
+
24
+ [.source]
25
+ <<ISO2191,section=1>>
26
+
27
+ alt:[Third Designation]
28
+
29
+ [%metadata]
30
+ language:: he
31
+ script:: Hebr
32
+ type:: suffix
33
+ domain:: Hydraulics1
34
+ subject: pipes1
35
+ usageinfo:: This is usage 1.
36
+ absent:: true
37
+
38
+ deprecated:[Fourth Designation]
39
+
40
+ [%metadata]
41
+ language:: jp
42
+ script:: Japn
43
+ type:: full
44
+ grammar::
45
+ gender::: masculine, feminine
46
+ isPreposition::: false
47
+ isNoun::: true
48
+ grammarValue::: irregular declension
49
+ geographicArea:: AUS
50
+
51
+ related:see[<<second>>,Fifth Designation]
52
+
53
+ [%metadata]
54
+ type:: abbreviation
55
+ grammar::
56
+ gender::: neuter
57
+ isVerb::: true
58
+ geographicArea:: GRC
59
+
60
+ [.source]
61
+ <<ISO2191,section=2>>
62
+
63
+ Definition
64
+
65
+ [.source]
66
+ <<ISO2191,section=3>>
67
+
68
+ [[second]]
69
+ === Second Term
70
+
71
+ [%metadata]
72
+ usageinfo::
73
+ +
74
+ --
75
+ Usage Info 1.
76
+
77
+ Usage Info 2.
78
+ --
79
+
80
+ INPUT
81
+ output = <<~OUTPUT
82
+ #{BLANK_HDR}
83
+ <sections>
84
+ <terms id='_' obligation='normative'>
85
+ <title>Terms and definitions</title>
86
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
87
+ <term id='term-first-designation'>
88
+ <preferred language='fr' script='Latn' type='prefix' isInternational="true">
89
+ <expression>
90
+ <name>First Designation</name>
91
+ <abbreviationType>acronym</abbreviationType>
92
+ <pronunciation>f&#601;&#633;st</pronunciation>
93
+ </expression>
94
+ <termsource status='identical' type='authoritative'>
95
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
96
+ <localityStack>
97
+ <locality type='section'>
98
+ <referenceFrom>1</referenceFrom>
99
+ </locality>
100
+ </localityStack>
101
+ </origin>
102
+ </termsource>
103
+ </preferred>
104
+ <admitted language='he' script='Hebr' type='suffix' absent="true">
105
+ <expression>
106
+ <name>Third Designation</name>
107
+ </expression>
108
+ </admitted>
109
+ <deprecates language='jp' script='Japn' type='full' geographicArea="AUS">
110
+ <expression>
111
+ <name>Fourth Designation</name>
112
+ <grammar>
113
+ <gender>masculine</gender>
114
+ <gender>feminine</gender>
115
+ <isPreposition>false</isPreposition>
116
+ <isNoun>true</isNoun>
117
+ <grammarValue>irregular declension</grammarValue>
118
+ </grammar>
119
+ </expression>
120
+ </deprecates>
121
+ <related type='abbreviation'>
122
+ <preferred geographicArea="GRC">
123
+ <expression>
124
+ <name>Fifth Designation</name>
125
+ <grammar>
126
+ <gender>neuter</gender>
127
+ </grammar>
128
+ </expression>
129
+ <termsource status='identical' type='authoritative'>
130
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
131
+ <localityStack>
132
+ <locality type='section'>
133
+ <referenceFrom>2</referenceFrom>
134
+ </locality>
135
+ </localityStack>
136
+ </origin>
137
+ </termsource>
138
+ </preferred>
139
+ <xref target='second'/>
140
+ </related>
141
+ <domain>Hydraulics</domain>
142
+ <subject>pipes</subject>
143
+ <usageinfo>This is usage.</usageinfo>
144
+ <definition><verbaldefinition>
145
+ <p id='_'>Definition</p>
146
+ </verbaldefinition></definition>
147
+ <termsource status='identical' type='authoritative'>
148
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
149
+ <localityStack>
150
+ <locality type='section'>
151
+ <referenceFrom>3</referenceFrom>
152
+ </locality>
153
+ </localityStack>
154
+ </origin>
155
+ </termsource>
156
+ </term>
157
+ <term id='second'>
158
+ <preferred>
159
+ <expression>
160
+ <name>Second Term</name>
161
+ </expression>
162
+ </preferred>
163
+ <usageinfo>
164
+ <p id='_'>Usage Info 1.</p>
165
+ <p id='_'>Usage Info 2.</p>
166
+ </usageinfo>
167
+ </term>
168
+ </terms>
169
+ </sections>
170
+ </standard-document>
171
+ OUTPUT
172
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
173
+ .to be_equivalent_to xmlpp(output)
174
+ end
175
+
176
+ it "permits multiple preferred terms, and treats them as synonyms in concepts" do
177
+ input = <<~INPUT
178
+ #{ASCIIDOC_BLANK_HDR}
179
+ == Terms and Definitions
180
+
181
+ === First Designation
182
+
183
+ preferred:[Second Designation]
184
+
185
+ alt:[Third Designation]
186
+
187
+ alt:[Fourth Designation]
188
+
189
+ deprecated:[Fourth Designation]
190
+
191
+ deprecated:[Fifth Designation]
192
+
193
+ related:see[Sixth Designation]
194
+
195
+ related:contrast[Seventh Designation]
196
+
197
+ Definition
198
+
199
+ == Clause
200
+
201
+ {{First Designation}}
202
+
203
+ {{Second Designation}}
204
+ INPUT
205
+ output = <<~OUTPUT
206
+ #{BLANK_HDR}
207
+ <sections>
208
+ <terms id='_' obligation='normative'>
209
+ <title>Terms and definitions</title>
210
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
211
+ <term id='term-first-designation'>
212
+ <preferred>
213
+ <expression>
214
+ <name>First Designation</name>
215
+ </expression>
216
+ </preferred>
217
+ <preferred>
218
+ <expression>
219
+ <name>Second Designation</name>
220
+ </expression>
221
+ </preferred>
222
+ <admitted>
223
+ <expression>
224
+ <name>Third Designation</name>
225
+ </expression>
226
+ </admitted>
227
+ <admitted>
228
+ <expression>
229
+ <name>Fourth Designation</name>
230
+ </expression>
231
+ </admitted>
232
+ <deprecates>
233
+ <expression>
234
+ <name>Fourth Designation</name>
235
+ </expression>
236
+ </deprecates>
237
+ <deprecates>
238
+ <expression>
239
+ <name>Fifth Designation</name>
240
+ </expression>
241
+ </deprecates>
242
+ <related type='see'>
243
+ <strong>
244
+ term
245
+ <tt>Sixth Designation</tt>
246
+ not resolved via ID
247
+ <tt>sixth-designation</tt>
248
+ </strong>
249
+ </related>
250
+ <related type='contrast'>
251
+ <strong>
252
+ term
253
+ <tt>Seventh Designation</tt>
254
+ not resolved via ID
255
+ <tt>seventh-designation</tt>
256
+ </strong>
257
+ </related>
258
+ <definition><verbaldefinition>
259
+ <p id='_'>Definition</p>
260
+ </verbaldefinition></definition>
261
+ </term>
262
+ </terms>
263
+ <clause id='_' inline-header='false' obligation='normative'>
264
+ <title>Clause</title>
265
+ <p id='_'>
266
+ <concept>
267
+ <refterm>First Designation</refterm>
268
+ <renderterm>First Designation</renderterm>
269
+ <xref target='term-first-designation'/>
270
+ </concept>
271
+ </p>
272
+ <p id='_'>
273
+ <concept>
274
+ <refterm>Second Designation</refterm>
275
+ <renderterm>Second Designation</renderterm>
276
+ <xref target='term-first-designation'/>
277
+ </concept>
278
+ </p>
279
+ </clause>
280
+ </sections>
281
+ </standard-document>
282
+ OUTPUT
283
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
284
+ .to be_equivalent_to xmlpp(output)
285
+ end
286
+
287
+ it "processes letter-symbol designations" do
288
+ input = <<~INPUT
289
+ #{ASCIIDOC_BLANK_HDR}
290
+ == Terms and Definitions
291
+
292
+ === First Designation
293
+
294
+ [%metadata]
295
+ letter-symbol:: true
296
+
297
+ preferred:[Second Designation]
298
+
299
+ [%metadata]
300
+ letter-symbol:: false
301
+
302
+ alt:[Third Designation]
303
+
304
+ [%metadata]
305
+ letter-symbol:: true
306
+
307
+ deprecated:[stem:[t_90]]
308
+
309
+ related:see[<<second>>,Fifth Designation]
310
+
311
+ [%metadata]
312
+ letter-symbol:: true
313
+
314
+ Definition
315
+ INPUT
316
+ output = <<~OUTPUT
317
+ #{BLANK_HDR}
318
+ <sections>
319
+ <terms id='_' obligation='normative'>
320
+ <title>Terms and definitions</title>
321
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
322
+ <term id='term-first-designation'>
323
+ <preferred>
324
+ <letter-symbol>
325
+ <name>First Designation</name>
326
+ </letter-symbol>
327
+ </preferred>
328
+ <preferred>
329
+ <expression>
330
+ <name>Second Designation</name>
331
+ </expression>
332
+ </preferred>
333
+ <admitted>
334
+ <letter-symbol>
335
+ <name>Third Designation</name>
336
+ </letter-symbol>
337
+ </admitted>
338
+ <deprecates>
339
+ <letter-symbol>
340
+ <name>
341
+ <stem type='MathML'>
342
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
343
+ <msub>
344
+ <mrow>
345
+ <mi>t</mi>
346
+ </mrow>
347
+ <mrow>
348
+ <mn>90</mn>
349
+ </mrow>
350
+ </msub>
351
+ </math>
352
+ </stem>
353
+ </name>
354
+ </letter-symbol>
355
+ </deprecates>
356
+ <related type='see'>
357
+ <preferred>
358
+ <letter-symbol>
359
+ <name>Fifth Designation</name>
360
+ </letter-symbol>
361
+ </preferred>
362
+ <xref target='second'/>
363
+ </related>
364
+ <definition><verbaldefinition>
365
+ <p id='_'>Definition</p>
366
+ </verbaldefinition></definition>
367
+ </term>
368
+ </terms>
369
+ </sections>
370
+ </standard-document>
371
+ OUTPUT
372
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
373
+ .to be_equivalent_to xmlpp(output)
374
+ end
375
+
376
+ it "processes empty designations" do
377
+ input = <<~INPUT
378
+ #{ASCIIDOC_BLANK_HDR}
379
+ == Terms and Definitions
380
+
381
+ [[second]]
382
+ === {blank}
383
+
384
+ [%metadata]
385
+ isInternational:: true
386
+
387
+ preferred:[]
388
+
389
+ alt:[]
390
+
391
+ deprecated:[]
392
+
393
+ related:see[<<second>>,]
394
+
395
+ Definition
396
+ INPUT
397
+ output = <<~OUTPUT
398
+ #{BLANK_HDR}
399
+ <sections>
400
+ <terms id='_' obligation='normative'>
401
+ <title>Terms and definitions</title>
402
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
403
+ <term id='second'>
404
+ <preferred isInternational='true'>
405
+ <expression>
406
+ <name/>
407
+ </expression>
408
+ </preferred>
409
+ <preferred>
410
+ <expression>
411
+ <name/>
412
+ </expression>
413
+ </preferred>
414
+ <admitted>
415
+ <expression>
416
+ <name/>
417
+ </expression>
418
+ </admitted>
419
+ <deprecates>
420
+ <expression>
421
+ <name> </name>
422
+ </expression>
423
+ </deprecates>
424
+ <related type='see'>
425
+ <xref target='second'/>
426
+ </related>
427
+ <definition><verbaldefinition>
428
+ <p id='_'>Definition</p>
429
+ </verbaldefinition></definition>
430
+ </term>
431
+ </terms>
432
+ </sections>
433
+ </standard-document>
434
+ OUTPUT
435
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
436
+ .to be_equivalent_to xmlpp(output)
437
+ end
438
+
439
+ it "processes graphical-symbol designations" do
440
+ input = <<~INPUT
441
+ #{ASCIIDOC_BLANK_HDR}
442
+ == Terms and Definitions
443
+
444
+ [[second]]
445
+ === {blank}
446
+
447
+ .Caption
448
+ ....
449
+ <LITERAL>
450
+ FIGURATIVE
451
+ ....
452
+
453
+ [%metadata]
454
+ isInternational:: true
455
+
456
+ preferred:[]
457
+
458
+ .Caption
459
+ ....
460
+ <LITERAL>
461
+ FIGURATIVE
462
+ ....
463
+
464
+ alt:[]
465
+
466
+ .Caption
467
+ ....
468
+ <LITERAL>
469
+ FIGURATIVE
470
+ ....
471
+
472
+ deprecated:[]
473
+
474
+ .Caption
475
+ ....
476
+ <LITERAL>
477
+ FIGURATIVE
478
+ ....
479
+
480
+ related:see[<<second>>,]
481
+
482
+ .Caption
483
+ ....
484
+ <LITERAL>
485
+ FIGURATIVE
486
+ ....
487
+
488
+ Definition
489
+ INPUT
490
+ output = <<~OUTPUT
491
+ #{BLANK_HDR}
492
+ <sections>
493
+ <terms id='_' obligation='normative'>
494
+ <title>Terms and definitions</title>
495
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
496
+ <term id='second'>
497
+ <preferred isInternational='true'>
498
+ <graphical-symbol>
499
+ <figure id='_'>
500
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
501
+ </figure>
502
+ </graphical-symbol>
503
+ </preferred>
504
+ <preferred>
505
+ <graphical-symbol>
506
+ <figure id='_'>
507
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
508
+ </figure>
509
+ </graphical-symbol>
510
+ </preferred>
511
+ <admitted>
512
+ <graphical-symbol>
513
+ <figure id='_'>
514
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
515
+ </figure>
516
+ </graphical-symbol>
517
+ </admitted>
518
+ <deprecates>
519
+ <graphical-symbol>
520
+ <figure id='_'>
521
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
522
+ </figure>
523
+ </graphical-symbol>
524
+ </deprecates>
525
+ <related type='see'>
526
+ <xref target='second'/>
527
+ </related>
528
+ <definition>
529
+ <verbaldefinition><p id='_'>Definition</p></verbaldefinition>
530
+ <nonverbalrepresentation>
531
+ <figure id='_'>
532
+ <name>Caption</name>
533
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
534
+ </figure>
535
+ </nonverbalrepresentation>
536
+ </definition>
537
+ </term>
538
+ </terms>
539
+ </sections>
540
+ </standard-document>
541
+ OUTPUT
542
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
543
+ .to be_equivalent_to xmlpp(output)
544
+ end
545
+
546
+ it "sorts designations" do
547
+ input = <<~INPUT
548
+ #{ASCIIDOC_BLANK_HDR}
549
+ == Terms and Definitions
550
+
551
+ === First Designation
552
+
553
+ [%metadata]
554
+ language:: fr
555
+ script:: Latn
556
+ type:: prefix
557
+ isInternational:: true
558
+ abbreviationType:: acronym
559
+ pronunciation:: fəɹst
560
+ domain:: Hydraulics
561
+ subject:: pipes
562
+ usageinfo:: This is usage.
563
+
564
+ related:see[Fifth Designation]
565
+
566
+ [%metadata]
567
+ grammar::
568
+ gender::: neuter
569
+ isVerb::: true
570
+
571
+ deprecated:[Fourth Designation]
572
+
573
+ [%metadata]
574
+ language:: jp
575
+ script:: Japn
576
+ type:: full
577
+ grammar::
578
+ gender::: masculine, feminine
579
+ isPreposition::: false
580
+ isNoun::: true
581
+ grammarValue::: irregular declension
582
+
583
+ alt:[Third Designation]
584
+
585
+ [%metadata]
586
+ language:: he
587
+ script:: Hebr
588
+ type:: suffix
589
+ domain:: Hydraulics1
590
+ subject: pipes1
591
+ usageinfo:: This is usage 1.
592
+
593
+ preferred:[Second Designation]
594
+
595
+ [%metadata]
596
+ type:: abbreviation
597
+
598
+ Definition
599
+
600
+ INPUT
601
+ output = <<~OUTPUT
602
+ #{BLANK_HDR}
603
+ <sections>
604
+ <terms id='_' obligation='normative'>
605
+ <title>Terms and definitions</title>
606
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
607
+ <term id='term-first-designation'>
608
+ <preferred language='fr' script='Latn' type='prefix' isInternational="true">
609
+ <expression>
610
+ <name>First Designation</name>
611
+ <abbreviationType>acronym</abbreviationType>
612
+ <pronunciation>f&#601;&#633;st</pronunciation>
613
+ </expression>
614
+ </preferred>
615
+ <preferred type='abbreviation'>
616
+ <expression>
617
+ <name>Second Designation</name>
618
+ </expression>
619
+ </preferred>
620
+ <admitted language='he' script='Hebr' type='suffix'>
621
+ <expression>
622
+ <name>Third Designation</name>
623
+ </expression>
624
+ </admitted>
625
+ <deprecates language='jp' script='Japn' type='full'>
626
+ <expression>
627
+ <name>Fourth Designation</name>
628
+ <grammar>
629
+ <gender>masculine</gender>
630
+ <gender>feminine</gender>
631
+ <isPreposition>false</isPreposition>
632
+ <isNoun>true</isNoun>
633
+ <grammarValue>irregular declension</grammarValue>
634
+ </grammar>
635
+ </expression>
636
+ </deprecates>
637
+ <related type='see'>
638
+ <strong>
639
+ term
640
+ <tt>Fifth Designation</tt>
641
+ not resolved via ID
642
+ <tt>fifth-designation</tt>
643
+ </strong>
644
+ </related>
645
+ <domain>Hydraulics</domain>
646
+ <subject>pipes</subject>
647
+ <usageinfo>This is usage.</usageinfo>
648
+ <definition><verbaldefinition>
649
+ <p id='_'>Definition</p>
650
+ </verbaldefinition></definition>
651
+ </term>
652
+ </terms>
653
+ </sections>
654
+ </standard-document>
655
+ OUTPUT
656
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
657
+ .to be_equivalent_to xmlpp(output)
658
+ end
659
+
660
+ it "processes stem-only terms as admitted" do
661
+ input = <<~INPUT
662
+ #{ASCIIDOC_BLANK_HDR}
663
+ == Terms and Definitions
664
+
665
+ === stem:[t_90]
666
+
667
+ stem:[t_91]
668
+
669
+ Time
670
+ INPUT
671
+ output = <<~OUTPUT
672
+ #{BLANK_HDR}
673
+ <sections>
674
+ <terms id="_" obligation="normative">
675
+ <title>Terms and definitions</title>
676
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
677
+ <term id="term-t90"><preferred><letter-symbol><name><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
678
+ <mrow>
679
+ <mi>t</mi>
680
+ </mrow>
681
+ <mrow>
682
+ <mn>90</mn>
683
+ </mrow>
684
+ </msub></math></stem></name></letter-symbol></preferred>
685
+ <admitted><letter-symbol><name><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
686
+ <mrow>
687
+ <mi>t</mi>
688
+ </mrow>
689
+ <mrow>
690
+ <mn>91</mn>
691
+ </mrow>
692
+ </msub></math></stem></name></letter-symbol></admitted>
693
+ <definition><verbaldefinition><p id="_">Time</p></verbaldefinition></definition></term>
694
+ </terms>
695
+ </sections>
696
+ </standard-document>
697
+ OUTPUT
698
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
699
+ .to be_equivalent_to xmlpp(output)
700
+ end
701
+
702
+ it "moves term domains out of the term definition paragraph" do
703
+ input = <<~INPUT
704
+ #{ASCIIDOC_BLANK_HDR}
705
+ == Terms and Definitions
706
+
707
+ === Tempus
708
+
709
+ domain:[relativity] Time
710
+
711
+ === Tempus1
712
+
713
+ Time2
714
+
715
+ domain:[relativity2]
716
+ INPUT
717
+ output = <<~OUTPUT
718
+ #{BLANK_HDR}
719
+ <sections>
720
+ <terms id="_" obligation="normative">
721
+ <title>Terms and definitions</title>
722
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
723
+ <term id="term-tempus">
724
+ <preferred><expression><name>Tempus</name></expression></preferred>
725
+ <domain>relativity</domain><definition><verbaldefinition><p id="_"> Time</p></verbaldefinition></definition>
726
+ </term>
727
+ <term id='term-tempus1'>
728
+ <preferred><expression><name>Tempus1</name></expression></preferred>
729
+ <domain>relativity2</domain>
730
+ <definition><verbaldefinition>
731
+ <p id='_'>Time2</p>
732
+ <p id='_'> </p>
733
+ </verbaldefinition></definition>
734
+ </term>
735
+ </terms>
736
+ </sections>
737
+ </standard-document>
738
+ OUTPUT
739
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
740
+ .to be_equivalent_to xmlpp(output)
741
+ end
742
+
743
+ it "permits multiple blocks in term definition paragraph" do
744
+ input = <<~INPUT
745
+ = Document title
746
+ Author
747
+ :docfile: test.adoc
748
+ :nodoc:
749
+ :novalid:
750
+ :stem:
751
+
752
+ == Terms and Definitions
753
+
754
+ === stem:[t_90]
755
+
756
+ [stem]
757
+ ++++
758
+ t_A
759
+ ++++
760
+
761
+ This paragraph is extraneous
762
+ INPUT
763
+ output = <<~OUTPUT
764
+ #{BLANK_HDR}
765
+ <sections>
766
+ <terms id="_" obligation="normative">
767
+ <title>Terms and definitions</title>
768
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
769
+ <term id="term-t90"><preferred><letter-symbol><name><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
770
+ <mrow>
771
+ <mi>t</mi>
772
+ </mrow>
773
+ <mrow>
774
+ <mn>90</mn>
775
+ </mrow>
776
+ </msub></math></stem></name></letter-symbol></preferred>
777
+ <definition>
778
+ <verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition>
779
+ <nonverbalrepresentation><formula id="_">
780
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
781
+ <mrow>
782
+ <mi>t</mi>
783
+ </mrow>
784
+ <mrow>
785
+ <mi>A</mi>
786
+ </mrow>
787
+ </msub></math></stem>
788
+ </formula></nonverbalrepresentation>
789
+ </definition>
790
+ </term>
791
+ </terms>
792
+ </sections>
793
+ </standard-document>
794
+ OUTPUT
795
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
796
+ .to be_equivalent_to xmlpp(output)
797
+ end
798
+
799
+ it "rearranges term note, term example, term source" do
800
+ input = <<~INPUT
801
+ #{ASCIIDOC_BLANK_HDR}
802
+
803
+ == Terms and definitions
804
+
805
+ === Term
806
+
807
+ Definition
808
+
809
+ [.source]
810
+ <<ISO2191,section=1>>
811
+
812
+ NOTE: Note
813
+
814
+ [example]
815
+ Example 1
816
+
817
+ NOTE: Note 2
818
+
819
+ [example]
820
+ Example 2
821
+ INPUT
822
+ output = <<~OUTPUT
823
+ #{BLANK_HDR}
824
+ <sections>
825
+ <terms id="_" obligation="normative">
826
+ <title>Terms and definitions</title>
827
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
828
+ <term id="term-term"><preferred><expression><name>Term</name></expression></preferred>
829
+ <definition><verbaldefinition><p id='_'>Definition</p></verbaldefinition></definition>
830
+ <termnote id="_">
831
+ <p id="_">Note</p>
832
+ </termnote><termnote id="_">
833
+ <p id="_">Note 2</p>
834
+ </termnote><termexample id="_">
835
+ <p id="_">Example 1</p>
836
+ </termexample><termexample id="_">
837
+ <p id="_">Example 2</p>
838
+ </termexample><termsource status="identical" type="authoritative">
839
+ <origin bibitemid="ISO2191" type="inline" citeas="">
840
+ <localityStack>
841
+ <locality type="section"><referenceFrom>1</referenceFrom></locality>
842
+ </localityStack>
843
+ </origin>
844
+ </termsource></term>
845
+ </terms>
846
+ </sections>
847
+ </standard-document>
848
+ OUTPUT
849
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
850
+ .to be_equivalent_to xmlpp(output)
851
+ end
852
+
853
+ it "supports non-verbal definitions" do
854
+ input = <<~INPUT
855
+ #{ASCIIDOC_BLANK_HDR}
856
+
857
+ == Terms and definitions
858
+
859
+ === Term
860
+
861
+ [.definition]
862
+ --
863
+
864
+ Definition
865
+
866
+ [.source]
867
+ <<ISO2191,section=1>>
868
+
869
+ |===
870
+ | A | B
871
+
872
+ | C | D
873
+ |===
874
+ --
875
+
876
+ [.source]
877
+ <<ISO2191,section=2>>
878
+
879
+ === Term 2
880
+
881
+ [.definition]
882
+ --
883
+
884
+ ....
885
+ Literal
886
+ ....
887
+
888
+ [stem]
889
+ ++++
890
+ x = y
891
+ ++++
892
+
893
+ [.source]
894
+ <<ISO2191,section=3>>
895
+ --
896
+
897
+ INPUT
898
+ output = <<~OUTPUT
899
+ #{BLANK_HDR}
900
+ <sections>
901
+ <terms id='_' obligation='normative'>
902
+ <title>Terms and definitions</title>
903
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
904
+ <term id='term-term'>
905
+ <preferred>
906
+ <expression>
907
+ <name>Term</name>
908
+ </expression>
909
+ </preferred>
910
+ <definition>
911
+ <verbaldefinition>
912
+ <p id='_'>Definition</p>
913
+ <termsource status='identical' type='authoritative'>
914
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
915
+ <localityStack>
916
+ <locality type='section'>
917
+ <referenceFrom>1</referenceFrom>
918
+ </locality>
919
+ </localityStack>
920
+ </origin>
921
+ </termsource>
922
+ </verbaldefinition>
923
+ <nonverbalrepresentation>
924
+ <table id='_'>
925
+ <thead>
926
+ <tr>
927
+ <th valign='top' align='left'>A</th>
928
+ <th valign='top' align='left'>B</th>
929
+ </tr>
930
+ </thead>
931
+ <tbody>
932
+ <tr>
933
+ <td valign='top' align='left'>C</td>
934
+ <td valign='top' align='left'>D</td>
935
+ </tr>
936
+ </tbody>
937
+ </table>
938
+ </nonverbalrepresentation>
939
+ </definition>
940
+ <termsource status='identical' type='authoritative'>
941
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
942
+ <localityStack>
943
+ <locality type='section'>
944
+ <referenceFrom>2</referenceFrom>
945
+ </locality>
946
+ </localityStack>
947
+ </origin>
948
+ </termsource>
949
+ </term>
950
+ <term id='term-term-2'>
951
+ <preferred>
952
+ <expression>
953
+ <name>Term 2</name>
954
+ </expression>
955
+ </preferred>
956
+ <definition>
957
+ <nonverbalrepresentation>
958
+ <figure id='_'>
959
+ <pre id='_'>Literal</pre>
960
+ </figure>
961
+ <formula id='_'>
962
+ <stem type='MathML'>
963
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
964
+ <mi>x</mi>
965
+ <mo>=</mo>
966
+ <mi>y</mi>
967
+ </math>
968
+ </stem>
969
+ </formula>
970
+ <termsource status='identical' type='authoritative'>
971
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
972
+ <localityStack>
973
+ <locality type='section'>
974
+ <referenceFrom>3</referenceFrom>
975
+ </locality>
976
+ </localityStack>
977
+ </origin>
978
+ </termsource>
979
+ </nonverbalrepresentation>
980
+ </definition>
981
+ </term>
982
+ </terms>
983
+ </sections>
984
+ </standard-document>
985
+ OUTPUT
986
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
987
+ .to be_equivalent_to xmlpp(output)
988
+ end
989
+
990
+ end