metanorma-standoc 1.10.5 → 1.11.0

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 (66) 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 +14 -17
  5. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  6. data/lib/asciidoctor/standoc/blocks.rb +26 -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 +5 -70
  10. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +44 -102
  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 +51 -33
  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 +38 -78
  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 +15 -0
  23. data/lib/asciidoctor/standoc/inline.rb +7 -5
  24. data/lib/asciidoctor/standoc/isodoc.rng +435 -78
  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 +82 -20
  30. data/lib/asciidoctor/standoc/ref_sect.rb +24 -17
  31. data/lib/asciidoctor/standoc/reqt.rb +2 -2
  32. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  33. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
  34. data/lib/asciidoctor/standoc/terms.rb +21 -3
  35. data/lib/asciidoctor/standoc/utils.rb +36 -23
  36. data/lib/asciidoctor/standoc/validate.rb +45 -27
  37. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  38. data/lib/metanorma/standoc/version.rb +1 -1
  39. data/metanorma-standoc.gemspec +1 -1
  40. data/spec/asciidoctor/base_spec.rb +4 -36
  41. data/spec/asciidoctor/blank_spec.rb +37 -0
  42. data/spec/asciidoctor/blocks_spec.rb +296 -47
  43. data/spec/asciidoctor/cleanup_blocks_spec.rb +1018 -0
  44. data/spec/asciidoctor/cleanup_sections_spec.rb +153 -12
  45. data/spec/asciidoctor/cleanup_spec.rb +179 -1265
  46. data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
  47. data/spec/asciidoctor/inline_spec.rb +38 -2
  48. data/spec/asciidoctor/lists_spec.rb +6 -6
  49. data/spec/asciidoctor/macros_plantuml_spec.rb +37 -2
  50. data/spec/asciidoctor/macros_spec.rb +226 -138
  51. data/spec/asciidoctor/refs_spec.rb +4 -26
  52. data/spec/asciidoctor/section_spec.rb +18 -18
  53. data/spec/asciidoctor/validate_spec.rb +109 -1
  54. data/spec/assets/xref_error.adoc +1 -0
  55. data/spec/fixtures/datamodel_description_sections_tree.xml +327 -326
  56. data/spec/spec_helper.rb +6 -7
  57. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
  58. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  59. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  60. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  61. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  62. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  63. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  64. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  65. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -49
  66. metadata +13 -5
@@ -3,177 +3,6 @@ require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
- it "processes svgmap" do
7
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
8
- "action_schemaexpg1.svg"
9
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
10
- "action_schemaexpg2.svg"
11
- input = <<~INPUT
12
- #{ASCIIDOC_BLANK_HDR}
13
-
14
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
15
- ====
16
- * <<ref1,Computer>>; http://www.example.com
17
- ====
18
-
19
- [[ref1]]
20
- .SVG title
21
- [.svgmap]
22
- ====
23
- image::action_schemaexpg1.svg[]
24
-
25
- * <<ref1,Computer>>; mn://action_schema
26
- * http://www.example.com[Phone]; http://www.example.com
27
- ====
28
-
29
- [[ref2]]
30
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
31
- ====
32
- [alt=Workmap]
33
- image::action_schemaexpg2.svg[]
34
-
35
- * <<ref1,Computer>>; mn://action_schema
36
- * http://www.example.com[Phone]; mn://basic_attribute_schema
37
- * <<express:action_schema:action_schema.basic,Coffee>>; mn://support_resource_schema
38
- ====
39
- INPUT
40
- output = <<~OUTPUT
41
- #{BLANK_HDR}
42
- <sections>
43
- <svgmap unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
44
- <target href='http://www.example.com'>
45
- <xref target='ref1'>Computer</xref>
46
- </target>
47
- </svgmap>
48
- <figure id='ref1'>
49
- <name>SVG title</name>
50
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000001' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
51
- <style/>
52
- <image/>
53
- <a xlink:href='#ref1'>
54
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
55
- </a>
56
- <a xlink:href='mn://basic_attribute_schema'>
57
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
58
- </a>
59
- <a xlink:href='mn://support_resource_schema'>
60
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
61
- </a>
62
- </svg>
63
- </figure>
64
- <svgmap>
65
- <figure id='ref2' unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
66
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000002' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
67
- <style/>
68
- <image/>
69
- <a xlink:href='#ref1'>
70
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
71
- </a>
72
- <a xlink:href='http://www.example.com'>
73
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
74
- </a>
75
- <a xlink:href='mn://support_resource_schema'>
76
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
77
- </a>
78
- </svg>
79
- </figure>
80
- <target href='mn://support_resource_schema'>
81
- <eref bibitemid='express_action_schema' citeas=''>
82
- <localityStack>
83
- <locality type='anchor'>
84
- <referenceFrom>action_schema.basic</referenceFrom>
85
- </locality>
86
- </localityStack>
87
- Coffee
88
- </eref>
89
- </target>
90
- </svgmap>
91
- </sections>
92
- <bibliography>
93
- <references hidden='true' normative='false'>
94
- <bibitem id='express_action_schema' type='internal'>
95
- <docidentifier type='repository'>express/action_schema</docidentifier>
96
- </bibitem>
97
- </references>
98
- </bibliography>
99
- </standard-document>
100
- OUTPUT
101
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
102
- .gsub(%r{<image.*?</image>}m, "<image/>")
103
- .gsub(%r{<style.*?</style>}m, "<style/>"))
104
- .to be_equivalent_to xmlpp(output)
105
- end
106
-
107
- it "processes markup in sourcecode" do
108
- input = <<~INPUT
109
- #{ASCIIDOC_BLANK_HDR}
110
-
111
- [source]
112
- ----
113
- <tag/>
114
- ----
115
-
116
- [[A]]
117
- [source]
118
- ----
119
- var {{{*x*}}} : {{{<<A,recursive>>}}} <tag/>
120
- ----
121
-
122
-
123
- INPUT
124
- output = <<~OUTPUT
125
- #{BLANK_HDR}
126
- <sections>
127
- <sourcecode id='_'>&lt;tag/&gt;</sourcecode>
128
- <sourcecode id='A'>
129
- var
130
- <strong>x</strong>
131
- :
132
- <xref target='A'>recursive</xref>
133
- &lt;tag/&gt;
134
- </sourcecode>
135
- </sections>
136
- </standard-document>
137
- OUTPUT
138
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
139
- .to be_equivalent_to xmlpp(output)
140
- end
141
-
142
- it "processes markup in sourcecode with custom delimiters" do
143
- input = <<~INPUT
144
- = Document title
145
- Author
146
- :docfile: test.adoc
147
- :nodoc:
148
- :novalid:
149
- :no-isobib:
150
- :sourcecode-markup-start: [[[
151
- :sourcecode-markup-end: ]]]
152
-
153
- [[A]]
154
- [source]
155
- ----
156
- var [[[*x*]]] : [[[<<A,recursive>>]]]
157
- ----
158
-
159
-
160
- INPUT
161
- output = <<~OUTPUT
162
- #{BLANK_HDR}
163
- <sections>
164
- <sourcecode id='A'>
165
- var
166
- <strong>x</strong>
167
- :
168
- <xref target='A'>recursive</xref>
169
- </sourcecode>
170
- </sections>
171
- </standard-document>
172
- OUTPUT
173
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
174
- .to be_equivalent_to xmlpp(output)
175
- end
176
-
177
6
  it "applies smartquotes by default" do
