metanorma-standoc 1.10.8 → 1.11.2

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