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,1920 +0,0 @@
1
- require "spec_helper"
2
- require "relaton_iec"
3
- require "fileutils"
4
-
5
- RSpec.describe Metanorma::Standoc do
6
- it "applies smartquotes by default" do
7
- input = <<~INPUT
8
- #{ASCIIDOC_BLANK_HDR}
9
- == "Quotation" A's
10
-
11
- '24:00:00'.
12
-
13
- _emphasis_ *strong* `monospace` "double quote" 'single quote'
14
- INPUT
15
- output = <<~OUTPUT
16
- #{BLANK_HDR}
17
- <sections>
18
- <clause id="_" inline-header="false" obligation="normative">
19
- <title>“Quotation” A’s</title>
20
- <p id='_'>‘24:00:00’.</p>
21
- <p id='_'>
22
- <em>emphasis</em>
23
- <strong>strong</strong>
24
- <tt>monospace</tt>
25
- “double quote” ‘single quote’
26
- </p>
27
- </clause>
28
- </sections>
29
- </standard-document>
30
- OUTPUT
31
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
32
- .to be_equivalent_to xmlpp(output)
33
- end
34
-
35
- it "applies smartquotes when requested" do
36
- input = <<~INPUT
37
- = Document title
38
- Author
39
- :docfile: test.adoc
40
- :nodoc:
41
- :novalid:
42
- :no-isobib:
43
- :smartquotes: true
44
-
45
- == "Quotation" A's
46
- INPUT
47
- output = <<~OUTPUT
48
- #{BLANK_HDR}
49
- <sections>
50
- <clause id="_" inline-header="false" obligation="normative">
51
- <title>“Quotation” A’s</title>
52
- </clause>
53
- </sections>
54
- </standard-document>
55
- OUTPUT
56
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
57
- .to be_equivalent_to xmlpp(output)
58
- end
59
-
60
- it "does not apply smartquotes when requested not to" do
61
- input = <<~INPUT
62
- = Document title
63
- Author
64
- :docfile: test.adoc
65
- :nodoc:
66
- :novalid:
67
- :no-isobib:
68
- :smartquotes: false
69
-
70
- == "Quotation" A's
71
-
72
- `"quote" A's`
73
- INPUT
74
- output = <<~OUTPUT
75
- #{BLANK_HDR}
76
- <sections>
77
- <clause id="_" inline-header="false" obligation="normative">
78
- <title>"Quotation" A's</title>
79
- <p id="_">
80
- <tt>"quote" A's</tt>
81
- </p>
82
- </clause>
83
- </sections>
84
- </standard-document>
85
- OUTPUT
86
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
87
- .to be_equivalent_to xmlpp(output)
88
- end
89
-
90
- it "does not apply smartquotes to sourcecode, tt, pre, pseudocode" do
91
- input = <<~INPUT
92
- = Document title
93
- Author
94
- :docfile: test.adoc
95
- :nodoc:
96
- :novalid:
97
- :no-isobib:
98
- :smartquotes: true
99
-
100
- == "Quotation" A's
101
-
102
- "Quotation" A's
103
-
104
- `"quote" A's`
105
-
106
- [source]
107
- ----
108
- "quote" A's
109
- ----
110
-
111
- [pseudocode]
112
- ====
113
- "quote" A's
114
- ====
115
-
116
- INPUT
117
- output = <<~OUTPUT
118
- #{BLANK_HDR}
119
- <sections>
120
- <clause id="_" inline-header="false" obligation="normative"><title>“Quotation” A’s</title><p id="_">“Quotation” A’s</p>
121
- <p id="_">
122
- <tt>"quote" A’s</tt>
123
- </p>
124
- <sourcecode id="_">"quote" A's</sourcecode>
125
- <figure id='_' class='pseudocode'>
126
- <p id='_'>"quote" A's</p>
127
- </figure>
128
- </clause>
129
- </sections>
130
- </standard-document>
131
- OUTPUT
132
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
133
- .to be_equivalent_to xmlpp(output)
134
- end
135
-
136
- it "handles < > &amp; in Asciidoctor correctly" do
137
- input = <<~INPUT
138
- #{ASCIIDOC_BLANK_HDR}
139
- == {blank}
140
-
141
- <&amp;>
142
- INPUT
143
- output = <<~OUTPUT
144
- #{BLANK_HDR}
145
- <sections>
146
- <clause id="_" inline-header="false" obligation="normative">
147
- <p id="_">&lt;&amp;&gt;</p>
148
- </clause>
149
- </sections>
150
- </standard-document>
151
- OUTPUT
152
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
153
- .to be_equivalent_to xmlpp(output)
154
- end
155
-
156
- it "ignores tags when applying smartquotes" do
157
- input = <<~INPUT
158
- #{ASCIIDOC_BLANK_HDR}
159
-
160
- "*word*",
161
-
162
- "link:http://example.com[]",
163
-
164
- "((ppt))",
165
-
166
- "((ppm))", "((ppt))"
167
-
168
- "((ppm))"&#xa0;
169
-
170
- ....
171
- ((ppm))",
172
- ....
173
- INPUT
174
- output = <<~OUTPUT
175
- #{BLANK_HDR}
176
- <sections>
177
- <p id='_'>“<strong>word</strong>”,</p>
178
- <p id='_'>“<link target='http://example.com'/>”,</p>
179
- <p id='_'>&#8220;ppt&#8221;,
180
- <index>
181
- <primary>ppt</primary>
182
- </index>
183
- </p>
184
- <p id='_'>&#8220;ppm&#8221;,
185
- <index>
186
- <primary>ppm</primary>
187
- </index>
188
- &#8220;ppt&#8221;
189
- <index>
190
- <primary>ppt</primary>
191
- </index>
192
- </p>
193
- <p id='_'>&#8220;ppm
194
- <index>
195
- <primary>ppm</primary>
196
- </index>
197
- &#8221;&#160;
198
- </p>
199
- <figure id='_'>
200
- <pre id='_'>((ppm))",</pre>
201
- </figure>
202
- </sections>
203
- </standard-document>
204
- OUTPUT
205
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
206
- .to be_equivalent_to xmlpp(output)
207
- end
208
-
209
- it "removes empty text elements" do
210
- input = <<~INPUT
211
- #{ASCIIDOC_BLANK_HDR}
212
- == {blank}
213
- INPUT
214
- output = <<~OUTPUT
215
- #{BLANK_HDR}
216
- <sections>
217
- <clause id="_" inline-header="false" obligation="normative">
218
-
219
- </clause>
220
- </sections>
221
- </standard-document>
222
- OUTPUT
223
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
224
- .to be_equivalent_to xmlpp(output)
225
- end
226
-
227
- it "converts xrefs to references into erefs" do
228
- input = <<~INPUT
229
- #{ASCIIDOC_BLANK_HDR}
230
- <<iso216>>
231
- <<iso216,droploc%capital%>>
232
-
233
- [bibliography]
234
- == Normative References
235
- * [[[iso216,ISO 216:2001]]], _Reference_
236
- INPUT
237
- output = <<~OUTPUT
238
- #{BLANK_HDR}
239
- <preface><foreword id="_" obligation="informative">
240
- <title>Foreword</title>
241
- <p id="_">
242
- <eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
243
- <eref type='inline' case='capital' droploc='true' bibitemid='iso216' citeas='ISO 216:2001'/>
244
- </p>
245
- </foreword></preface><sections>
246
- </sections><bibliography><references id="_" obligation="informative" normative="true">
247
- <title>Normative references</title>
248
- #{NORM_REF_BOILERPLATE}
249
- <bibitem id="iso216" type="standard">
250
- <title format="text/plain">Reference</title>
251
- <docidentifier>ISO 216:2001</docidentifier>
252
- <docnumber>216</docnumber>
253
- <date type="published">
254
- <on>2001</on>
255
- </date>
256
- <contributor>
257
- <role type="publisher"/>
258
- <organization>
259
- <name>ISO</name>
260
- </organization>
261
- </contributor>
262
- </bibitem>
263
- </references>
264
- </bibliography>
265
- </standard-document>
266
- OUTPUT
267
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
268
- .to be_equivalent_to xmlpp(output)
269
- end
270
-
271
- it "extracts localities from erefs" do
272
- input = <<~INPUT
273
- #{ASCIIDOC_BLANK_HDR}
274
- <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
275
- <<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>>
276
- <<iso216,_whole_>>
277
- <<iso216,a _whole_ flagon>>
278
- <<iso216,whole,clause=3,a _whole_ flagon>>
279
- <<iso216,droploc%capital%whole,clause=3,a _whole_ flagon>>
280
-
281
- [bibliography]
282
- == Normative References
283
- * [[[iso216,ISO 216]]], _Reference_
284
- INPUT
285
- output = <<~OUTPUT
286
- #{BLANK_HDR}
287
- <preface><foreword id="_" obligation="informative">
288
- <title>Foreword</title>
289
- <p id="_">
290
- <eref type="inline" bibitemid="iso216" citeas="ISO 216">
291
- <localityStack>
292
- <locality type="whole"/><locality type="clause"><referenceFrom>3</referenceFrom></locality><locality type="example"><referenceFrom>9</referenceFrom><referenceTo>11</referenceTo></locality><locality type="locality:prelude"><referenceFrom>33 a</referenceFrom></locality><locality type="locality:entirety"/>
293
- </localityStack>
294
- the reference,xyz</eref>
295
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
296
- <localityStack connective="and">
297
- <locality type='whole'/>
298
- <locality type='clause'>
299
- <referenceFrom>3</referenceFrom>
300
- </locality>
301
- <locality type='example'>
302
- <referenceFrom>9</referenceFrom>
303
- <referenceTo>11</referenceTo>
304
- </locality>
305
- <locality type='locality:prelude'>
306
- <referenceFrom>33</referenceFrom>
307
- </locality>
308
- <locality type='locality:entirety'>
309
- <referenceFrom>the reference</referenceFrom>
310
- </locality>
311
- </localityStack>
312
- <localityStack connective="and">
313
- <locality type='whole'/>
314
- <locality type='clause'>
315
- <referenceFrom>3</referenceFrom>
316
- </locality>
317
- <locality type='example'>
318
- <referenceFrom>9</referenceFrom>
319
- <referenceTo>11</referenceTo>
320
- </locality>
321
- <locality type='locality:prelude'>
322
- <referenceFrom>33</referenceFrom>
323
- </locality>
324
- <locality type='locality:URL'/>
325
- </localityStack>
326
- the reference,xyz
327
- </eref>
328
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
329
- <em>whole</em>
330
- </eref>
331
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
332
- a
333
- <em>whole</em>
334
- flagon
335
- </eref>
336
- <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
337
- <localityStack>
338
- <locality type='whole'/>
339
- <locality type='clause'>
340
- <referenceFrom>3</referenceFrom>
341
- </locality>
342
- </localityStack>
343
- a
344
- <em>whole</em>
345
- flagon
346
- </eref>
347
- <eref type='inline' case='capital' droploc='true' bibitemid='iso216' citeas='ISO 216'>
348
- <localityStack>
349
- <locality type='whole'/>
350
- <locality type='clause'>
351
- <referenceFrom>3</referenceFrom>
352
- </locality>
353
- </localityStack>
354
- a
355
- <em>whole</em>
356
- flagon
357
- </eref>
358
- </p>
359
- </foreword></preface><sections>
360
- </sections><bibliography><references id="_" obligation="informative" normative="true">
361
- <title>Normative references</title>
362
- #{NORM_REF_BOILERPLATE}
363
- <bibitem id="iso216" type="standard">
364
- <title format="text/plain">Reference</title>
365
- <docidentifier>ISO 216</docidentifier>
366
- <docnumber>216</docnumber>
367
- <contributor>
368
- <role type="publisher"/>
369
- <organization>
370
- <name>ISO</name>
371
- </organization>
372
- </contributor>
373
- </bibitem>
374
- </references>
375
- </bibliography>
376
- </standard-document>
377
- OUTPUT
378
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
379
- .to be_equivalent_to xmlpp(output)
380
- end
381
-
382
- it "strips type from xrefs" do
383
- input = <<~INPUT
384
- #{ASCIIDOC_BLANK_HDR}
385
- <<iso216>>
386
-
387
- [bibliography]
388
- == Clause
389
- * [[[iso216,ISO 216]]], _Reference_
390
- INPUT
391
- output = <<~OUTPUT
392
- #{BLANK_HDR}
393
- <preface>
394
- <foreword id="_" obligation="informative">
395
- <title>Foreword</title>
396
- <p id="_">
397
- <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
398
- </p>
399
- </foreword></preface><sections>
400
- </sections><bibliography><references id="_" obligation="informative" normative="false">
401
- <title>Bibliography</title>
402
- <bibitem id="iso216" type="standard">
403
- <title format="text/plain">Reference</title>
404
- <docidentifier>ISO 216</docidentifier>
405
- <docnumber>216</docnumber>
406
- <contributor>
407
- <role type="publisher"/>
408
- <organization>
409
- <name>ISO</name>
410
- </organization>
411
- </contributor>
412
- </bibitem>
413
- </references></bibliography>
414
- </standard-document>
415
- OUTPUT
416
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
417
- .to be_equivalent_to xmlpp(output)
418
- end
419
-
420
- it "processes localities in term sources" do
421
- input = <<~INPUT
422
- #{ASCIIDOC_BLANK_HDR}
423
- == Terms and Definitions
424
-
425
- === Term1
426
-
427
- Definition 0
428
-
429
- [.source]
430
- <<ISO2191,section=1>>
431
- INPUT
432
- output = <<~OUTPUT
433
- #{BLANK_HDR}
434
- <sections>
435
- <terms id="_" obligation="normative">
436
- <title>Terms and definitions</title>
437
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
438
- <term id="term-Term1">
439
- <preferred><expression><name>Term1</name></expression></preferred>
440
- <definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
441
- <termsource status="identical" type="authoritative">
442
- <origin bibitemid="ISO2191" type="inline" citeas="">
443
- <localityStack>
444
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
445
- </localityStack>
446
- </origin>
447
- </termsource>
448
- </term>
449
- </terms>
450
- </sections>
451
- </standard-document>
452
- OUTPUT
453
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
454
- .to be_equivalent_to xmlpp(output)
455
- end
456
-
457
- it "numbers bibliographic notes and footnotes sequentially" do
458
- input = <<~INPUT
459
- #{ASCIIDOC_BLANK_HDR}
460
- footnote:[Footnote]
461
-
462
- [bibliography]
463
- == Normative References
464
-
465
- * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
466
-
467
- == Clause
468
- footnote:[Footnote2]
469
- INPUT
470
- output = <<~OUTPUT
471
- #{BLANK_HDR}
472
- <preface><foreword id="_" obligation="informative">
473
- <title>Foreword</title>
474
- <p id="_"><fn reference="1">
475
- <p id="_">Footnote</p>
476
- </fn>
477
- </p>
478
- </foreword></preface><sections>
479
-
480
- <clause id="_" inline-header="false" obligation="normative">
481
- <title>Clause</title>
482
- <p id="_"><fn reference="2">
483
- <p id="_">Footnote2</p>
484
- </fn>
485
- </p>
486
- </clause></sections><bibliography><references id="_" obligation="informative" normative="true">
487
- <title>Normative references</title>
488
- #{NORM_REF_BOILERPLATE}
489
- <bibitem id="iso123" type="standard">
490
- <title format="text/plain">Standard</title>
491
- <docidentifier>ISO 123:—</docidentifier>
492
- <docnumber>123</docnumber>
493
- <date type="published">
494
- <on>–</on>
495
- </date>
496
- <contributor>
497
- <role type="publisher"/>
498
- <organization>
499
- <name>ISO</name>
500
- </organization>
501
- </contributor>
502
- <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
503
- </bibitem>
504
- </references>
505
- </bibliography>
506
- </standard-document>
507
- OUTPUT
508
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
509
- .to be_equivalent_to xmlpp(output)
510
- end
511
-
512
- it "separates IEV citations by top-level clause" do
513
- FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
514
- FileUtils.mv File.expand_path("~/.relaton/cache"),
515
- File.expand_path("~/.relaton-bib.pstore1"), force: true
516
- FileUtils.rm_rf File.expand_path("~/.iev.pstore1")
517
- FileUtils.mv File.expand_path("~/.iev.pstore"),
518
- File.expand_path("~/.iev.pstore1"), force: true
519
- FileUtils.rm_rf "relaton/cache"
520
- FileUtils.rm_rf "test.iev.pstore"
521
- # mock_iev
522
- VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
523
- input = <<~INPUT
524
- #{CACHED_ISOBIB_BLANK_HDR}
525
-
526
- [bibliography]
527
- == Normative References
528
- * [[[iev,IEV]]], _iev_
529
-
530
- == Terms and definitions
531
- === Automation1
532
-
533
- Definition 1
534
-
535
- [.source]
536
- <<iev,clause="103-01-02">>
537
-
538
- === Automation2
539
-
540
- Definition 2
541
-
542
- [.source]
543
- <<iev,clause="102-01-02">>
544
-
545
- === Automation3
546
-
547
- Definition 3
548
-
549
- [.source]
550
- <<iev,clause="103-01-02">>
551
- INPUT
552
- output = <<~OUTPUT
553
- #{BLANK_HDR}
554
- <sections>
555
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
556
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
557
- <term id="term-Automation1">
558
- <preferred><expression><name>Automation1</name></expression></preferred>
559
- <definition><verbal-definition><p id='_'>Definition 1</p></verbal-definition></definition>
560
- <termsource status="identical" type="authoritative">
561
- <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
562
- <localityStack>
563
- <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
564
- </localityStack>
565
- </origin>
566
- </termsource>
567
- </term>
568
- <term id="term-Automation2">
569
- <preferred><expression><name>Automation2</name></expression></preferred>
570
- <definition><verbal-definition><p id='_'>Definition 2</p></verbal-definition></definition>
571
- <termsource status="identical" type="authoritative">
572
- <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
573
- <localityStack>
574
- <locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
575
- </localityStack>
576
- </origin>
577
- </termsource>
578
- </term>
579
- <term id="term-Automation3">
580
- <preferred><expression><name>Automation3</name></expression></preferred>
581
- <definition><verbal-definition><p id='_'>Definition 3</p></verbal-definition></definition>
582
- <termsource status="identical" type="authoritative">
583
- <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
584
- <localityStack>
585
- <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
586
- </localityStack>
587
- </origin>
588
- </termsource>
589
- </term></terms></sections><bibliography><references id="_" obligation="informative" normative="true">
590
- <title>Normative references</title>
591
- #{NORM_REF_BOILERPLATE}
592
- <bibitem type="standard" id="IEC60050-102">
593
- <fetched/>
594
- <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
595
- <title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics — General concepts and linear algebra</title>
596
- <title type='main' format='text/plain' language='en' script='Latn'>International Electrotechnical Vocabulary (IEV) — Part 102: Mathematics — General concepts and linear algebra</title>
597
- <uri type="src">https://webstore.iec.ch/publication/160</uri>
598
- <uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
599
- <docidentifier type="IEC" primary="true">IEC 60050-102:2007</docidentifier>
600
- <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
601
- <date type="published">
602
- <on>2007-08-27</on>
603
- </date>
604
- <contributor>
605
- <role type="publisher"/>
606
- <organization>
607
- <name>International Electrotechnical Commission</name>
608
- <abbreviation>IEC</abbreviation>
609
- <uri>www.iec.ch</uri>
610
- </organization>
611
- </contributor>
612
- <edition>1.0</edition>
613
- <language>en</language>
614
- <script>Latn</script>
615
- <abstract format="text/plain" language="en" script="Latn">This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions.&#13; It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
616
- <status>
617
- <stage>60</stage>
618
- <substage>60</substage>
619
- </status>
620
- <copyright>
621
- <from>2007</from>
622
- <owner>
623
- <organization>
624
- <name>International Electrotechnical Commission</name>
625
- <abbreviation>IEC</abbreviation>
626
- <uri>www.iec.ch</uri>
627
- </organization>
628
- </owner>
629
- </copyright>
630
- <place>Geneva</place>
631
- </bibitem><bibitem type="standard" id="IEC60050-103">
632
- <fetched/>
633
- <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
634
- <title type="title-part" format="text/plain" language="en" script="Latn">Part 103: Mathematics — Functions</title>
635
- <title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) — Part 103: Mathematics — Functions</title>
636
- <uri type="src">https://webstore.iec.ch/publication/161</uri>
637
- <uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
638
- <docidentifier type="IEC" primary="true">IEC 60050-103:2009</docidentifier>
639
- <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
640
- <date type="published">
641
- <on>2009-12-14</on>
642
- </date>
643
- <contributor>
644
- <role type="publisher"/>
645
- <organization>
646
- <name>International Electrotechnical Commission</name>
647
- <abbreviation>IEC</abbreviation>
648
- <uri>www.iec.ch</uri>
649
- </organization>
650
- </contributor>
651
- <edition>1.0</edition>
652
- <language>en</language>
653
- <script>Latn</script>
654
- <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>
655
- <status>
656
- <stage>60</stage>
657
- <substage>60</substage>
658
- </status>
659
- <copyright>
660
- <from>2009</from>
661
- <owner>
662
- <organization>
663
- <name>International Electrotechnical Commission</name>
664
- <abbreviation>IEC</abbreviation>
665
- <uri>www.iec.ch</uri>
666
- </organization>
667
- </owner>
668
- </copyright>
669
- <place>Geneva</place>
670
- </bibitem>
671
- </references></bibliography>
672
- </standard-document>
673
- OUTPUT
674
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
675
- .to be_equivalent_to xmlpp(output)
676
- end
677
- FileUtils.rm_rf File.expand_path("~/.iev.pstore")
678
- FileUtils.mv File.expand_path("~/.iev.pstore1"),
679
- File.expand_path("~/.iev.pstore"), force: true
680
- FileUtils.rm_rf File.expand_path("~/.relaton/cache")
681
- FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"),
682
- File.expand_path("~/.relaton/cache"), force: true
683
- end
684
-
685
- it "counts footnotes with link-only content as separate footnotes" do
686
- input = <<~INPUT
687
- #{ASCIIDOC_BLANK_HDR}
688
-
689
- footnote:[http://www.example.com]
690
-
691
- footnote:[http://www.example.com]
692
-
693
- footnote:[http://www.example1.com]
694
- INPUT
695
- output = <<~OUTPUT
696
- #{BLANK_HDR}
697
- <sections><p id="_"><fn reference="1">
698
- <p id="_">
699
- <link target="http://www.example.com"/>
700
- </p>
701
- </fn>
702
- </p>
703
- <p id="_"><fn reference="1">
704
- <p id="_">
705
- <link target="http://www.example.com"/>
706
- </p>
707
- </fn>
708
- </p>
709
- <p id="_"><fn reference="2">
710
- <p id="_">
711
- <link target="http://www.example1.com"/>
712
- </p>
713
- </fn>
714
- </p></sections>
715
- </standard-document>
716
- OUTPUT
717
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
718
- .to be_equivalent_to xmlpp(output)
719
- end
720
-
721
- it "retains AsciiMath on request" do
722
- input = <<~INPUT
723
- = Document title
724
- Author
725
- :docfile: test.adoc
726
- :nodoc:
727
- :novalid:
728
- :no-isobib:
729
- :mn-keep-asciimath:
730
-
731
- stem:[1/r]
732
- INPUT
733
- output = <<~OUTPUT
734
- #{BLANK_HDR}
735
- <sections>
736
- <p id="_">
737
- <stem type="AsciiMath">1/r</stem>
738
- </p>
739
- </sections>
740
- </standard-document>
741
- OUTPUT
742
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
743
- .to be_equivalent_to xmlpp(output)
744
- end
745
-
746
- it "converts AsciiMath to MathML by default" do
747
- input = <<~INPUT
748
- = Document title
749
- Author
750
- :docfile: test.adoc
751
- :nodoc:
752
- :novalid:
753
- :no-isobib:
754
-
755
- stem:[1/r]
756
- INPUT
757
- output = <<~OUTPUT
758
- #{BLANK_HDR}
759
- <sections>
760
- <p id="_">
761
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
762
- <mrow>
763
- <mn>1</mn>
764
- </mrow>
765
- <mrow>
766
- <mi>r</mi>
767
- </mrow>
768
- </mfrac></math></stem>
769
- </p>
770
- </sections>
771
- </standard-document>
772
- OUTPUT
773
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
774
- .to be_equivalent_to xmlpp(output)
775
- end
776
-
777
- it "cleans up text MathML" do
778
- input = <<~INPUT
779
- #{BLANK_HDR}
780
- <sections>
781
- <stem type="MathML">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;/mfrac&gt;&lt;/math&gt;</stem>
782
- </sections>
783
- </standard-document>
784
- INPUT
785
- output = <<~OUTPUT
786
- #{BLANK_HDR}
787
- <sections>
788
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
789
- </sections>
790
- </standard-document>
791
- OUTPUT
792
- expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
793
- .cleanup(Nokogiri::XML(input)).to_xml)
794
- .to be_equivalent_to xmlpp(output)
795
- end
796
-
797
- it "cleans up nested mathvariant instances" do
798
- input = <<~INPUT
799
- #{ASCIIDOC_BLANK_HDR}
800
-
801
- stem:[sf "unitsml(cd)"]
802
- INPUT
803
- output = <<~OUTPUT
804
- <sections>
805
- <p id='_'>
806
- <stem type='MathML'>
807
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
808
- <mstyle mathvariant='sans-serif'>
809
- <mrow xref='U_NISTu7'>
810
- <mi mathvariant='sans-serif'>cd</mi>
811
- </mrow>
812
- </mstyle>
813
- </math>
814
- </stem>
815
- </p>
816
- </sections>
817
- OUTPUT
818
- expect(xmlpp(strip_guid(Nokogiri::XML(
819
- Asciidoctor.convert(input, *OPTIONS),
820
- ).at("//xmlns:sections").to_xml)))
821
- .to be_equivalent_to xmlpp(output)
822
- end
823
-
824
- it "removes nested bibitem IDs" do
825
- input = <<~INPUT
826
- #{BLANK_HDR}
827
- <bibliography>
828
- <references normative="true"><title>Normative</title>
829
- <bibitem id="A">
830
- <relation type="includes">
831
- <bibitem id="B"/>
832
- </relation>
833
- </bibitem>
834
- </bibliography>
835
- </standard-document>
836
- INPUT
837
- output = <<~OUTPUT
838
- #{BLANK_HDR}
839
- <bibliography>
840
- <references normative="true"><title>Normative</title>
841
- <bibitem id="A">
842
- <relation type="includes">
843
- <bibitem id="B"/>
844
- </relation>
845
- </bibitem>
846
- </references>
847
- </bibliography>
848
- </standard-document>
849
- OUTPUT
850
- expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
851
- .cleanup(Nokogiri::XML(input)).to_xml)
852
- .to be_equivalent_to xmlpp(output)
853
- end
854
-
855
- it "renumbers numeric references in Bibliography sequentially" do
856
- input = <<~INPUT
857
- #{ASCIIDOC_BLANK_HDR}
858
-
859
- == Clause
860
- <<iso123>>
861
- <<iso124>>
862
-
863
- [bibliography]
864
- == Bibliography
865
-
866
- * [[[iso124,ISO 124]]] _Standard 124_
867
- * [[[iso123,1]]] _Standard 123_
868
- INPUT
869
- output = <<~OUTPUT
870
- #{BLANK_HDR}
871
- <sections><clause id="_" inline-header="false" obligation="normative">
872
- <title>Clause</title>
873
- <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
874
- <eref type="inline" bibitemid="iso124" citeas="ISO 124"/></p>
875
- </clause>
876
- </sections><bibliography><references id="_" obligation="informative" normative="false">
877
- <title>Bibliography</title>
878
- <bibitem id="iso124" type="standard">
879
- <title format="text/plain">Standard 124</title>
880
- <docidentifier>ISO 124</docidentifier>
881
- <docnumber>124</docnumber>
882
- <contributor>
883
- <role type="publisher"/>
884
- <organization>
885
- <name>ISO</name>
886
- </organization>
887
- </contributor>
888
- </bibitem>
889
- <bibitem id="iso123">
890
- <formattedref format="application/x-isodoc+xml">
891
- <em>Standard 123</em>
892
- </formattedref>
893
- <docidentifier type="metanorma">[2]</docidentifier>
894
- </bibitem>
895
- </references></bibliography>
896
- </standard-document>
897
- OUTPUT
898
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
899
- .to be_equivalent_to xmlpp(output)
900
- end
901
-
902
- it "renumbers numeric references in Bibliography subclauses sequentially" do
903
- input = <<~INPUT
904
- #{ASCIIDOC_BLANK_HDR}
905
-
906
- == Clause
907
- <<iso123>>
908
- <<iso124>>
909
- <<iso125>>
910
- <<iso126>>
911
-
912
- [bibliography]
913
- == Bibliography
914
-
915
- [bibliography]
916
- === Clause 1
917
- * [[[iso124,ISO 124]]] _Standard 124_
918
- * [[[iso123,1]]] _Standard 123_
919
-
920
- [bibliography]
921
- === {blank}
922
- * [[[iso125,ISO 125]]] _Standard 124_
923
- * [[[iso126,1]]] _Standard 123_
924
-
925
- [bibliography]
926
- == Bibliography Redux
927
-
928
- [bibliography]
929
- === Clause 1
930
- * [[[iso127,ISO 124]]] _Standard 124_
931
- * [[[iso128,1]]] _Standard 123_
932
-
933
- INPUT
934
- output = <<~OUTPUT
935
- #{BLANK_HDR}
936
- <sections><clause id="_" inline-header="false" obligation="normative">
937
- <title>Clause</title>
938
- <p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
939
- <eref type="inline" bibitemid="iso124" citeas="ISO 124"/>
940
- <eref type="inline" bibitemid="iso125" citeas="ISO 125"/>
941
- <eref type="inline" bibitemid="iso126" citeas="[4]"/></p>
942
- </clause>
943
- </sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative" normative="false">
944
- <title>Clause 1</title>
945
- <bibitem id="iso124" type="standard">
946
- <title format="text/plain">Standard 124</title>
947
- <docidentifier>ISO 124</docidentifier>
948
- <docnumber>124</docnumber>
949
- <contributor>
950
- <role type="publisher"/>
951
- <organization>
952
- <name>ISO</name>
953
- </organization>
954
- </contributor>
955
- </bibitem>
956
- <bibitem id="iso123">
957
- <formattedref format="application/x-isodoc+xml">
958
- <em>Standard 123</em>
959
- </formattedref>
960
- <docidentifier type="metanorma">[2]</docidentifier>
961
- </bibitem>
962
- </references>
963
- <references id="_" obligation="informative" normative="false">
964
- <bibitem id="iso125" type="standard">
965
- <title format="text/plain">Standard 124</title>
966
- <docidentifier>ISO 125</docidentifier>
967
- <docnumber>125</docnumber>
968
- <contributor>
969
- <role type="publisher"/>
970
- <organization>
971
- <name>ISO</name>
972
- </organization>
973
- </contributor>
974
- </bibitem>
975
- <bibitem id="iso126">
976
- <formattedref format="application/x-isodoc+xml">
977
- <em>Standard 123</em>
978
- </formattedref>
979
- <docidentifier type="metanorma">[4]</docidentifier>
980
- </bibitem>
981
- </references>
982
- </clause>
983
- <clause id='_' obligation='informative'>
984
- <title>Bibliography Redux</title>
985
- <references id='_' normative='false' obligation='informative'>
986
- <title>Clause 1</title>
987
- <bibitem id='iso127' type='standard'>
988
- <title format='text/plain'>Standard 124</title>
989
- <docidentifier>ISO 124</docidentifier>
990
- <docnumber>124</docnumber>
991
- <contributor>
992
- <role type='publisher'/>
993
- <organization>
994
- <name>ISO</name>
995
- </organization>
996
- </contributor>
997
- </bibitem>
998
- <bibitem id='iso128'>
999
- <formattedref format='application/x-isodoc+xml'>
1000
- <em>Standard 123</em>
1001
- </formattedref>
1002
- <docidentifier type='metanorma'>[6]</docidentifier>
1003
- </bibitem>
1004
- </references></clause></bibliography>
1005
- </standard-document>
1006
- OUTPUT
1007
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1008
- .to be_equivalent_to xmlpp(output)
1009
- end
1010
-
1011
- it "removes bibdata bibitem IDs" do
1012
- input = <<~INPUT
1013
- = Document title
1014
- Author
1015
- :docfile: test.adoc
1016
- :nodoc:
1017
- :novalid:
1018
- :no-isobib:
1019
- :translated-from: IEC 60050-102
1020
-
1021
- [bibliography]
1022
- == Normative References
1023
-
1024
- INPUT
1025
- output = <<~OUTPUT
1026
- <?xml version='1.0' encoding='UTF-8'?>
1027
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1028
- <bibdata type='standard'>
1029
- <title language='en' format='text/plain'>Document title</title>
1030
- <language>en</language>
1031
- <script>Latn</script>
1032
- <status>
1033
- <stage>published</stage>
1034
- </status>
1035
- <copyright>
1036
- <from>#{Date.today.year}</from>
1037
- </copyright>
1038
- <relation type='translatedFrom'>
1039
- <bibitem>
1040
- <title>--</title>
1041
- <docidentifier>IEC 60050-102</docidentifier>
1042
- </bibitem>
1043
- </relation>
1044
- <ext>
1045
- <doctype>standard</doctype>
1046
- </ext>
1047
- </bibdata>
1048
- <sections> </sections>
1049
- <bibliography>
1050
- <references id='_' obligation='informative' normative="true">
1051
- <title>Normative references</title>
1052
- <p id="_">There are no normative references in this document.</p>
1053
- </references>
1054
- </bibliography>
1055
- </standard-document>
1056
- OUTPUT
1057
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1058
- .to be_equivalent_to xmlpp(output)
1059
- end
1060
-
1061
- it "imports boilerplate file" do
1062
- input = <<~INPUT
1063
- = Document title
1064
- Author
1065
- :docfile: test.adoc
1066
- :nodoc:
1067
- :novalid:
1068
- :no-isobib:
1069
- :docstage: 10
1070
- :boilerplate-authority: spec/assets/boilerplate.xml
1071
-
1072
- == Clause 1
1073
-
1074
- INPUT
1075
- output = <<~OUTPUT
1076
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1077
- <bibdata type='standard'>
1078
- <title language='en' format='text/plain'>Document title</title>
1079
- <language>en</language>
1080
- <script>Latn</script>
1081
- <status>
1082
- <stage>10</stage>
1083
- </status>
1084
- <copyright>
1085
- <from>#{Date.today.year}</from>
1086
- </copyright>
1087
- <ext>
1088
- <doctype>standard</doctype>
1089
- </ext>
1090
- </bibdata>
1091
- <boilerplate>
1092
- <text>10</text>
1093
- </boilerplate>
1094
- <sections>
1095
- <clause id='_' inline-header='false' obligation='normative'>
1096
- <title>Clause 1</title>
1097
- </clause>
1098
- </sections>
1099
- </standard-document>
1100
- OUTPUT
1101
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1102
- .to be_equivalent_to xmlpp(output)
1103
- end
1104
-
1105
- it "sorts symbols lists #1" do
1106
- input = <<~INPUT
1107
- #{ASCIIDOC_BLANK_HDR}
1108
-
1109
- [[L]]
1110
- == Symbols and abbreviated terms
1111
-
1112
- α:: Definition 1
1113
- Xa:: Definition 2
1114
- x_1_:: Definition 3
1115
- x_m_:: Definition 4
1116
- x:: Definition 5
1117
- stem:[n]:: Definition 6
1118
- m:: Definition 7
1119
- INPUT
1120
- output = <<~OUTPUT
1121
- #{BLANK_HDR}
1122
- <sections>
1123
- <definitions id='L' obligation="normative">
1124
- <title>Symbols and abbreviated terms</title>
1125
- <dl id='_'>
1126
- <dt id="symbol-m">m</dt>
1127
- <dd>
1128
- <p id='_'>Definition 7</p>
1129
- </dd>
1130
- <dt id="symbol-n">
1131
- <stem type='MathML'>
1132
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1133
- <mi>n</mi>
1134
- </math>
1135
- </stem>
1136
- </dt>
1137
- <dd>
1138
- <p id='_'>Definition 6</p>
1139
- </dd>
1140
- <dt id="symbol-x">x</dt>
1141
- <dd>
1142
- <p id='_'>Definition 5</p>
1143
- </dd>
1144
- <dt id='symbol-x_m_'>x_m_</dt>
1145
- <dd>
1146
- <p id='_'>Definition 4</p>
1147
- </dd>
1148
- <dt id='symbol-x_1_'>x_1_</dt>
1149
- <dd>
1150
- <p id='_'>Definition 3</p>
1151
- </dd>
1152
- <dt id='symbol-Xa'>Xa</dt>
1153
- <dd>
1154
- <p id='_'>Definition 2</p>
1155
- </dd>
1156
- <dt id='symbol-__x3b1_'>α</dt>
1157
- <dd>
1158
- <p id='_'>Definition 1</p>
1159
- </dd>
1160
- </dl>
1161
- </definitions>
1162
- </sections>
1163
- </standard-document>
1164
- OUTPUT
1165
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1166
- .to be_equivalent_to xmlpp(output)
1167
- end
1168
-
1169
- it "sorts symbols lists #2" do
1170
- input = <<~INPUT
1171
- #{ASCIIDOC_BLANK_HDR}
1172
-
1173
- [[L]]
1174
- == Symbols and abbreviated terms
1175
-
1176
- stem:[alpha]:: Definition 1
1177
- xa:: Definition 2
1178
- stem:[x_1]:: Definition 3
1179
- stem:[x_m]:: Definition 4
1180
- x:: Definition 5
1181
- INPUT
1182
- output = <<~OUTPUT
1183
- #{BLANK_HDR}
1184
- <sections>
1185
- <definitions id='L' obligation="normative">
1186
- <title>Symbols and abbreviated terms</title>
1187
- <dl id='_'>
1188
- <dt id='symbol-x'>x</dt>
1189
- <dd>
1190
- <p id='_'>Definition 5</p>
1191
- </dd>
1192
- <dt id='symbol-x-m'><stem type='MathML'>
1193
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1194
- <msub>
1195
- <mrow>
1196
- <mi>x</mi>
1197
- </mrow>
1198
- <mrow>
1199
- <mi>m</mi>
1200
- </mrow>
1201
- </msub>
1202
- </math>
1203
- </stem></dt>
1204
- <dd>
1205
- <p id='_'>Definition 4</p>
1206
- </dd>
1207
- <dt id='symbol-x-1'><stem type='MathML'>
1208
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1209
- <msub>
1210
- <mrow>
1211
- <mi>x</mi>
1212
- </mrow>
1213
- <mrow>
1214
- <mn>1</mn>
1215
- </mrow>
1216
- </msub>
1217
- </math>
1218
- </stem></dt>
1219
- <dd>
1220
- <p id='_'>Definition 3</p>
1221
- </dd>
1222
- <dt id='symbol-xa'>xa</dt>
1223
- <dd>
1224
- <p id='_'>Definition 2</p>
1225
- </dd>
1226
- <dt id='symbol-__x3b1_'>
1227
- <stem type='MathML'>
1228
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1229
- <mi>α</mi>
1230
- </math>
1231
- </stem>
1232
- </dt>
1233
- <dd>
1234
- <p id='_'>Definition 1</p>
1235
- </dd>
1236
- </dl>
1237
- </definitions>
1238
- </sections>
1239
- </standard-document>
1240
- OUTPUT
1241
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1242
- .to be_equivalent_to xmlpp(output)
1243
- end
1244
-
1245
- it "fixes illegal anchors" do
1246
- input = <<~INPUT
1247
- #{ASCIIDOC_BLANK_HDR}
1248
-
1249
- [[a:b]]
1250
- == A
1251
- <</:ab>>
1252
- <<:>>
1253
- <<1>>
1254
- <<1:>>
1255
- <<1#b>>
1256
- <<:a#b:>>
1257
- <</%ab>>
1258
- <<1!>>
1259
- <<Löwe>>
1260
-
1261
- [[Löwe]]
1262
- .See <<Löwner2016>>
1263
- ----
1264
- ABC
1265
- ----
1266
-
1267
- [bibliography]
1268
- == Bibliography
1269
- * [[[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
1270
- INPUT
1271
- output = <<~OUTPUT
1272
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1273
- <bibdata type='standard'>
1274
- <title language='en' format='text/plain'>Document title</title>
1275
- <language>en</language>
1276
- <script>Latn</script>
1277
- <status>
1278
- <stage>published</stage>
1279
- </status>
1280
- <copyright>
1281
- <from>#{Time.now.year}</from>
1282
- </copyright>
1283
- <ext>
1284
- <doctype>standard</doctype>
1285
- </ext>
1286
- </bibdata>
1287
- <sections>
1288
- <clause id='a_b' inline-header='false' obligation='normative'>
1289
- <title>A</title>
1290
- <eref bibitemid='__ab' citeas=''/>
1291
- <xref target='_'/>
1292
- <xref target='_1'/>
1293
- <xref target='_1_'/>
1294
- <xref target='1#b'/>
1295
- <xref target='_a#b_'/>
1296
- <xref target='__ab'/>
1297
- <xref target='_1_'/>
1298
- <xref target='L__xf6_we'/>
1299
- <sourcecode id='L__xf6_we'>
1300
- <name>
1301
- See
1302
- <eref type='inline' bibitemid='L__xf6_wner2016' citeas='Löwner et al. 2016'/>
1303
- </name>
1304
- ABC
1305
- </sourcecode>
1306
- </clause>
1307
- </sections>
1308
- <bibliography>
1309
- <references id='_bibliography' normative='false' obligation='informative'>
1310
- <title>Bibliography</title>
1311
- <bibitem id='L__xf6_wner2016'>
1312
- <formattedref format='application/x-isodoc+xml'>
1313
- L&#246;wner, M.-O., Gr&#246;ger, G., Benner, J., Biljecki, F., Nagel,
1314
- C., 2016:
1315
- <strong>Proposal for a new LOD and multi-representation concept for CityGML</strong>
1316
- . In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals
1317
- of the Photogrammetry, Remote Sensing and Spatial Information
1318
- Sciences, Vol. IV-2/W1, 3&#8211;12.
1319
- <link target='https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016'/>
1320
- </formattedref>
1321
- <docidentifier>L&#246;wner et al. 2016</docidentifier>
1322
- <docnumber>2016</docnumber>
1323
- </bibitem>
1324
- </references>
1325
- <references hidden='true' normative='false'>
1326
- <bibitem id='__ab' type='internal'>
1327
- <docidentifier type='repository'>//ab</docidentifier>
1328
- </bibitem>
1329
- </references>
1330
- </bibliography>
1331
- </standard-document>
1332
- OUTPUT
1333
- expect(strip_guid(xmlpp(Asciidoctor.convert(input, *OPTIONS)
1334
- .gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))))
1335
- .to be_equivalent_to(xmlpp(output))
1336
- expect { Asciidoctor.convert(input, *OPTIONS) }
1337
- .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
1338
- .to_stderr
1339
- expect { Asciidoctor.convert(input, *OPTIONS) }
1340
- .to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab})
1341
- .to_stderr
1342
- expect { Asciidoctor.convert(input, *OPTIONS) }
1343
- .to output(%r{normalised identifier in <xref target="_"/> from :})
1344
- .to_stderr
1345
- expect { Asciidoctor.convert(input, *OPTIONS) }
1346
- .to output(%r{normalised identifier in <xref target="_1"/> from 1})
1347
- .to_stderr
1348
- expect { Asciidoctor.convert(input, *OPTIONS) }
1349
- .to output(%r{normalised identifier in <xref target="_1_"/> from 1:})
1350
- .to_stderr
1351
- expect { Asciidoctor.convert(input, *OPTIONS) }
1352
- .to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:})
1353
- .to_stderr
1354
- end
1355
-
1356
- it "moves title footnotes to bibdata" do
1357
- input = <<~INPUT
1358
- = Document title footnote:[ABC] footnote:[DEF]
1359
- Author
1360
- :docfile: test.adoc
1361
- :nodoc:
1362
- :novalid:
1363
- :no-isobib:
1364
-
1365
- INPUT
1366
- output = <<~OUTPUT
1367
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1368
- <bibdata type='standard'>
1369
- <title language='en' format='text/plain'>Document title</title>
1370
- <note type='title-footnote'>
1371
- <p>ABC</p>
1372
- </note>
1373
- <note type='title-footnote'>
1374
- <p>DEF</p>
1375
- </note>
1376
- <language>en</language>
1377
- <script>Latn</script>
1378
- <status>
1379
- <stage>published</stage>
1380
- </status>
1381
- <copyright>
1382
- <from>#{Time.now.year}</from>
1383
- </copyright>
1384
- <ext>
1385
- <doctype>standard</doctype>
1386
- </ext>
1387
- </bibdata>
1388
- <sections> </sections>
1389
- </standard-document>
1390
- OUTPUT
1391
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
1392
- .to be_equivalent_to xmlpp(output)
1393
- end
1394
-
1395
- it "converts UnitsML to MathML" do
1396
- input = <<~INPUT
1397
- = Document title
1398
- Author
1399
- :stem:
1400
-
1401
- [stem]
1402
- ++++
1403
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1404
- <mrow>
1405
- <mn>7</mn>
1406
- <mtext>unitsml(m*kg^-2)</mtext>
1407
- <mo>+</mo>
1408
- <mn>8</mn>
1409
- <mtext>unitsml(m*kg^-2)</mtext>
1410
- </mrow>
1411
- </math>
1412
- ++++
1413
- INPUT
1414
- output = <<~OUTPUT
1415
- #{BLANK_HDR}
1416
- <misc-container>
1417
- <UnitsML xmlns='https://schema.unitsml.org/unitsml/1.0'>
1418
- <UnitSet>
1419
- <Unit xml:id='U_m.kg-2' dimensionURL='#D_LM-2'>
1420
- <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
1421
- <UnitName xml:lang='en'>m*kg^-2</UnitName>
1422
- <UnitSymbol type='HTML'>
1423
- m&#160;kg
1424
- <sup>&#8722;2</sup>
1425
- </UnitSymbol>
1426
- <UnitSymbol type='MathML'>
1427
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1428
- <mrow>
1429
- <mi mathvariant='normal'>m</mi>
1430
- <mo rspace='thickmathspace'>&#8290;</mo>
1431
- <msup>
1432
- <mrow>
1433
- <mi mathvariant='normal'>kg</mi>
1434
- </mrow>
1435
- <mrow>
1436
- <mo>&#8722;</mo>
1437
- <mn>2</mn>
1438
- </mrow>
1439
- </msup>
1440
- </mrow>
1441
- </math>
1442
- </UnitSymbol>
1443
- <RootUnits>
1444
- <EnumeratedRootUnit unit='meter'/>
1445
- <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
1446
- </RootUnits>
1447
- </Unit>
1448
- </UnitSet>
1449
- <DimensionSet>
1450
- <Dimension xml:id='D_LM-2'>
1451
- <Length symbol='L' powerNumerator='1'/>
1452
- <Mass symbol='M' powerNumerator='-2'/>
1453
- </Dimension>
1454
- </DimensionSet>
1455
- <PrefixSet>
1456
- <Prefix prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
1457
- <PrefixName xml:lang='en'>kilo</PrefixName>
1458
- <PrefixSymbol type='ASCII'>k</PrefixSymbol>
1459
- <PrefixSymbol type='unicode'>k</PrefixSymbol>
1460
- <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
1461
- <PrefixSymbol type='HTML'>k</PrefixSymbol>
1462
- </Prefix>
1463
- </PrefixSet>
1464
- </UnitsML>
1465
- </misc-container>
1466
- <sections>
1467
- <formula id='_'>
1468
- <stem type='MathML'>
1469
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1470
- <mrow>
1471
- <mn>7</mn>
1472
- <mo rspace='thickmathspace'>&#8290;</mo>
1473
- <mrow xref='U_m.kg-2'>
1474
- <mi mathvariant='normal'>m</mi>
1475
- <mo rspace='thickmathspace'>&#8290;</mo>
1476
- <msup>
1477
- <mrow>
1478
- <mi mathvariant='normal'>kg</mi>
1479
- </mrow>
1480
- <mrow>
1481
- <mo>&#8722;</mo>
1482
- <mn>2</mn>
1483
- </mrow>
1484
- </msup>
1485
- </mrow>
1486
- <mo>+</mo>
1487
- <mn>8</mn>
1488
- <mo rspace='thickmathspace'>&#8290;</mo>
1489
- <mrow xref='U_m.kg-2'>
1490
- <mi mathvariant='normal'>m</mi>
1491
- <mo rspace='thickmathspace'>&#8290;</mo>
1492
- <msup>
1493
- <mrow>
1494
- <mi mathvariant='normal'>kg</mi>
1495
- </mrow>
1496
- <mrow>
1497
- <mo>&#8722;</mo>
1498
- <mn>2</mn>
1499
- </mrow>
1500
- </msup>
1501
- </mrow>
1502
- </mrow>
1503
- </math>
1504
- </stem>
1505
- </formula>
1506
- </sections>
1507
- </standard-document>
1508
- OUTPUT
1509
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1510
- .to be_equivalent_to xmlpp(output)
1511
- end
1512
-
1513
- it "customises italicisation of MathML" do
1514
- input = <<~INPUT
1515
- = Document title
1516
- Author
1517
- :stem:
1518
-
1519
- [stem]
1520
- ++++
1521
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1522
- <mi>A</mi>
1523
- <mo>+</mo>
1524
- <mi>a</mi>
1525
- <mo>+</mo>
1526
- <mi>Α</mi>
1527
- <mo>+</mo>
1528
- <mi>α</mi>
1529
- <mo>+</mo>
1530
- <mi>AB</mi>
1531
- <mstyle mathvariant="italic">
1532
- <mrow>
1533
- <mi>Α</mi>
1534
- </mrow>
1535
- </mstyle>
1536
- </math>
1537
- ++++
1538
- INPUT
1539
-
1540
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1541
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
1542
- #{BLANK_HDR}
1543
- <sections>
1544
- <formula id='_'>
1545
- <stem type='MathML'>
1546
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1547
- <mi>A</mi>
1548
- <mo>+</mo>
1549
- <mi>a</mi>
1550
- <mo>+</mo>
1551
- <mi>Α</mi>
1552
- <mo>+</mo>
1553
- <mi>α</mi>
1554
- <mo>+</mo>
1555
- <mi>AB</mi>
1556
- <mstyle mathvariant='italic'>
1557
- <mrow>
1558
- <mi>Α</mi>
1559
- </mrow>
1560
- </mstyle>
1561
- </math>
1562
- </stem>
1563
- </formula>
1564
- </sections>
1565
- </standard-document>
1566
- OUTPUT
1567
- mock_mathml_italicise({ uppergreek: false, upperroman: true,
1568
- lowergreek: true, lowerroman: true })
1569
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1570
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
1571
- #{BLANK_HDR}
1572
- <sections>
1573
- <formula id='_'>
1574
- <stem type='MathML'>
1575
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1576
- <mi>A</mi>
1577
- <mo>+</mo>
1578
- <mi>a</mi>
1579
- <mo>+</mo>
1580
- <mi mathvariant="normal">Α</mi>
1581
- <mo>+</mo>
1582
- <mi>α</mi>
1583
- <mo>+</mo>
1584
- <mi>AB</mi>
1585
- <mstyle mathvariant='italic'>
1586
- <mrow>
1587
- <mi>Α</mi>
1588
- </mrow>
1589
- </mstyle>
1590
- </math>
1591
- </stem>
1592
- </formula>
1593
- </sections>
1594
- </standard-document>
1595
- OUTPUT
1596
- mock_mathml_italicise({ uppergreek: true, upperroman: false,
1597
- lowergreek: true, lowerroman: true })
1598
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1599
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
1600
- #{BLANK_HDR}
1601
- <sections>
1602
- <formula id='_'>
1603
- <stem type='MathML'>
1604
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1605
- <mi mathvariant="normal">A</mi>
1606
- <mo>+</mo>
1607
- <mi>a</mi>
1608
- <mo>+</mo>
1609
- <mi>Α</mi>
1610
- <mo>+</mo>
1611
- <mi>α</mi>
1612
- <mo>+</mo>
1613
- <mi>AB</mi>
1614
- <mstyle mathvariant='italic'>
1615
- <mrow>
1616
- <mi>Α</mi>
1617
- </mrow>
1618
- </mstyle>
1619
- </math>
1620
- </stem>
1621
- </formula>
1622
- </sections>
1623
- </standard-document>
1624
- OUTPUT
1625
- mock_mathml_italicise({ uppergreek: true, upperroman: true,
1626
- lowergreek: false, lowerroman: true })
1627
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1628
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
1629
- #{BLANK_HDR}
1630
- <sections>
1631
- <formula id='_'>
1632
- <stem type='MathML'>
1633
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1634
- <mi>A</mi>
1635
- <mo>+</mo>
1636
- <mi>a</mi>
1637
- <mo>+</mo>
1638
- <mi>Α</mi>
1639
- <mo>+</mo>
1640
- <mi mathvariant="normal">α</mi>
1641
- <mo>+</mo>
1642
- <mi>AB</mi>
1643
- <mstyle mathvariant='italic'>
1644
- <mrow>
1645
- <mi>Α</mi>
1646
- </mrow>
1647
- </mstyle>
1648
- </math>
1649
- </stem>
1650
- </formula>
1651
- </sections>
1652
- </standard-document>
1653
- OUTPUT
1654
- mock_mathml_italicise({ uppergreek: true, upperroman: true,
1655
- lowergreek: true, lowerroman: false })
1656
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1657
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
1658
- #{BLANK_HDR}
1659
- <sections>
1660
- <formula id='_'>
1661
- <stem type='MathML'>
1662
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1663
- <mi>A</mi>
1664
- <mo>+</mo>
1665
- <mi mathvariant="normal">a</mi>
1666
- <mo>+</mo>
1667
- <mi>Α</mi>
1668
- <mo>+</mo>
1669
- <mi>α</mi>
1670
- <mo>+</mo>
1671
- <mi>AB</mi>
1672
- <mstyle mathvariant='italic'>
1673
- <mrow>
1674
- <mi>Α</mi>
1675
- </mrow>
1676
- </mstyle>
1677
- </math>
1678
- </stem>
1679
- </formula>
1680
- </sections>
1681
- </standard-document>
1682
- OUTPUT
1683
- mock_mathml_italicise({ uppergreek: true, upperroman: true,
1684
- lowergreek: true, lowerroman: true })
1685
- end
1686
-
1687
- it "process express_ref macro with existing bibliography" do
1688
- input = <<~INPUT
1689
- #{ASCIIDOC_BLANK_HDR}
1690
- == Clause
1691
-
1692
- <<uml:A:A.B.C,C>>
1693
- <<uml:A>>
1694
- <<express-schema:action:action.AA,AA>>
1695
- <<express-schema:action:action.AB>>
1696
-
1697
- [[action]]
1698
- [type="express-schema"]
1699
- == Action
1700
-
1701
- [[action.AA]]
1702
- === AA
1703
-
1704
- [bibliography]
1705
- == Bibliography
1706
- * [[[D,E]]] F
1707
- INPUT
1708
- output = <<~OUTPUT
1709
- #{BLANK_HDR}
1710
- <sections>
1711
- <clause id='_' inline-header='false' obligation='normative'>
1712
- <title>Clause</title>
1713
- <p id='_'>
1714
- <eref bibitemid='uml_A' citeas="">
1715
- <localityStack>
1716
- <locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
1717
- </localityStack>
1718
- C
1719
- </eref>
1720
- <eref bibitemid='uml_A' citeas=""/>
1721
- <xref target='action.AA'>AA</xref>
1722
- <xref target='action'>** Missing target action.AB</xref>
1723
- </p>
1724
- </clause>
1725
- <clause id='action' type='express-schema' inline-header='false' obligation='normative'>
1726
- <title>Action</title>
1727
- <clause id='action.AA' inline-header='false' obligation='normative'>
1728
- <title>AA</title>
1729
- </clause>
1730
- </clause>
1731
- </sections>
1732
- <bibliography>
1733
- <references id='_' normative='false' obligation='informative'>
1734
- <title>Bibliography</title>
1735
- <bibitem id='D'>
1736
- <formattedref format='application/x-isodoc+xml'>F</formattedref>
1737
- <docidentifier>E</docidentifier>
1738
- </bibitem>
1739
- </references>
1740
- <references hidden='true' normative='false'>
1741
- <bibitem id='uml_A' type='internal'>
1742
- <docidentifier type='repository'>uml/A</docidentifier>
1743
- </bibitem>
1744
- </references>
1745
- </bibliography>
1746
- </standard-document>
1747
- OUTPUT
1748
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1749
- .to be_equivalent_to xmlpp(output)
1750
- end
1751
-
1752
- it "process express_ref macro with no existing bibliography" do
1753
- input = <<~INPUT
1754
- #{ASCIIDOC_BLANK_HDR}
1755
- [[B]]
1756
- [type="express-schema"]
1757
- == Clause
1758
-
1759
- [[B1]]
1760
- NOTE: X
1761
-
1762
- <<express-schema:A:A.B.C,C>>
1763
- <<express-schema:A>>
1764
- <<express-schema:B>>
1765
- <<express-schema:B1>>
1766
- INPUT
1767
- output = <<~OUTPUT
1768
- #{BLANK_HDR}
1769
- <sections>
1770
- <clause id='B' type='express-schema' inline-header='false' obligation='normative'>
1771
- <title>Clause</title>
1772
- <note id='B1'>
1773
- <p id='_'>X</p>
1774
- </note>
1775
- <p id='_'>
1776
- <eref bibitemid='express-schema_A' citeas=''>
1777
- <localityStack>
1778
- <locality type='anchor'>
1779
- <referenceFrom>A.B.C</referenceFrom>
1780
- </locality>
1781
- </localityStack>
1782
- C
1783
- </eref>
1784
- <eref bibitemid='express-schema_A' citeas=''/>
1785
- <xref target='B'/>
1786
- <xref target='B1'/>
1787
- </p>
1788
- </clause>
1789
- </sections>
1790
- <bibliography>
1791
- <references hidden='true' normative='false'>
1792
- <bibitem id='express-schema_A' type='internal'>
1793
- <docidentifier type='repository'>express-schema/A</docidentifier>
1794
- </bibitem>
1795
- </references>
1796
- </bibliography>
1797
- </standard-document>
1798
- OUTPUT
1799
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1800
- .to be_equivalent_to xmlpp(output)
1801
- end
1802
-
1803
- it "creates content-based GUIDs" do
1804
- input = <<~INPUT
1805
- #{ASCIIDOC_BLANK_HDR}
1806
-
1807
- .Foreword
1808
- Foreword
1809
-
1810
- [NOTE,beforeclauses=true]
1811
- ====
1812
- Note which is very important <<a>>
1813
- ====
1814
-
1815
- == Introduction
1816
- Introduction
1817
-
1818
- == Scope
1819
- Scope statement
1820
-
1821
- [IMPORTANT,beforeclauses=true]
1822
- ====
1823
- Notice which is very important
1824
- ====
1825
- INPUT
1826
- output = <<~OUTPUT
1827
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version="#{Metanorma::Standoc::VERSION}">
1828
- <bibdata type='standard'>
1829
- <title language='en' format='text/plain'>Document title</title>
1830
- <language>en</language>
1831
- <script>Latn</script>
1832
- <status>
1833
- <stage>published</stage>
1834
- </status>
1835
- <copyright>
1836
- <from>#{Time.now.year}</from>
1837
- </copyright>
1838
- <ext>
1839
- <doctype>standard</doctype>
1840
- </ext>
1841
- </bibdata>
1842
- <preface>
1843
- <note id='_2cfe95f6-7ad6-aa57-8207-6f7d7928aa8e'>
1844
- <p id='_76d95913-a379-c60f-5144-1f09655cafa6'>
1845
- Note which is very important
1846
- <xref target='_76d95913-a379-c60f-5144-1f09655cafa6'/>
1847
- </p>
1848
- </note>
1849
- <foreword id='_96b556cb-657c-985b-351b-ed70d8bd6fdd' obligation='informative'>
1850
- <title>Foreword</title>
1851
- <p id='_d2f825bf-3e18-6143-8777-34e59928d48c'>Foreword</p>
1852
- </foreword>
1853
- <introduction id='_introduction' obligation='informative'>
1854
- <title>Introduction</title>
1855
- <p id='_272021ab-1bfa-78ae-e860-ed770e36f3d2'>Introduction</p>
1856
- </introduction>
1857
- </preface>
1858
- <sections>
1859
- <admonition id='_6abb9105-854c-e79c-c351-73a56d6ca81f' type='important'>
1860
- <p id='_69ec375e-c992-5be3-76dd-a2311f9bb6cc'>Notice which is very important</p>
1861
- </admonition>
1862
- <clause id='_scope' type='scope' inline-header='false' obligation='normative'>
1863
- <title>Scope</title>
1864
- <p id='_fdcef9f1-c898-da99-eff6-f3e6abde7799'>Scope statement</p>
1865
- </clause>
1866
- </sections>
1867
- </standard-document>
1868
- OUTPUT
1869
- input1 = xmlpp(Asciidoctor.convert(input, *OPTIONS))
1870
- .sub(/<p id='([^']+)'>(\s+)Note which is very important(\s+)<xref target='a'/,
1871
- "<p id='\\1'>\\2Note which is very important\\3<xref target='\\1'")
1872
- expect(xmlpp(input1))
1873
- .to be_equivalent_to xmlpp(output)
1874
- end
1875
-
1876
- private
1877
-
1878
- def mock_mathml_italicise(string)
1879
- allow_any_instance_of(::Metanorma::Standoc::Cleanup)
1880
- .to receive(:mathml_mi_italics).and_return(string)
1881
- end
1882
-
1883
- def mock_iev
1884
- expect(Iecbib::IecBibliography).to receive(:get).with("IEV", nil, {}) do
1885
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
1886
- <bibitem type="standard" id="IEC60050:2001">
1887
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
1888
- <docidentifier>IEC 60050:2011</docidentifier>
1889
- <date type="published">
1890
- <on>2007</on>
1891
- </date>
1892
- <contributor>
1893
- <role type="publisher"/>
1894
- <organization>
1895
- <name>International Electrotechnical Commission</name>
1896
- <abbreviation>IEC</abbreviation>
1897
- <uri>www.iec.ch</uri>
1898
- </organization>
1899
- </contributor>
1900
- <language>en</language>
1901
- <language>fr</language>
1902
- <script>Latn</script>
1903
- <status>
1904
- <stage>60</stage>
1905
- </status>
1906
- <copyright>
1907
- <from>2018</from>
1908
- <owner>
1909
- <organization>
1910
- <name>International Electrotechnical Commission</name>
1911
- <abbreviation>IEC</abbreviation>
1912
- <uri>www.iec.ch</uri>
1913
- </organization>
1914
- </owner>
1915
- </copyright>
1916
- </bibitem>
1917
- OUTPUT
1918
- end.at_least :once
1919
- end
1920
- end