178
7
  input = <<~INPUT
179
8
  #{ASCIIDOC_BLANK_HDR}
@@ -384,224 +213,6 @@ RSpec.describe Asciidoctor::Standoc do
384
213
  .to be_equivalent_to xmlpp(output)
385
214
  end
386
215
 
387
- it "processes stem-only terms as admitted" do
388
- input = <<~INPUT
389
- #{ASCIIDOC_BLANK_HDR}
390
- == Terms and Definitions
391
-
392
- === stem:[t_90]
393
-
394
- stem:[t_91]
395
-
396
- Time
397
- INPUT
398
- output = <<~OUTPUT
399
- #{BLANK_HDR}
400
- <sections>
401
- <terms id="_" obligation="normative">
402
- <title>Terms and definitions</title>
403
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
404
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
405
- <mrow>
406
- <mi>t</mi>
407
- </mrow>
408
- <mrow>
409
- <mn>90</mn>
410
- </mrow>
411
- </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
412
- <mrow>
413
- <mi>t</mi>
414
- </mrow>
415
- <mrow>
416
- <mn>91</mn>
417
- </mrow>
418
- </msub></math></stem></admitted>
419
- <definition><p id="_">Time</p></definition></term>
420
- </terms>
421
- </sections>
422
- </standard-document>
423
- OUTPUT
424
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
425
- .to be_equivalent_to xmlpp(output)
426
- end
427
-
428
- it "moves term domains out of the term definition paragraph" do
429
- input = <<~INPUT
430
- #{ASCIIDOC_BLANK_HDR}
431
- == Terms and Definitions
432
-
433
- === Tempus
434
-
435
- domain:[relativity] Time
436
-
437
- === Tempus1
438
-
439
- Time2
440
-
441
- domain:[relativity2]
442
- INPUT
443
- output = <<~OUTPUT
444
- #{BLANK_HDR}
445
- <sections>
446
- <terms id="_" obligation="normative">
447
- <title>Terms and definitions</title>
448
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
449
- <term id="term-tempus">
450
- <preferred>Tempus</preferred>
451
- <domain>relativity</domain><definition><p id="_"> Time</p></definition>
452
- </term>
453
- <term id='term-tempus1'>
454
- <preferred>Tempus1</preferred>
455
- <domain>relativity2</domain>
456
- <definition>
457
- <p id='_'>Time2</p>
458
- <p id='_'> </p>
459
- </definition>
460
- </term>
461
- </terms>
462
- </sections>
463
- </standard-document>
464
- OUTPUT
465
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
466
- .to be_equivalent_to xmlpp(output)
467
- end
468
-
469
- it "permits multiple blocks in term definition paragraph" do
470
- input = <<~INPUT
471
- = Document title
472
- Author
473
- :docfile: test.adoc
474
- :nodoc:
475
- :novalid:
476
- :stem:
477
-
478
- == Terms and Definitions
479
-
480
- === stem:[t_90]
481
-
482
- [stem]
483
- ++++
484
- t_A
485
- ++++
486
-
487
- This paragraph is extraneous
488
- INPUT
489
- output = <<~OUTPUT
490
- #{BLANK_HDR}
491
- <sections>
492
- <terms id="_" obligation="normative">
493
- <title>Terms and definitions</title>
494
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
495
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
496
- <mrow>
497
- <mi>t</mi>
498
- </mrow>
499
- <mrow>
500
- <mn>90</mn>
501
- </mrow>
502
- </msub></math></stem></preferred><definition><formula id="_">
503
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
504
- <mrow>
505
- <mi>t</mi>
506
- </mrow>
507
- <mrow>
508
- <mi>A</mi>
509
- </mrow>
510
- </msub></math></stem>
511
- </formula>
512
- <p id="_">This paragraph is extraneous</p></definition>
513
- </term>
514
- </terms>
515
- </sections>
516
- </standard-document>
517
- OUTPUT
518
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
519
- .to be_equivalent_to xmlpp(output)
520
- end
521
-
522
- it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
523
- input = <<~INPUT
524
- #{ASCIIDOC_BLANK_HDR}
525
-
526
- [stem]
527
- ++++
528
- r = 1 %
529
- r = 1 %
530
- ++++
531
-
532
- NOTE: That formula does not do much
533
-
534
- Indeed.
535
- INPUT
536
- output = <<~OUTPUT
537
- #{BLANK_HDR}
538
- <sections><formula id="_">
539
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem>
540
- <note id="_">
541
- <p id="_">That formula does not do much</p>
542
- </note></formula>
543
- <p id="_">Indeed.</p></sections>
544
- </standard-document>
545
- OUTPUT
546
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
547
- .to be_equivalent_to xmlpp(output)
548
- end
549
-
550
- it "does not move notes inside preceding blocks, if they are marked as keep-separate" do
551
- input = <<~INPUT
552
- #{ASCIIDOC_BLANK_HDR}
553
-
554
- [stem]
555
- ++++
556
- r = 1 %
557
- r = 1 %
558
- ++++
559
-
560
- [NOTE,keep-separate=true]
561
- ====
562
- That formula does not do much
563
- ====
564
-
565
- Indeed.
566
- INPUT
567
- output = <<~OUTPUT
568
- #{BLANK_HDR}
569
- <sections><formula id="_">
570
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem></formula>
571
- <note id="_">
572
- <p id="_">That formula does not do much</p>
573
- </note>
574
- <p id="_">Indeed.</p></sections>
575
- </standard-document>
576
- OUTPUT
577
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
578
- .to be_equivalent_to xmlpp(output)
579
- end
580
-
581
- it "does not move notes inside preceding blocks, if they are at clause end" do
582
- input = <<~INPUT
583
- #{ASCIIDOC_BLANK_HDR}
584
- [source,ruby]
585
- [1...x].each do |y|
586
- puts y
587
- end
588
-
589
- NOTE: That loop does not do much
590
- INPUT
591
- output = <<~OUTPUT
592
- #{BLANK_HDR}
593
- <sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
594
- puts y
595
- end</sourcecode>
596
- <note id="_">
597
- <p id="_">That loop does not do much</p>
598
- </note></sections>
599
- </standard-document>
600
- OUTPUT
601
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
602
- .to be_equivalent_to xmlpp(output)
603
- end
604
-
605
216
  it "converts xrefs to references into erefs" do
606
217
  input = <<~INPUT
607
218
  #{ASCIIDOC_BLANK_HDR}
@@ -650,7 +261,7 @@ RSpec.describe Asciidoctor::Standoc do
650
261
  input = <<~INPUT
