metanorma-standoc 2.2.5 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/html/htmlstyle.css +1 -1
  3. data/lib/metanorma/standoc/base.rb +4 -5
  4. data/lib/metanorma/standoc/basicdoc.rng +0 -27
  5. data/lib/metanorma/standoc/biblio-standoc.rng +164 -0
  6. data/lib/metanorma/standoc/biblio.rng +50 -18
  7. data/lib/metanorma/standoc/cleanup.rb +18 -17
  8. data/lib/metanorma/standoc/cleanup_amend.rb +2 -2
  9. data/lib/metanorma/standoc/cleanup_asciibib.rb +110 -0
  10. data/lib/metanorma/standoc/cleanup_biblio.rb +7 -112
  11. data/lib/metanorma/standoc/cleanup_block.rb +7 -6
  12. data/lib/metanorma/standoc/cleanup_boilerplate.rb +6 -6
  13. data/lib/metanorma/standoc/cleanup_inline.rb +2 -2
  14. data/lib/metanorma/standoc/cleanup_maths.rb +12 -4
  15. data/lib/metanorma/standoc/cleanup_section.rb +19 -9
  16. data/lib/metanorma/standoc/cleanup_symbols.rb +14 -7
  17. data/lib/metanorma/standoc/cleanup_text.rb +19 -6
  18. data/lib/metanorma/standoc/cleanup_toc.rb +1 -2
  19. data/lib/metanorma/standoc/cleanup_xref.rb +55 -14
  20. data/lib/metanorma/standoc/inline.rb +29 -12
  21. data/lib/metanorma/standoc/isodoc-compile.rng +7 -0
  22. data/lib/metanorma/standoc/isodoc.rng +69 -207
  23. data/lib/metanorma/standoc/ref_utility.rb +1 -0
  24. data/lib/metanorma/standoc/render.rb +10 -1
  25. data/lib/metanorma/standoc/section.rb +10 -3
  26. data/lib/metanorma/standoc/utils.rb +6 -1
  27. data/lib/metanorma/standoc/validate.rb +9 -9
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +5 -3
  30. metadata +7 -141
  31. data/.github/workflows/rake.yml +0 -15
  32. data/.github/workflows/release.yml +0 -24
  33. data/Rakefile +0 -8
  34. data/bin/rspec +0 -18
  35. data/spec/assets/a1.adoc +0 -8
  36. data/spec/assets/a2.adoc +0 -10
  37. data/spec/assets/a3.adoc +0 -9
  38. data/spec/assets/a3a.adoc +0 -7
  39. data/spec/assets/a4.adoc +0 -4
  40. data/spec/assets/boilerplate.xml +0 -4
  41. data/spec/assets/codes.yml +0 -695
  42. data/spec/assets/correct.png +0 -0
  43. data/spec/assets/corrupt.png +0 -0
  44. data/spec/assets/header.html +0 -7
  45. data/spec/assets/html-override.css +0 -1
  46. data/spec/assets/html.scss +0 -13
  47. data/spec/assets/htmlcover.html +0 -4
  48. data/spec/assets/htmlintro.html +0 -5
  49. data/spec/assets/i18n.yaml +0 -17
  50. data/spec/assets/iso.adoc +0 -10
  51. data/spec/assets/iso.headless.html +0 -33
  52. data/spec/assets/iso.xml +0 -8
  53. data/spec/assets/iso123.rxl +0 -107
  54. data/spec/assets/rice_image1.png +0 -0
  55. data/spec/assets/scripts.html +0 -3
  56. data/spec/assets/std.css +0 -2
  57. data/spec/assets/word-override.css +0 -1
  58. data/spec/assets/word.scss +0 -13
  59. data/spec/assets/wordcover.html +0 -3
  60. data/spec/assets/wordintro.html +0 -4
  61. data/spec/assets/xref_error.adoc +0 -8
  62. data/spec/examples/103_01_02.html +0 -247
  63. data/spec/examples/codes_table.html +0 -3174
  64. data/spec/examples/datamodel/address_class_profile.adoc +0 -5
  65. data/spec/examples/datamodel/address_class_profile.presentation.xml +0 -14
  66. data/spec/examples/datamodel/address_component_profile.adoc +0 -5
  67. data/spec/examples/datamodel/blank_definition_profile.adoc +0 -5
  68. data/spec/examples/datamodel/common_models_diagram.adoc +0 -5
  69. data/spec/examples/datamodel/models/models/AddressClassProfile.yml +0 -90
  70. data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +0 -63
  71. data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +0 -15
  72. data/spec/examples/datamodel/models/models/AddressProfile.yml +0 -36
  73. data/spec/examples/datamodel/models/models/AttributeProfile.yml +0 -32
  74. data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +0 -79
  75. data/spec/examples/datamodel/models/models/Localization copy.yml +0 -23
  76. data/spec/examples/datamodel/models/models/Localization.yml +0 -23
  77. data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +0 -36
  78. data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +0 -15
  79. data/spec/examples/datamodel/models/models/Signature.yml +0 -20
  80. data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +0 -20
  81. data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +0 -16
  82. data/spec/examples/datamodel/models/models/TextDirectionCode.yml +0 -16
  83. data/spec/examples/datamodel/models/models/Validity.yml +0 -14
  84. data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +0 -22
  85. data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +0 -2
  86. data/spec/examples/datamodel/models/style.uml.inc +0 -37
  87. data/spec/examples/datamodel/models/views/CommonModels.yml +0 -9
  88. data/spec/examples/datamodel/models/views/TopDown.yml +0 -62
  89. data/spec/examples/datamodel/top_down_diagram.adoc +0 -5
  90. data/spec/examples/english.yaml +0 -69
  91. data/spec/examples/iso_123_.xml +0 -46
  92. data/spec/examples/iso_123_all_parts.xml +0 -46
  93. data/spec/examples/iso_123_no_year_note.xml +0 -47
  94. data/spec/examples/iso_124_.xml +0 -42
  95. data/spec/examples/iso_216_.xml +0 -48
  96. data/spec/examples/iso_iec_12382_.xml +0 -49
  97. data/spec/examples/rice.adoc +0 -715
  98. data/spec/examples/rice.preview.html +0 -1877
  99. data/spec/examples/rice.sh +0 -4
  100. data/spec/examples/rice_images/rice_image1.png +0 -0
  101. data/spec/examples/rice_images/rice_image2.png +0 -0
  102. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  103. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  104. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  105. data/spec/fixtures/action_schemaexpg1.svg +0 -122
  106. data/spec/fixtures/datamodel_description_sections_tree.xml +0 -327
  107. data/spec/fixtures/diagram_definitions.lutaml +0 -22
  108. data/spec/fixtures/macros_datamodel/address_class_profile.xml +0 -149
  109. data/spec/fixtures/macros_datamodel/address_component_profile.xml +0 -71
  110. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +0 -51
  111. data/spec/fixtures/macros_datamodel/common_models_diagram.xml +0 -7
  112. data/spec/fixtures/macros_datamodel/top_down_diagram.xml +0 -7
  113. data/spec/fixtures/test.exp +0 -121
  114. data/spec/fixtures/test.xmi +0 -9250
  115. data/spec/metanorma/base_spec.rb +0 -1125
  116. data/spec/metanorma/biblio_spec.rb +0 -1004
  117. data/spec/metanorma/blank_spec.rb +0 -37
  118. data/spec/metanorma/blocks_spec.rb +0 -1784
  119. data/spec/metanorma/cleanup_blocks_spec.rb +0 -1099
  120. data/spec/metanorma/cleanup_sections_spec.rb +0 -1850
  121. data/spec/metanorma/cleanup_spec.rb +0 -1920
  122. data/spec/metanorma/cleanup_terms_spec.rb +0 -1543
  123. data/spec/metanorma/datamodel/attributes_table_preprocessor_spec.rb +0 -111
  124. data/spec/metanorma/datamodel/diagram_preprocessor_spec.rb +0 -72
  125. data/spec/metanorma/inline_spec.rb +0 -724
  126. data/spec/metanorma/isobib_cache_spec.rb +0 -742
  127. data/spec/metanorma/lists_spec.rb +0 -232
  128. data/spec/metanorma/macros_concept_spec.rb +0 -1052
  129. data/spec/metanorma/macros_json2text_spec.rb +0 -10
  130. data/spec/metanorma/macros_plantuml_spec.rb +0 -402
  131. data/spec/metanorma/macros_spec.rb +0 -1183
  132. data/spec/metanorma/macros_yaml2text_spec.rb +0 -10
  133. data/spec/metanorma/processor_spec.rb +0 -96
  134. data/spec/metanorma/refs_spec.rb +0 -2807
  135. data/spec/metanorma/reqt_spec.rb +0 -130
  136. data/spec/metanorma/section_spec.rb +0 -1325
  137. data/spec/metanorma/table_spec.rb +0 -474
  138. data/spec/metanorma/validate_spec.rb +0 -886
  139. data/spec/spec_helper.rb +0 -290
  140. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +0 -781
  141. data/spec/vcr_cassettes/bsi16341.yml +0 -488
  142. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +0 -611
  143. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +0 -149
  144. data/spec/vcr_cassettes/hide_refs.yml +0 -587
  145. data/spec/vcr_cassettes/isobib_get_123.yml +0 -149
  146. data/spec/vcr_cassettes/isobib_get_123_1.yml +0 -295
  147. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +0 -385
  148. data/spec/vcr_cassettes/isobib_get_123_2.yml +0 -295
  149. data/spec/vcr_cassettes/isobib_get_123_2001.yml +0 -149
  150. data/spec/vcr_cassettes/isobib_get_124.yml +0 -149
  151. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +0 -351
  152. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +0 -560
  153. data/spec/vcr_cassettes/std-link.yml +0 -149
