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