651
262
  #{ASCIIDOC_BLANK_HDR}
652
263
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
653
- <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety="the reference";whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference,xyz>>
264
+ <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety="the reference";whole,clause=3,example=9-11,locality:prelude=33,locality:URL:the reference,xyz>>
654
265
  <<iso216,_whole_>>
655
266
  <<iso216,a _whole_ flagon>>
656
267
  <<iso216,whole,clause=3,a _whole_ flagon>>
@@ -699,7 +310,7 @@ RSpec.describe Asciidoctor::Standoc do
699
310
  <locality type='locality:prelude'>
700
311
  <referenceFrom>33</referenceFrom>
701
312
  </locality>
702
- <locality type='locality:entirety'/>
313
+ <locality type='locality:URL'/>
703
314
  </localityStack>
704
315
  the reference,xyz
705
316
  </eref>
@@ -802,489 +413,29 @@ RSpec.describe Asciidoctor::Standoc do
802
413
 
803
414
  === Term1
804
415
 
416
+ Definition 0
417
+
805
418
  [.source]
806
419
  <<ISO2191,section=1>>
807
420
  INPUT
808
421
  output = <<~OUTPUT
809
422
  #{BLANK_HDR}
810
- <sections>
811
- <terms id="_" obligation="normative">
812
- <title>Terms and definitions</title>
813
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
814
- <term id="term-term1">
815
- <preferred>Term1</preferred>
816
- <termsource status="identical">
817
- <origin bibitemid="ISO2191" type="inline" citeas="">
818
- <localityStack>
819
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
820
- </localityStack>
821
- </origin>
822
- </termsource>
823
- </term>
824
- </terms>
825
- </sections>
826
- </standard-document>
827
- OUTPUT
828
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
829
- .to be_equivalent_to xmlpp(output)
830
- end
831
-
832
- it "inserts IDs into paragraphs" do
833
- input = <<~INPUT
834
- #{ASCIIDOC_BLANK_HDR}
835
- Paragraph
836
- INPUT
837
- output = <<~OUTPUT
838
- #{BLANK_HDR}
839
- <sections>
840
- <p id="_">Paragraph</p>
841
- </sections>
842
- </standard-document>
843
- OUTPUT
844
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
845
- .to be_equivalent_to xmlpp(output)
846
- end
847
-
848
- it "inserts IDs into notes" do
849
- input = <<~INPUT
850
- #{ASCIIDOC_BLANK_HDR}
851
- [example]
852
- ====
853
- NOTE: This note has no ID
854
- ====
855
- INPUT
856
- output = <<~OUTPUT
857
- #{BLANK_HDR}
858
- <sections>
859
- <example id="_">
860
- <note id="_">
861
- <p id="_">This note has no ID</p>
862
- </note>
863
- </example>
864
- </sections>
865
- </standard-document>
866
- OUTPUT
867
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
868
- .to be_equivalent_to xmlpp(output)
869
- end
870
-
871
- it "moves table key inside table" do
872
- input = <<~INPUT
873
- #{ASCIIDOC_BLANK_HDR}
874
- |===
875
- |a |b |c
876
- |===
877
-
878
- Key
879
-
880
- a:: b
881
-
882
- |===
883
- |a |b |c
884
- |===
885
-
886
- [%key]
887
- a:: b
888
-
889
- |===
890
- |a |b |c
891
- |===
892
-
893
- a:: b
894
- INPUT
895
- output = <<~OUTPUT
896
- #{BLANK_HDR}
897
- <sections>
898
- <table id='_'>
899
- <tbody>
900
- <tr>
901
- <td valign='top' align='left'>a</td>
902
- <td valign='top' align='left'>b</td>
903
- <td valign='top' align='left'>c</td>
904
- </tr>
905
- </tbody>
906
- <dl id='_' key='true'>
907
- <dt>a</dt>
908
- <dd>
909
- <p id='_'>b</p>
910
- </dd>
911
- </dl>
912
- </table>
913
- <table id='_'>
914
- <tbody>
915
- <tr>
916
- <td valign='top' align='left'>a</td>
917
- <td valign='top' align='left'>b</td>
918
- <td valign='top' align='left'>c</td>
919
- </tr>
920
- </tbody>
921
- <dl id='_' key='true'>
922
- <dt>a</dt>
923
- <dd>
924
- <p id='_'>b</p>
925
- </dd>
926
- </dl>
927
- </table>
928
- <table id='_'>
929
- <tbody>
930
- <tr>
931
- <td valign='top' align='left'>a</td>
932
- <td valign='top' align='left'>b</td>
933
- <td valign='top' align='left'>c</td>
934
- </tr>
935
- </tbody>
936
- </table>
937
- <dl id='_'>
938
- <dt>a</dt>
939
- <dd>
940
- <p id='_'>b</p>
941
- </dd>
942
- </dl>
943
- </sections>
944
- </standard-document>
945
- OUTPUT
946
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
947
- .to be_equivalent_to xmlpp(output)
948
- end
949
-
950
- it "processes headerrows attribute for table without header rows" do
951
- input = <<~INPUT
952
- #{ASCIIDOC_BLANK_HDR}
953
- [headerrows=3]
954
- |===
955
- |a |b |c
956
- |a |b |c
957
- |a |b |c
958
- |a |b |c
959
- |===
960
- INPUT
961
- output = <<~OUTPUT
962
- #{BLANK_HDR}
963
- <sections>
964
- <table id="_"><thead><tr>
965
- <th valign="top" align="left">a</th>
966
- <th valign="top" align="left">b</th>
967
- <th valign="top" align="left">c</th>
968
- </tr><tr>
969
- <th valign="top" align="left">a</th>
970
- <th valign="top" align="left">b</th>
971
- <th valign="top" align="left">c</th>
972
- </tr><tr>
973
- <th valign="top" align="left">a</th>
974
- <th valign="top" align="left">b</th>
975
- <th valign="top" align="left">c</th>
976
- </tr></thead>
977
- <tbody>
978
- <tr>
979
- <td valign="top" align="left">a</td>
980
- <td valign="top" align="left">b</td>
981
- <td valign="top" align="left">c</td>
982
- </tr>
983
- </tbody>
984
- </table>
985
- </sections>
986
- </standard-document>
987
- OUTPUT
988
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
989
- .to be_equivalent_to xmlpp(output)
990
- end
991
-
992
- it "processes headerrows attribute for table with header rows" do
993
- input = <<~INPUT
994
- #{ASCIIDOC_BLANK_HDR}
995
- [headerrows=3]
996
- |===
997
- |a |b |c
998
-
999
- |a |b |c
1000
- |a |b |c
1001
- |a |b |c
1002
- |===
1003
- INPUT
1004
- output = <<~OUTPUT
1005
- #{BLANK_HDR}
1006
- <sections>
1007
- <table id="_">
1008
- <thead>
1009
- <tr>
1010
- <th valign="top" align="left">a</th>
1011
- <th valign="top" align="left">b</th>
1012
- <th valign="top" align="left">c</th>
1013
- </tr>
1014
- <tr>
1015
- <th valign="top" align="left">a</th>
1016
- <th valign="top" align="left">b</th>
1017
- <th valign="top" align="left">c</th>
1018
- </tr><tr>
1019
- <th valign="top" align="left">a</th>
1020
- <th valign="top" align="left">b</th>
1021
- <th valign="top" align="left">c</th>
1022
- </tr></thead>
1023
- <tbody>
1024
-
1025
-
1026
- <tr>
1027
- <td valign="top" align="left">a</td>
1028
- <td valign="top" align="left">b</td>
1029
- <td valign="top" align="left">c</td>
1030
- </tr>
1031
- </tbody>
1032
- </table>
1033
- </sections>
1034
- </standard-document>
1035
- OUTPUT
1036
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1037
- .to be_equivalent_to xmlpp(output)
1038
- end
1039
-
1040
- it "moves table notes inside table" do
1041
- input = <<~INPUT
1042
- #{ASCIIDOC_BLANK_HDR}
1043
- |===
1044
- |a |b |c
1045
- |===
1046
-
1047
- NOTE: Note 1
1048
-
1049
- NOTE: Note 2
1050
- INPUT
1051
- output = <<~OUTPUT
1052
- #{BLANK_HDR}
1053
- <sections><table id="_">
1054
- <tbody>
1055
- <tr>
1056
- <td valign="top" align="left">a</td>
1057
- <td valign="top" align="left">b</td>
1058
- <td valign="top" align="left">c</td>
1059
- </tr>
1060
- </tbody>
1061
- <note id="_">
1062
- <p id="_">Note 1</p>
1063
- </note><note id="_">
1064
- <p id="_">Note 2</p>
1065
- </note></table>
1066
-
1067
- </sections>
1068
- </standard-document>
1069
- OUTPUT
1070
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1071
- .to be_equivalent_to xmlpp(output)
1072
- end
1073
-
1074
- it "moves formula key inside formula" do
1075
- input = <<~INPUT
1076
- #{ASCIIDOC_BLANK_HDR}
1077
- [stem]
1078
- ++++
1079
- Formula
1080
- ++++
1081
-
1082
- Where,
1083
-
1084
- a:: b
1085
-
1086
- [stem]
1087
- ++++
1088
- Formula
1089
- ++++
1090
-
1091
- [%key]
1092
- a:: b
1093
-
1094
- [stem]
1095
- ++++
1096
- Formula
1097
- ++++
1098
-
1099
- a:: b
1100
- INPUT
1101
- output = <<~OUTPUT
1102
- #{BLANK_HDR}
1103
- <sections>
1104
- <formula id='_'>
1105
- <stem type='MathML'>
1106
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1107
- <mi>F</mi>
1108
- <mi>or</mi>
1109
- <mi>μ</mi>
1110
- <mi>l</mi>
1111
- <mi>a</mi>
1112
- </math>
1113
- </stem>
1114
- <dl id='_' key='true'>
1115
- <dt>a</dt>
1116
- <dd>
1117
- <p id='_'>b</p>
1118
- </dd>
1119
- </dl>
1120
- </formula>
1121
- <formula id='_'>
1122
- <stem type='MathML'>
1123
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1124
- <mi>F</mi>
1125
- <mi>or</mi>
1126
- <mi>μ</mi>
1127
- <mi>l</mi>
1128
- <mi>a</mi>
1129
- </math>
1130
- </stem>
1131
- <dl id='_' key='true'>
1132
- <dt>a</dt>
1133
- <dd>
1134
- <p id='_'>b</p>
1135
- </dd>
1136
- </dl>
1137
- </formula>
1138
- <formula id='_'>
1139
- <stem type='MathML'>
1140
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1141
- <mi>F</mi>
1142
- <mi>or</mi>
1143
- <mi>μ</mi>
1144
- <mi>l</mi>
1145
- <mi>a</mi>
1146
- </math>
1147
- </stem>
1148
- </formula>
1149
- <dl id='_'>
1150
- <dt>a</dt>
1151
- <dd>
1152
- <p id='_'>b</p>
1153
- </dd>
1154
- </dl>
1155
- </sections>
1156
- </standard-document>
1157
- OUTPUT
1158
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1159
- .to be_equivalent_to xmlpp(output)
1160
- end
1161
-
1162
- it "moves footnotes inside figures" do
1163
- input = <<~INPUT
1164
- #{ASCIIDOC_BLANK_HDR}
1165
- .Figuretitle.footnote:[xyz]
1166
- image::spec/examples/rice_images/rice_image1.png[]
1167
-
1168
- footnote:[This is a footnote to a figure]
1169
-
1170
- footnote:[This is another footnote to a figure]
1171
-
1172
- A footnote:[This is a third footnote]
1173
- INPUT
1174
- output = <<~OUTPUT
1175
- #{BLANK_HDR}
1176
- <sections><figure id="_">
1177
- <name>
1178
- Figuretitle.
1179
- <fn reference='1'>
1180
- <p id='_'>xyz</p>
1181
- </fn>
1182
- </name>
1183
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1184
- <fn reference="a">
1185
- <p id="_">This is a footnote to a figure</p>
1186
- </fn><fn reference="b">
1187
- <p id="_">This is another footnote to a figure</p>
1188
- </fn></figure>
1189
- <p id='_'>
1190
- A
1191
- <fn reference='2'>
1192
- <p id='_'>This is a third footnote</p>
1193
- </fn>
1194
- </p>
1195
- </sections>
1196
- </standard-document>
1197
- OUTPUT
1198
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1199
- .to be_equivalent_to xmlpp(output)
1200
- end
1201
-
1202
- it "moves figure key inside figure" do
1203
- input = <<~INPUT
1204
- #{ASCIIDOC_BLANK_HDR}
1205
- image::spec/examples/rice_images/rice_image1.png[]
1206
-
1207
- key:
1208
-
1209
- a:: b
1210
-
1211
- image::spec/examples/rice_images/rice_image1.png[]
1212
-
1213
- [%key]
1214
- a:: b
1215
-
1216
- image::spec/examples/rice_images/rice_image1.png[]
1217
-
1218
- a:: b
1219
- INPUT
1220
- output = <<~OUTPUT
1221
- #{BLANK_HDR}
1222
- <sections>
1223
- <figure id='_'>
1224
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1225
- <dl id='_' key='true'>
1226
- <dt>a</dt>
1227
- <dd>
1228
- <p id='_'>b</p>
1229
- </dd>
1230
- </dl>
1231
- </figure>
1232
- <figure id='_'>
1233
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1234
- <dl id='_' key='true'>
1235
- <dt>a</dt>
1236
- <dd>
1237
- <p id='_'>b</p>
1238
- </dd>
1239
- </dl>
1240
- </figure>
1241
- <figure id='_'>
1242
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1243
- </figure>
1244
- <dl id='_'>
1245
- <dt>a</dt>
1246
- <dd>
1247
- <p id='_'>b</p>
1248
- </dd>
1249
- </dl>
1250
- </sections>
1251
- </standard-document>
1252
- OUTPUT
1253
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1254
- .to be_equivalent_to xmlpp(output)
1255
- end
1256
-
1257
- it "processes subfigures" do
1258
- input = <<~INPUT
1259
- #{ASCIIDOC_BLANK_HDR}
1260
- [[figureC-2]]
1261
- .Stages of gelatinization
1262
- ====
1263
- .Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
1264
- image::spec/examples/rice_images/rice_image3_1.png[]
1265
-
1266
- .Intermediate stages: Some fully gelatinized kernels are visible
1267
- image::spec/examples/rice_images/rice_image3_2.png[]
1268
-
1269
- .Final stages: All kernels are fully gelatinized
1270
- image::spec/examples/rice_images/rice_image3_3.png[]
1271
- ====
1272
- INPUT
1273
- output = <<~OUTPUT
1274
- #{BLANK_HDR}
1275
- <sections>
1276
- <figure id="figureC-2"><name>Stages of gelatinization</name><figure id="_">
1277
- <name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
1278
- <image src="spec/examples/rice_images/rice_image3_1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1279
- </figure>
1280
- <figure id="_">
1281
- <name>Intermediate stages: Some fully gelatinized kernels are visible</name>
1282
- <image src="spec/examples/rice_images/rice_image3_2.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1283
- </figure>
1284
- <figure id="_">
1285
- <name>Final stages: All kernels are fully gelatinized</name>
1286
- <image src="spec/examples/rice_images/rice_image3_3.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1287
- </figure></figure>
423
+ <sections>
424
+ <terms id="_" obligation="normative">
425
+ <title>Terms and definitions</title>
426
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
427
+ <term id="term-term1">
428
+ <preferred><expression><name>Term1</name></expression></preferred>
429
+ <definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
430
+ <termsource status="identical" type="authoritative">
431
+ <origin bibitemid="ISO2191" type="inline" citeas="">
432
+ <localityStack>
433
+ <locality type="section"><referenceFrom>1</referenceFrom></locality>
434
+ </localityStack>
435
+ </origin>
436
+ </termsource>
437
+ </term>
438
+ </terms>
1288
439
  </sections>