@@ -1,724 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Standoc do
4
- =begin
5
- it "handles spacing around markup" do
6
- input = <<~INPUT
7
- #{ASCIIDOC_BLANK_HDR}
8
- This is
9
- a paragraph with <<x>>
10
- markup _for_
11
- text, including **__nest__**ed markup.
12
- INPUT
13
- output = <<~OUTPUT
14
- <?xml version="1.0" encoding="UTF-8"?>
15
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
16
- <bibdata type="standard">
17
- <title language="en" format="text/plain">Document title</title>
18
- <language>en</language>
19
- <script>Latn</script>
20
- <status>
21
- <stage>published</stage>
22
- </status>
23
- <copyright>
24
- <from>#{Date.today.year}</from>
25
- </copyright>
26
- <ext>
27
- <doctype>standard</doctype>
28
- </ext>
29
- </bibdata>
30
- <sections>
31
- <p id="_">This is
32
- a paragraph with <xref target="x"/>
33
- markup <em>for</em>
34
- text, including <strong><em>nest</em></strong>ed markup.</p>
35
- </sections>
36
- </standard-document>
37
- OUTPUT
38
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
39
- .to be_equivalent_to(output)
40
- end
41
-
42
- it "processes inline_quoted formatting" do
43
- input = <<~INPUT
44
- #{DUMBQUOTE_BLANK_HDR}
45
- _Physical noise
46
- sources_
47
- *strong*
48
- `monospace`
49
- "double quote"
50
- 'single quote'
51
- super^script^
52
- sub~script~
53
- sub~__scr__ipt~
54
- stem:[<mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">&#x391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>]
55
- #mark#
56
- [alt]#alt#
57
- [deprecated]#deprecated#
58
- [domain]#domain#
59
- [strike]#strike#
60
- [underline]#underline#
61
- [smallcap]#smallcap#
62
- [keyword]#keyword#
63
- [css font-family:"Noto Sans JP"]#text#
64
- [css font-family:'Noto Sans JP']#text#
65
- INPUT
66
- output = <<~OUTPUT
67
- #{BLANK_HDR}
68
- <sections>
69
- <em>Physical noise sources</em>
70
- <strong>strong</strong>
71
- <tt>monospace</tt>
72
- "double quote"
73
- 'single quote'
74
- super<sup>script</sup>
75
- sub<sub>script</sub>
76
- sub<sub><em>scr</em>ipt</sub>
77
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
78
- mark
79
- <admitted><expression><name>alt</name></expression></admitted>
80
- <deprecates><expression><name>deprecated</name></expression></deprecates>
81
- <domain>domain</domain>
82
- <strike>strike</strike>
83
- <underline>underline</underline>
84
- <smallcap>smallcap</smallcap>
85
- <keyword>keyword</keyword>
86
- <span style="font-family:&quot;Noto Sans JP&quot;">text</span>
87
- <span style="font-family:'Noto Sans JP'">text</span>
88
- </sections>
89
- </standard-document>
90
- OUTPUT
91
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
92
- .to be_equivalent_to(output)
93
- end
94
-
95
- it "process mtext spaces" do
96
- input = <<~INPUT
97
- #{DUMBQUOTE_BLANK_HDR}
98
-
99
- stem:[n < 1 " for all text "]
100
- INPUT
101
- output = <<~OUTPUT
102
- #{BLANK_HDR}
103
- <sections>
104
- <p id='_'>
105
- <stem type='MathML'>
106
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
107
- <mi>n</mi>
108
- <mo/>
109
- <mn>1</mn>
110
- <mtext> for all text </mtext>
111
- </math>
112
- </stem>
113
- </p>
114
- </sections>
115
- </standard-document>
116
- OUTPUT
117
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
118
- .to be_equivalent_to(output)
119
- end
120
-
121
- it "properly handles inline substitution" do
122
- input = <<~INPUT
123
- #{DUMBQUOTE_BLANK_HDR}
124
-
125
- stem:[n < 1] +
126
- latexmath:[n < 1]
127
- stem:["&#x200c;"^199 "Hg"^+]
128
- INPUT
129
- output = <<~OUTPUT
130
- #{BLANK_HDR}
131
- <sections>
132
- <p id="_">
133
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem><br/>
134
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
135
- <stem type='MathML'>
136
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
137
- <msup>
138
- <mrow>
139
- <mtext>‌</mtext>
140
- </mrow>
141
- <mrow>
142
- <mn>199</mn>
143
- </mrow>
144
- </msup>
145
- <msup>
146
- <mrow>
147
- <mtext>Hg</mtext>
148
- </mrow>
149
- <mrow>
150
- <mo>+</mo>
151
- </mrow>
152
- </msup>
153
- </math>
154
- </stem>
155
- </p>
156
- </sections>
157
- </standard-document>
158
- OUTPUT
159
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
160
- .to be_equivalent_to(output)
161
- end
162
-
163
- it "normalises inline stem, straight quotes" do
164
- input = <<~INPUT
165
- #{DUMBQUOTE_BLANK_HDR}
166
-
167
- stem:[n < 1]
168
- latexmath:[n < 1]
169
- stem:["&#x200c;"^199 "Hg"^+]
170
- INPUT
171
- output = <<~OUTPUT
172
- #{BLANK_HDR}
173
- <sections>
174
- <p id="_">
175
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
176
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
177
- <stem type='MathML'>
178
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
179
- <msup>
180
- <mrow>
181
- <mtext>‌</mtext>
182
- </mrow>
183
- <mrow>
184
- <mn>199</mn>
185
- </mrow>
186
- </msup>
187
- <msup>
188
- <mrow>
189
- <mtext>Hg</mtext>
190
- </mrow>
191
- <mrow>
192
- <mo>+</mo>
193
- </mrow>
194
- </msup>
195
- </math>
196
- </stem>
197
- </p>
198
- </sections>
199
- </standard-document>
200
- OUTPUT
201
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
202
- .to be_equivalent_to(output)
203
- end
204
-
205
- it "normalises inline stem, smart quotes" do
206
- input = <<~INPUT
207
- #{ASCIIDOC_BLANK_HDR}
208
-
209
- stem:[n < 1]
210
- latexmath:[n < 1]
211
- stem:["&#x200c;"^199 "Hg"^+]
212
- INPUT
213
- output = <<~OUTPUT
214
- #{BLANK_HDR}
215
- <sections>
216
- <p id="_">
217
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&lt;</mo><mn>1</mn></math></stem>
218
- <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo>&lt;</mo> <mn>1</mn> </mrow> </math></stem>
219
- <stem type='MathML'>
220
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
221
- <msup>
222
- <mrow>
223
- <mtext>‌</mtext>
224
- </mrow>
225
- <mrow>
226
- <mn>199</mn>
227
- </mrow>
228
- </msup>
229
- <msup>
230
- <mrow>
231
- <mtext>Hg</mtext>
232
- </mrow>
233
- <mrow>
234
- <mo>+</mo>
235
- </mrow>
236
- </msup>
237
- </math>
238
- </stem>
239
- </p>
240
- </sections>
241
- </standard-document>
242
- OUTPUT
243
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
244
- .to be_equivalent_to(output)
245
- end
246
-
247
- it "generates desired smart quotes for 'dd'" do
248
- input = <<~INPUT
249
- #{ASCIIDOC_BLANK_HDR}
250
- '99'.
251
-
252
- INPUT
253
- output = <<~OUTPUT
254
- #{BLANK_HDR}
255
- <sections><p id="_">‘99’.</p>
256
- </sections>
257
- </standard-document>
258
- OUTPUT
259
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
260
- .to be_equivalent_to(output)
261
- end
262
-
263
- it "processes breaks" do
264
- input = <<~INPUT
265
- #{ASCIIDOC_BLANK_HDR}
266
- Line break +
267
- line break
268
-
269
- '''
270
-
271
- <<<
272
-
273
- [%landscape]
274
- <<<
275
-
276
- [%portrait]
277
- <<<
278
- INPUT
279
- output = <<~OUTPUT
280
- #{BLANK_HDR}
281
- <sections><p id="_">Line break<br/>
282
- line break</p>
283
- <hr/>
284
- <pagebreak/>
285
- <pagebreak orientation="landscape"/>
286
- <pagebreak orientation="portrait"/>
287
- </sections>
288
- </standard-document>
289
- OUTPUT
290
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
291
- .to be_equivalent_to(output)
292
- end
293
-
294
- it "processes links" do
295
- input = <<~INPUT
296
- #{ASCIIDOC_BLANK_HDR}
297
- mailto:fred@example.com
298
- http://example.com[]
299
- http://example.com[Link]
300
- http://example.com[Link,title="tip"]
301
- link:++https://asciidoctor.org/now_this__link_works.html++[]
302
- http://example.com[Link,update-type=true]
303
- link:../example[updatetype=true]
304
- link:../example[Link,update-type=true]
305
- INPUT
306
- output = <<~OUTPUT
307
- #{BLANK_HDR}
308
- <sections>
309
- <p id="_">mailto:fred@example.com
310
- <link target="http://example.com"/>
311
- <link target="http://example.com">Link</link>
312
- <link target="http://example.com" alt="tip">Link</link>
313
- <link target='https://asciidoctor.org/now_this__link_works.html'/>
314
- <link target="http://example.com" update-type="true">Link</link>
315
- <link target="../example" update-type="true"/>
316
- <link target="../example" update-type="true">Link</link></p>
317
- </p>
318
- </sections>
319
- </standard-document>
320
- OUTPUT
321
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
322
- .to be_equivalent_to(output)
323
- end
324
-
325
- it "processes bookmarks" do
326
- input = <<~INPUT
327
- #{ASCIIDOC_BLANK_HDR}
328
- Text [[bookmark]] Text
329
- INPUT
330
- output = <<~OUTPUT
331
- #{BLANK_HDR}
332
- <sections>
333
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
334
- </sections>
335
- </standard-document>
336
- OUTPUT
337
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
338
- .to be_equivalent_to(output)
339
- end
340
- =end
341
- it "processes crossreferences" do
342
- input = <<~INPUT
343
- #{ASCIIDOC_BLANK_HDR}
344
- [[reference]]
345
- == Section
346
-
347
- Inline Reference to <<reference>>
348
- Footnoted Reference to <<reference,fn>>
349
- Inline Reference with Text to <<reference,text>>
350
- Footnoted Reference with Text to <<reference,fn: text>>
351
- Anchored Crossreference to other document <<a.adoc#b>>
352
- Capitalised Reference to <<reference,droploc%capital%>>
353
- Lowercase Footnoted Reference to <<reference,capital%droploc%fn>>
354
- Capitalised Reference to <<reference,capital%>>
355
- Lowercase Footnoted Reference to <<reference,capital%fn>>
356
- Capitalised Reference to <<reference,droploc%>>
357
- Lowercase Footnoted Reference to <<reference,droploc%fn>>
358
- Capitalised Reference to <<reference,droploc%capital%>>
359
- Lowercase Footnoted Reference to <<reference,droploc%capital%fn>>
360
- Lowercase Footnoted Reference to <<reference,droploc%capital%text>>
361
- INPUT
362
- output = <<~OUTPUT
363
- #{BLANK_HDR}
364
- <sections>
365
- <clause id="reference" inline-header="false" obligation="normative">
366
- <title>Section</title>
367
- <p id="_">Inline Reference to <xref target="reference"/>
368
- Footnoted Reference to <xref target="reference"/>
369
- Inline Reference with Text to <xref target="reference">text</xref>
370
- Footnoted Reference with Text to <xref target="reference">text</xref>
371
- Anchored Crossreference to other document <xref target="a#b"/>
372
- Capitalised Reference to <xref target='reference' case='capital' droploc="true"></xref>
373
- Lowercase Footnoted Reference to <xref target='reference' case='capital' droploc="true"></xref>
374
- Capitalised Reference to
375
- <xref target='reference' case='capital'/>
376
- Lowercase Footnoted Reference to
377
- <xref target='reference' case='capital'/>
378
- Capitalised Reference to
379
- <xref target='reference' droploc='true'/>
380
- Lowercase Footnoted Reference to
381
- <xref target='reference' droploc='true'/>
382
- Capitalised Reference to
383
- <xref target='reference' case='capital' droploc='true'/>
384
- Lowercase Footnoted Reference to
385
- <xref target='reference' case='capital' droploc='true'/>
386
- Lowercase Footnoted Reference to
387
- <xref target='reference' case='capital' droploc='true'>text</xref>
388
- </p>
389
- </clause>
390
- </sections>
391
- </standard-document>
392
- OUTPUT
393
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
394
- .to be_equivalent_to(xmlpp(output))
395
- end
396
-
397
- it "processes formatting within crossreferences" do
398
- input = <<~INPUT
399
- #{ASCIIDOC_BLANK_HDR}
400
- [[reference]]
401
- == Section
402
-
403
- <<reference,_reference_>>
404
- <<reference,_**reference**_>>
405
- <<reference,_A_ stem:[x^2]>>
406
- <<reference,_A_ footnote:[_B_]>>
407
- INPUT
408
- output = <<~OUTPUT
409
- #{BLANK_HDR}
410
- <sections>
411
- <clause id="reference" inline-header="false" obligation="normative">
412
- <title>Section</title>
413
- <p id="_"><xref target="reference"><em>reference</em></xref>
414
- <xref target="reference"><em><strong>reference</strong></em></xref>
415
- <xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
416
- <xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
417
- </clause>
418
- </sections>
419
- </standard-document>
420
- OUTPUT
421
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
422
- .to be_equivalent_to(xmlpp(output))
423
- end
424
-
425
- it "processes formatting within crossreferences to non-existent anchor" do
426
- input = <<~INPUT
427
- #{ASCIIDOC_BLANK_HDR}
428
- == Section
429
-
430
- <<reference,_reference_>>
431
- <<reference,_**reference**_>>
432
- <<reference,_A_ stem:[x^2]>>
433
- <<reference,_A_ footnote:[_B_]>>
434
- INPUT
435
- output = <<~OUTPUT
436
- #{BLANK_HDR}
437
- <sections>
438
- <clause id="_" inline-header="false" obligation="normative">
439
- <title>Section</title>
440
- <p id="_"><xref target="reference"><em>reference</em></xref>
441
- <xref target="reference"><em><strong>reference</strong></em></xref>
442
- <xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
443
- <xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
444
- </clause>
445
- </sections>
446
- </standard-document>
447
- OUTPUT
448
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
449
- .to be_equivalent_to(xmlpp(output))
450
- end
451
-
452
- it "processes combinations of crossreferences" do
453
- input = <<~INPUT
454
- #{ASCIIDOC_BLANK_HDR}
455
- == Section
456
-
457
- <<ref1;to!ref2>>
458
- <<from!ref1;to!ref2,text>>
459
- <<ref1;ref2>>
460
- <<ref1;and!ref2>>
461
- <<ref1;or!ref2,text>>
462
- <<from!ref1;to!ref2;and!ref3;to!ref4>>
463
- INPUT
464
- output = <<~OUTPUT
465
- #{BLANK_HDR}
466
- <sections>
467
- <clause id="_" inline-header="false" obligation="normative">
468
- <title>Section</title>
469
- <p id="_"><xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/></xref>
470
- <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/>text</xref>
471
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/></xref>
472
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/></xref>
473
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/>text</xref>
474
- <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/><location target="ref3" connective="and"/><location target="ref4" connective="to"/></xref></p>
475
- </clause>
476
- </sections>
477
- </standard-document>
478
- OUTPUT
479
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
480
- .to be_equivalent_to(xmlpp(output))
481
- end
482
-
483
- it "processes bibliographic anchors" do
484
- input = <<~INPUT
485
- #{ASCIIDOC_BLANK_HDR}
486
- [bibliography]
487
- == Normative References
488
-
489
- * [[[ISO712,x]]] Reference
490
- * [[[ISO713]]] Reference
491
-
492
- INPUT
493
- output = <<~OUTPUT
494
- #{BLANK_HDR}
495
- <sections>
496
-
497
- </sections><bibliography><references id="_" obligation="informative" normative="true">
498
- <title>Normative references</title>
499
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
500
- <bibitem id="ISO712">
501
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
502
- <docidentifier>x</docidentifier>
503
- </bibitem>
504
- <bibitem id="ISO713">
505
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
506
- <docidentifier>ISO713</docidentifier>
507
- <docnumber>713</docnumber>
508
- </bibitem>
509
- </references>
510
- </bibliography>
511
- </standard-document>
512
- OUTPUT
513
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
514
- .to be_equivalent_to(output)
515
- end
516
-
517
- it "processes formatting within bibliographic references" do
518
- input = <<~INPUT
519
- #{ASCIIDOC_BLANK_HDR}
520
- == Section
521
-
522
- <<reference,_reference_>>
523
- <<reference,_**reference**_>>
524
- <<reference,_A_ stem:[x^2]>>
525
- <<reference,_A_ footnote:[_B_]>>
526
- <<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
527
-
528
- [bibliography]
529
- == Normative References
530
-
531
- * [[[reference,ABC]]] Reference
532
- INPUT
533
- output = <<~OUTPUT
534
- #{BLANK_HDR}
535
- <sections><clause id="_" inline-header="false" obligation="normative">
536
- <title>Section</title>
537
- <p id="_"><eref type="inline" bibitemid="reference" citeas="ABC"><em>reference</em></eref>
538
- <eref type="inline" bibitemid="reference" citeas="ABC"><em><strong>reference</strong></em></eref>
539
- <eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></eref>
540
- <eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></eref>
541
- <eref type="inline" bibitemid="reference" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2"><p id="_">Superseded by ISO 9000:2015.</p></fn></eref></p>
542
- </clause>
543
- </sections><bibliography><references id="_" normative="true" obligation="informative">
544
- <title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
545
- <bibitem id="reference">
546
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
547
- <docidentifier>ABC</docidentifier>
548
- </bibitem>
549
- </references></bibliography>
550
- </standard-document>
551
- OUTPUT
552
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
553
- .to be_equivalent_to(output)
554
- end
555
-
556
- it "processes formatting within term sources" do
557
- input = <<~INPUT
558
- #{ASCIIDOC_BLANK_HDR}
559
- == Terms and Definitions
560
-
561
- === Term1
562
-
563
- [.source]
564
- <<reference,_reference_>>
565
-
566
- [.source]
567
- <<reference,_**reference**_>>
568
-
569
- [.source]
570
- <<reference,_A_ stem:[x^2]>>
571
-
572
- [.source]
573
- <<reference,_A_ footnote:[_B_]>>
574
-
575
- [.source]
576
- <<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
577
-
578
- [bibliography]
579
- == Normative References
580
-
581
- * [[[reference,ABC]]] Reference
582
- INPUT
583
- output = <<~OUTPUT
584
- #{BLANK_HDR}
585
- <sections><terms id="_" obligation="normative">
586
- <title>Terms and definitions</title><p id="_">For the purposes of this document,
587
- the following terms and definitions apply.</p>
588
-
589
- <term id="term-Term1"><preferred><expression><name>Term1</name></expression><termsource status="identical" type="authoritative">
590
- <origin bibitemid="reference" type="inline" citeas="ABC">
591
- <em>reference</em>
592
- </origin>
593
- </termsource><termsource status="identical" type="authoritative">
594
- <origin bibitemid="reference" type="inline" citeas="ABC">
595
- <em>
596
- <strong>reference</strong>
597
- </em>
598
- </origin>
599
- </termsource><termsource status="identical" type="authoritative">
600
- <origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></origin>
601
- </termsource><termsource status="identical" type="authoritative">
602
- <origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em><fn reference="1">
603
- <p id="_">
604
- <em>B</em>
605
- </p>
606
- </fn></origin>
607
- </termsource><termsource status="identical" type="authoritative">
608
- <origin bibitemid="reference" type="inline" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2">
609
- <p id="_">Superseded by ISO 9000:2015.</p>
610
- </fn></origin>
611
- </termsource></preferred>
612
-
613
-
614
-
615
- </term>
616
- </terms>
617
- </sections><bibliography><references id="_" normative="true" obligation="informative">
618
- <title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
619
- <bibitem id="reference">
620
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
621
- <docidentifier>ABC</docidentifier>
622
-
623
- </bibitem>
624
- </references></bibliography>
625
- </standard-document>
626
- OUTPUT
627
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
628
- .to be_equivalent_to(output)
629
- end
630
-
631
- it "processes footnotes" do
632
- input = <<~INPUT
633
- #{ASCIIDOC_BLANK_HDR}
634
- Hello!footnote:[Footnote text]
635
-
636
- == Title footnote:[Footnote text 2]
637
-
638
- Hello.footnote:abc[This is a repeated footnote]
639
-
640
- Repetition.footnote:abc[]
641
- INPUT
642
- output = <<~OUTPUT
643
- #{BLANK_HDR}
644
- <preface><foreword id="_" obligation="informative">
645
- <title>Foreword</title>
646
- <p id="_">Hello!<fn reference="1">
647
- <p id="_">Footnote text</p>
648
- </fn></p>
649
- </foreword></preface><sections>
650
- <clause id="_" inline-header="false" obligation="normative">
651
- <title>Title<fn reference="2">
652
- <p id="_">Footnote text 2</p>
653
- </fn></title>
654
- <p id='_'>
655
- Hello.
656
- <fn reference='3'>
657
- <p id='_'>This is a repeated footnote</p>
658
- </fn>
659
- </p>
660
- <p id='_'>
661
- Repetition.
662
- <fn reference='3'>
663
- <p id='_'>This is a repeated footnote</p>
664
- </fn>
665
- </p>
666
- </clause></sections>
667
- </standard-document>
668
- OUTPUT
669
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
670
- .to be_equivalent_to(output)
671
- end
672
-
673
- it "processes index terms" do
674
- input = <<~INPUT
675
- #{ASCIIDOC_BLANK_HDR}
676
- ((See)) Index ((_term_)) and(((A~B~, stem:[alpha], &#x2c80;))).
677
- INPUT
678
- output = <<~OUTPUT
679
- #{BLANK_HDR}
680
- <sections>
681
- <p id="_">See<index><primary>See</primary></index> Index <em>term</em><index><primary><em>term</em></primary></index> and<index><primary>A<sub>B</sub></primary><secondary><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>α</mi></math></stem></secondary><tertiary>Ⲁ</tertiary></index>.</p>
682
- </sections>
683
- </standard-document>
684
- OUTPUT
685
- expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
686
- .to be_equivalent_to(output)
687
- end
688
-
689
- it "processes format-specific inline pass" do
690
- input = <<~INPUT
691
- #{ASCIIDOC_BLANK_HDR}
692
-
693
- pass-format:rfc,html[<abc>X &gt; Y</abc> http://www.example.com (c)]
694
- INPUT
695
- output = <<~OUTPUT
696
- #{BLANK_HDR}
697
- <sections>
698
- <p id='_'>
699
- <passthrough formats='rfc,html'>&lt;abc&gt;X &gt; Y&lt;/abc&gt; http://www.example.com (c)</passthrough>
700
- </p>
701
- </sections>
702
- </standard-document>
703
- OUTPUT
704
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
705
- .to be_equivalent_to xmlpp(output)
706
- end
707
-
708
- it "processes Metanorma XML inline pass" do
709
- input = <<~INPUT
710
- #{ASCIIDOC_BLANK_HDR}
711
-
712
- +<abc>X &gt;+ +++Y+++ pass:c[</abc>]
713
- INPUT
714
- output = <<~OUTPUT
715
- #{BLANK_HDR}
716
- <sections>
717
- <p id='_'>&lt;abc&gt;X &gt; Y &lt;/abc&gt;</p>
718
- </sections>
719
- </standard-document>
720
- OUTPUT
721
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
722
- .to be_equivalent_to xmlpp(output)
723
- end
724
- end