metanorma-standoc 2.2.6 → 2.2.7

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