1289
440
  </standard-document>
1290
441
  OUTPUT
@@ -1347,60 +498,6 @@ RSpec.describe Asciidoctor::Standoc do
1347
498
  .to be_equivalent_to xmlpp(output)
1348
499
  end
1349
500
 
1350
- it "rearranges term note, term example, term source" do
1351
- input = <<~INPUT
1352
- #{ASCIIDOC_BLANK_HDR}
1353
-
1354
- == Terms and definitions
1355
-
1356
- === Term
1357
-
1358
- [.source]
1359
- <<ISO2191,section=1>>
1360
-
1361
- NOTE: Note
1362
-
1363
- [example]
1364
- Example 1
1365
-
1366
- NOTE: Note 2
1367
-
1368
- [example]
1369
- Example 2
1370
- INPUT
1371
- output = <<~OUTPUT
1372
- #{BLANK_HDR}
1373
- <sections>
1374
- <terms id="_" obligation="normative">
1375
- <title>Terms and definitions</title>
1376
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1377
- <term id="term-term"><preferred>Term</preferred>
1378
-
1379
-
1380
-
1381
- <termnote id="_">
1382
- <p id="_">Note</p>
1383
- </termnote><termnote id="_">
1384
- <p id="_">Note 2</p>
1385
- </termnote><termexample id="_">
1386
- <p id="_">Example 1</p>
1387
- </termexample><termexample id="_">
1388
- <p id="_">Example 2</p>
1389
- </termexample><termsource status="identical">
1390
- <origin bibitemid="ISO2191" type="inline" citeas="">
1391
- <localityStack>
1392
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
1393
- </localityStack>
1394
- </origin>
1395
- </termsource></term>
1396
- </terms>
1397
- </sections>
1398
- </standard-document>
1399
- OUTPUT
1400
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1401
- .to be_equivalent_to xmlpp(output)
1402
- end
1403
-
1404
501
  it "separates IEV citations by top-level clause" do
1405
502
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
1406
503
  FileUtils.mv File.expand_path("~/.relaton/cache"),
@@ -1410,8 +507,6 @@ RSpec.describe Asciidoctor::Standoc do
1410
507
  File.expand_path("~/.iev.pstore1"), force: true
1411
508
  FileUtils.rm_rf "relaton/cache"
1412
509
  FileUtils.rm_rf "test.iev.pstore"
1413
- # mock_iecbib_get_iec60050_102_01
1414
- # mock_iecbib_get_iec60050_103_01
1415
510
  # mock_iev
1416
511
  VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1417
512
  input = <<~INPUT
@@ -1424,16 +519,22 @@ RSpec.describe Asciidoctor::Standoc do
1424
519
  == Terms and definitions
1425
520
  === Automation1
1426
521
 
522
+ Definition 1
523
+
1427
524
  [.source]
1428
525
  <<iev,clause="103-01-02">>
1429
526
 
1430
527
  === Automation2
1431
528
 
529
+ Definition 2
530
+
1432
531
  [.source]
1433
532
  <<iev,clause="102-01-02">>
1434
533
 
1435
534
  === Automation3
1436
535
 
536
+ Definition 3
537
+
1437
538
  [.source]
1438
539
  <<iev,clause="103-01-02">>
1439
540
  INPUT
@@ -1443,8 +544,9 @@ RSpec.describe Asciidoctor::Standoc do
1443
544
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
1444
545
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1445
546
  <term id="term-automation1">
1446
- <preferred>Automation1</preferred>
1447
- <termsource status="identical">
547
+ <preferred><expression><name>Automation1</name></expression></preferred>
548
+ <definition><verbaldefinition><p id='_'>Definition 1</p></verbaldefinition></definition>
549
+ <termsource status="identical" type="authoritative">
1448
550
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1449
551
  <localityStack>
1450
552
  <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
@@ -1453,8 +555,9 @@ RSpec.describe Asciidoctor::Standoc do
1453
555
  </termsource>
1454
556
  </term>
1455
557
  <term id="term-automation2">
1456
- <preferred>Automation2</preferred>
1457
- <termsource status="identical">
558
+ <preferred><expression><name>Automation2</name></expression></preferred>
559
+ <definition><verbaldefinition><p id='_'>Definition 2</p></verbaldefinition></definition>
560
+ <termsource status="identical" type="authoritative">
1458
561
  <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
1459
562
  <localityStack>
1460
563
  <locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
@@ -1463,8 +566,9 @@ RSpec.describe Asciidoctor::Standoc do
1463
566
  </termsource>
1464
567
  </term>
1465
568
  <term id="term-automation3">
1466
- <preferred>Automation3</preferred>
1467
- <termsource status="identical">
569
+ <preferred><expression><name>Automation3</name></expression></preferred>
570
+ <definition><verbaldefinition><p id='_'>Definition 3</p></verbaldefinition></definition>
571
+ <termsource status="identical" type="authoritative">
1468
572
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
1469
573
  <localityStack>
1470
574
  <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
@@ -1539,7 +643,7 @@ RSpec.describe Asciidoctor::Standoc do
1539
643
  <abstract format="text/plain" language="en" script="Latn">IEC 60050-103:2009 gives the terminology relative to functions of one or more variables. Together with IEC 60050-102, it covers the mathematical terminology used in the fields of electricity, electronics and telecommunications. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Mathematical symbols are generally in accordance with IEC 60027-1 and ISO 80000-2. This standard cancels and replaces Sections 101-13, 101-14 and 101-15 of International Standard IEC 60050-101:1998. It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
1540
644
  <status>
1541
645
  <stage>60</stage>
1542
- <substage>00</substage>
646
+ <substage>60</substage>
1543
647
  </status>
1544
648
  <copyright>
1545
649
  <from>2009</from>
@@ -1682,23 +786,23 @@ RSpec.describe Asciidoctor::Standoc do
1682
786
  it "cleans up nested mathvariant instances" do
1683
787
  input = <<~INPUT
1684
788
  #{ASCIIDOC_BLANK_HDR}
1685
-
789
+
1686
790
  stem:[sf "unitsml(cd)"]
1687
791
  INPUT
1688
792
  output = <<~OUTPUT
1689
- <sections>
1690
- <p id='_'>
1691
- <stem type='MathML'>
1692
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1693
- <mstyle mathvariant='sans-serif'>
1694
- <mrow xref='U_NISTu7'>
1695
- <mi mathvariant='sans-serif'>cd</mi>
1696
- </mrow>
1697
- </mstyle>
1698
- </math>
1699
- </stem>
1700
- </p>
1701
- </sections>
793
+ <sections>
794
+ <p id='_'>
795
+ <stem type='MathML'>
796
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
797
+ <mstyle mathvariant='sans-serif'>
798
+ <mrow xref='U_NISTu7'>
799
+ <mi mathvariant='sans-serif'>cd</mi>
800
+ </mrow>
801
+ </mstyle>
802
+ </math>
803
+ </stem>
804
+ </p>
805
+ </sections>
1702
806
  OUTPUT
1703
807
  expect(xmlpp(strip_guid(Nokogiri::XML(
1704
808
  Asciidoctor.convert(input, *OPTIONS),
@@ -2038,7 +1142,7 @@ RSpec.describe Asciidoctor::Standoc do
2038
1142
  <dd>
2039
1143
  <p id='_'>Definition 2</p>
2040
1144
  </dd>
2041
- <dt id='symbol-&#945;'>α</dt>
1145
+ <dt id='symbol-__x3b1_'>α</dt>
2042
1146
  <dd>
2043
1147
  <p id='_'>Definition 1</p>
2044
1148
  </dd>
@@ -2108,7 +1212,7 @@ RSpec.describe Asciidoctor::Standoc do
2108
1212
  <dd>
2109
1213
  <p id='_'>Definition 2</p>
2110
1214
  </dd>
2111
- <dt id='symbol-_-&#945;-'>
1215
+ <dt id='symbol-_-__x3b1_-'>
2112
1216
  <stem type='MathML'>
2113
1217
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2114
1218
  <mi>α</mi>
@@ -2127,226 +1231,6 @@ RSpec.describe Asciidoctor::Standoc do
2127
1231
  .to be_equivalent_to xmlpp(output)
2128
1232
  end
2129
1233
 
2130
- it "moves metadata deflist to correct location" do
2131
- input = <<~INPUT
2132
- #{ASCIIDOC_BLANK_HDR}
2133
-
2134
- == Clause
2135
-
2136
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2137
- ====
2138
- [%metadata]
2139
- model:: ogc
2140
- type:: class
2141
- label:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
2142
- subject:: Encoding of logical models
2143
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
2144
- inherit:: urn:iso:dis:iso:19156:clause:8
2145
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
2146
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
2147
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
2148
- inherit:: <<ref2>>
2149
- inherit:: <<ref3>>
2150
- classification:: priority:P0
2151
- classification:: domain:Hydrology,Groundwater
2152
- classification:: control-class:Technical
2153
- obligation:: recommendation,requirement
2154
-
2155
- I recommend this
2156
- ====
2157
- INPUT
2158
- output = <<~OUTPUT
2159
- #{BLANK_HDR}
2160
- <sections>
2161
- <clause id='_' inline-header='false' obligation='normative'>
2162
- <title>Clause</title>
2163
- <requirement id='_' subsequence='A'>
2164
- <label>
2165
- <link target='http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules'>
2166
- <strong>req/core</strong>
2167
- </link>
2168
- </label>
2169
- <subject>Encoding of logical models</subject>
2170
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2171
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
2172
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
2173
- <inherit>
2174
- <link target='http://www.opengis.net/doc/IS/GML/3.2/clause/2.4'/>
2175
- </inherit>
2176
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
2177
- <inherit>
2178
- <link target='http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used'/>
2179
- </inherit>
2180
- <inherit>
2181
- <xref target='ref2'/>
2182
- </inherit>
2183
- <inherit>
2184
- <xref target='ref3'/>
2185
- </inherit>
2186
- <classification>
2187
- <tag>control-class</tag>
2188
- <value>Technical</value>
2189
- </classification>
2190
- <classification>
2191
- <tag>domain</tag>
2192
- <value>Groundwater</value>
2193
- </classification>
2194
- <classification>
2195
- <tag>domain</tag>
2196
- <value>Hydrology</value>
2197
- </classification>
2198
- <classification>
2199
- <tag>priority</tag>
2200
- <value>P0</value>
2201
- </classification>
2202
- <description>
2203
- <p id='_'>I recommend this</p>
2204
- </description>
2205
- </requirement>
2206
- </clause>
2207
- </sections>
2208
- </standard-document>
2209
- OUTPUT
2210
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2211
- .to be_equivalent_to xmlpp(output)
2212
- end
2213
-
2214
- it "moves inherit macros to correct location" do
2215
- input = <<~INPUT
2216
- #{ASCIIDOC_BLANK_HDR}
2217
-
2218
- == Clause
2219
-
2220
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2221
- .Title
2222
- ====
2223
- inherit:[A]
2224
- inherit:[B]
2225
- I recommend this
2226
- ====
2227
-
2228
- [.requirement,subsequence="A",classification="X:Y"]
2229
- .Title
2230
- ====
2231
- inherit:[A]
2232
- I recommend this
2233
- ====
2234
-
2235
- [.requirement,subsequence="A"]
2236
- .Title
2237
- ====
2238
- inherit:[A]
2239
- I recommend this
2240
- ====
2241
-
2242
- [.requirement,subsequence="A"]
2243
- .Title
2244
- ====
2245
- inherit:[A]
2246
- ====
2247
-
2248
-
2249
- INPUT
2250
- output = <<~OUTPUT
2251
- #{BLANK_HDR}
2252
- <sections>
2253
- <clause id='_' inline-header='false' obligation='normative'>
2254
- <title>Clause</title>
2255
- <requirement id='_' subsequence='A'>
2256
- <title>Title</title>
2257
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2258
- <inherit>A</inherit>
2259
- <inherit>B</inherit>
2260
- <description>
2261
- <p id='_'> I recommend this</p>
2262
- </description>
2263
- </requirement>
2264
- <requirement id='_' subsequence='A'>
2265
- <title>Title</title>
2266
- <inherit>A</inherit>
2267
- <classification>
2268
- <tag>X</tag>
2269
- <value>Y</value>
2270
- </classification>
2271
- <description>
2272
- <p id='_'> I recommend this</p>
2273
- </description>
2274
- </requirement>
2275
- <requirement id='_' subsequence='A'>
2276
- <title>Title</title>
2277
- <inherit>A</inherit>
2278
- <description>
2279
- <p id='_'> I recommend this</p>
2280
- </description>
2281
- </requirement>
2282
- <requirement id='_' subsequence='A'>
2283
- <title>Title</title>
2284
- <inherit>A</inherit>
2285
- <description>
2286
- <p id='_'> </p>
2287
- </description>
2288
- </requirement>
2289
- </clause>
2290
- </sections>
2291
- </standard-document>
2292
- OUTPUT
2293
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2294
- .to be_equivalent_to xmlpp(output)
2295
- end
2296
-
2297
- it "moves %beforeclause admonitions to right position" do
2298
- input = <<~INPUT
2299
- #{ASCIIDOC_BLANK_HDR}
2300
-
2301
- .Foreword
2302
- Foreword
2303
-
2304
- [NOTE,beforeclauses=true]
2305
- ====
2306
- Note which is very important
2307
- ====
2308
-
2309
- == Introduction
2310
- Introduction
2311
-
2312
- == Scope
2313
- Scope statement
2314
-
2315
- [IMPORTANT,beforeclauses=true]
2316
- ====
2317
- Notice which is very important
2318
- ====
2319
- INPUT
2320
- output = <<~OUTPUT
2321
- #{BLANK_HDR}
2322
- <preface>
2323
- <note id='_'>
2324
- <p id='_'>Note which is very important</p>
2325
- </note>
2326
- <foreword id='_' obligation='informative'>
2327
- <title>Foreword</title>
2328
- <p id='_'>Foreword</p>
2329
- </foreword>
2330
- <introduction id='_' obligation='informative'>
2331
- <title>Introduction</title>
2332
- <p id='_'>Introduction</p>
2333
- </introduction>
2334
- </preface>
2335
- <sections>
2336
- <admonition id='_' type='important'>
2337
- <p id='_'>Notice which is very important</p>
2338
- </admonition>
2339
- <clause id='_' inline-header='false' obligation='normative' type="scope">
2340
- <title>Scope</title>
2341
- <p id='_'>Scope statement</p>
2342
- </clause>
2343
- </sections>
2344
- </standard-document>
2345
- OUTPUT
2346
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2347
- .to be_equivalent_to xmlpp(output)
2348
- end
2349
-
2350
1234
  it "fixes illegal anchors" do
2351
1235
  input = <<~INPUT
2352
1236
  #{ASCIIDOC_BLANK_HDR}
@@ -2361,6 +1245,17 @@ RSpec.describe Asciidoctor::Standoc do
2361
1245
  <<:a#b:>>
2362
1246
  <</%ab>>
2363
1247
  <<1!>>
1248
+ <<Löwe>>
1249
+
1250
+ [[Löwe]]
1251
+ .See <<Löwner2016>>
1252
+ ----
1253
+ ABC
1254
+ ----
1255
+
1256
+ [bibliography]
1257
+ == Bibliography
1258
+ * [[[Löwner2016,Löwner et al. 2016]]], Löwner, M.-O., Gröger, G., Benner, J., Biljecki, F., Nagel, C., 2016: *Proposal for a new LOD and multi-representation concept for CityGML*. In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Vol. IV-2/W1, 3–12. https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016
2364
1259
  INPUT
2365
1260
  output = <<~OUTPUT
2366
1261
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
@@ -2378,31 +1273,55 @@ RSpec.describe Asciidoctor::Standoc do
2378
1273
  <doctype>article</doctype>
2379
1274
  </ext>
2380
1275
  </bibdata>
2381
- <sections>
2382
- <clause id='a_b' inline-header='false' obligation='normative'>
2383
- <title>A</title>
2384
- <eref bibitemid='__ab' citeas=''/>
2385
- <xref target='_'/>
2386
- <xref target='_1'/>
2387
- <xref target='_1_'/>
2388
- <xref target='1#b'/>
2389
- <xref target='_a#b_'/>
2390
- <xref target='_%ab'/>
2391
- <xref target='_1_'/>
2392
- </clause>
2393
- </sections>
2394
- <bibliography>
2395
- <references hidden='true' normative='false'>
2396
- <bibitem id='__ab' type='internal'>
2397
- <docidentifier type='repository'>//ab</docidentifier>
2398
- </bibitem>
2399
- </references>
2400
- </bibliography>
2401
- </standard-document>
1276
+ <sections>
1277
+ <clause id='a_b' inline-header='false' obligation='normative'>
1278
+ <title>A</title>
1279
+ <eref bibitemid='__ab' citeas=''/>
1280
+ <xref target='_'/>
1281
+ <xref target='_1'/>
1282
+ <xref target='_1_'/>
1283
+ <xref target='1#b'/>
1284
+ <xref target='_a#b_'/>
1285
+ <xref target='__ab'/>
1286
+ <xref target='_1_'/>
1287
+ <xref target='L__xf6_we'/>
1288
+ <sourcecode id='L__xf6_we'>
1289
+ <name>
1290
+ See
1291
+ <eref type='inline' bibitemid='L__xf6_wner2016' citeas='L&#246;wner et al. 2016'/>
1292
+ </name>
1293
+ ABC
1294
+ </sourcecode>
1295
+ </clause>
1296
+ </sections>
1297
+ <bibliography>
1298
+ <references id='_bibliography' normative='false' obligation='informative'>
1299
+ <title>Bibliography</title>
1300
+ <bibitem id='L__xf6_wner2016'>
1301
+ <formattedref format='application/x-isodoc+xml'>
1302
+ L&#246;wner, M.-O., Gr&#246;ger, G., Benner, J., Biljecki, F., Nagel,
1303
+ C., 2016:
1304
+ <strong>Proposal for a new LOD and multi-representation concept for CityGML</strong>
1305
+ . In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals
1306
+ of the Photogrammetry, Remote Sensing and Spatial Information
1307
+ Sciences, Vol. IV-2/W1, 3&#8211;12.
1308
+ <link target='https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016'/>
1309
+ </formattedref>
1310
+ <docidentifier>L&#246;wner et al. 2016</docidentifier>
1311
+ <docnumber>2016</docnumber>
1312
+ </bibitem>
1313
+ </references>
1314
+ <references hidden='true' normative='false'>
1315
+ <bibitem id='__ab' type='internal'>
1316
+ <docidentifier type='repository'>//ab</docidentifier>
1317
+ </bibitem>
1318
+ </references>
1319
+ </bibliography>
1320
+ </standard-document>
2402
1321
  OUTPUT
2403
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2404
- .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2405
- .to be_equivalent_to(output)
1322
+ expect(strip_guid(xmlpp(Asciidoctor.convert(input, *OPTIONS)
1323
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))))
1324
+ .to be_equivalent_to(xmlpp(output))
2406
1325
  expect { Asciidoctor.convert(input, *OPTIONS) }
2407
1326
  .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2408
1327
  .to_stderr
@@ -2870,89 +1789,84 @@ RSpec.describe Asciidoctor::Standoc do
2870
1789
  .to be_equivalent_to xmlpp(output)
2871
1790
  end
2872
1791
 
2873
- private
1792
+ it "creates content-based GUIDs" do
1793
+ input = <<~INPUT
1794
+ #{ASCIIDOC_BLANK_HDR}
2874
1795
 
2875
- def mock_mathml_italicise(string)
2876
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2877
- .to receive(:mathml_mi_italics).and_return(string)
2878
- end
1796
+ .Foreword
1797
+ Foreword
2879
1798
 
2880
- def mock_iecbib_get_iec60050_103_01
2881
- expect(Iecbib::IecBibliography).to receive(:get)
2882
- .with("IEC 60050-103", nil, { keep_year: true }) do
2883
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2884
- <bibitem type="standard" id="IEC60050-103">
2885
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2886
- <docidentifier>IEC 60050-103:2009</docidentifier>
2887
- <date type="published">
2888
- <on>2009</on>
2889
- </date>
2890
- <contributor>
2891
- <role type="publisher"/>
2892
- <organization>
2893
- <name>International Electrotechnical Commission</name>
2894
- <abbreviation>IEC</abbreviation>
2895
- <uri>www.iec.ch</uri>
2896
- </organization>
2897
- </contributor>
1799
+ [NOTE,beforeclauses=true]
1800
+ ====
1801
+ Note which is very important <<a>>
1802
+ ====
1803
+
1804
+ == Introduction
1805
+ Introduction
1806
+
1807
+ == Scope
1808
+ Scope statement
1809
+
1810
+ [IMPORTANT,beforeclauses=true]
1811
+ ====
1812
+ Notice which is very important
1813
+ ====
1814
+ INPUT
1815
+ output = <<~OUTPUT
1816
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version="#{Metanorma::Standoc::VERSION}">
1817
+ <bibdata type='standard'>
1818
+ <title language='en' format='text/plain'>Document title</title>
2898
1819
  <language>en</language>
2899
- <language>fr</language>
2900
1820
  <script>Latn</script>
2901
1821
  <status>
2902
- <stage>60</stage>
1822
+ <stage>published</stage>
2903
1823
  </status>
2904
1824
  <copyright>
2905
- <from>2018</from>
2906
- <owner>
2907
- <organization>
2908
- <name>International Electrotechnical Commission</name>
2909
- <abbreviation>IEC</abbreviation>
2910
- <uri>www.iec.ch</uri>
2911
- </organization>
2912
- </owner>
1825
+ <from>2021</from>
2913
1826
  </copyright>
2914
- </bibitem>
2915
- OUTPUT
2916
- end
1827
+ <ext>
1828
+ <doctype>article</doctype>
1829
+ </ext>
1830
+ </bibdata>
1831
+ <preface>
1832
+ <note id='_f91b621e-d8cb-30bf-eef6-7d0150204829'>
1833
+ <p id='_76d95913-a379-c60f-5144-1f09655cafa6'>
1834
+ Note which is very important
1835
+ <xref target='_76d95913-a379-c60f-5144-1f09655cafa6'/>
1836
+ </p>
1837
+ </note>
1838
+ <foreword id='_0826616f-13a4-0634-baee-5003c5534175' obligation='informative'>
1839
+ <title>Foreword</title>
1840
+ <p id='_d2f825bf-3e18-6143-8777-34e59928d48c'>Foreword</p>
1841
+ </foreword>
1842
+ <introduction id='_introduction' obligation='informative'>
1843
+ <title>Introduction</title>
1844
+ <p id='_272021ab-1bfa-78ae-e860-ed770e36f3d2'>Introduction</p>
1845
+ </introduction>
1846
+ </preface>
1847
+ <sections>
1848
+ <admonition id='_068def71-3ec8-0395-8853-0e2d3ef5b841' type='important'>
1849
+ <p id='_69ec375e-c992-5be3-76dd-a2311f9bb6cc'>Notice which is very important</p>
1850
+ </admonition>
1851
+ <clause id='_scope' type='scope' inline-header='false' obligation='normative'>
1852
+ <title>Scope</title>
1853
+ <p id='_fdcef9f1-c898-da99-eff6-f3e6abde7799'>Scope statement</p>
1854
+ </clause>
1855
+ </sections>
1856
+ </standard-document>
1857
+ OUTPUT
1858
+ input1 = xmlpp(Asciidoctor.convert(input, *OPTIONS))
1859
+ .sub(/<p id='([^']+)'>(\s+)Note which is very important(\s+)<xref target='a'/,
1860
+ "<p id='\\1'>\\2Note which is very important\\3<xref target='\\1'")
1861
+ expect(input1)
1862
+ .to be_equivalent_to xmlpp(output)
2917
1863
  end
2918
1864
 
2919
- def mock_iecbib_get_iec60050_102_01
2920
- expect(Iecbib::IecBibliography).to receive(:get)
2921
- .with("IEC 60050-102", nil, { keep_year: true }) do
2922
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2923
- <bibitem type="standard" id="IEC60050-102">
2924
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2925
- <docidentifier>IEC 60050-102:2007</docidentifier>
2926
- <date type="published">
2927
- <on>2007</on>
2928
- </date>
2929
- <contributor>
2930
- <role type="publisher"/>
2931
- <organization>
2932
- <name>International Electrotechnical Commission</name>
2933
- <abbreviation>IEC</abbreviation>
2934
- <uri>www.iec.ch</uri>
2935
- </organization>
2936
- </contributor>
2937
- <language>en</language>
2938
- <language>fr</language>
2939
- <script>Latn</script>
2940
- <status>
2941
- <stage>60</stage>
2942
- </status>
2943
- <copyright>
2944
- <from>2018</from>
2945
- <owner>
2946
- <organization>
2947
- <name>International Electrotechnical Commission</name>
2948
- <abbreviation>IEC</abbreviation>
2949
- <uri>www.iec.ch</uri>
2950
- </organization>
2951
- </owner>
2952
- </copyright>
2953
- </bibitem>
2954
- OUTPUT
2955
- end
1865
+ private
1866
+
1867
+ def mock_mathml_italicise(string)
1868
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
1869
+ .to receive(:mathml_mi_italics).and_return(string)
2956
1870
  end
2957
1871
 
2958
1872
  def mock_iev