metanorma-standoc 1.5.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +66 -0
- data/README.adoc +1 -3
- data/lib/asciidoctor/standoc/base.rb +6 -1
- data/lib/asciidoctor/standoc/basicdoc.rng +4 -11
- data/lib/asciidoctor/standoc/cleanup.rb +78 -12
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +25 -0
- data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
- data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
- data/lib/asciidoctor/standoc/converter.rb +58 -3
- data/lib/asciidoctor/standoc/front.rb +9 -3
- data/lib/asciidoctor/standoc/front_contributor.rb +43 -11
- data/lib/asciidoctor/standoc/inline.rb +18 -40
- data/lib/asciidoctor/standoc/isodoc.rng +27 -50
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +28 -2
- data/lib/asciidoctor/standoc/ref.rb +46 -48
- data/lib/asciidoctor/standoc/ref_sect.rb +16 -8
- data/lib/asciidoctor/standoc/section.rb +5 -9
- data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
- data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
- data/lib/metanorma/standoc.rb +0 -5
- data/lib/metanorma/standoc/version.rb +20 -1
- data/metanorma-standoc.gemspec +7 -3
- data/spec/asciidoctor-standoc/base_spec.rb +246 -9
- data/spec/asciidoctor-standoc/blocks_spec.rb +1 -1
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1514 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +384 -1547
- data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +15 -22
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_json2text_spec.rb +1 -1
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +258 -0
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +1 -1
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -8
- data/spec/asciidoctor-standoc/refs_spec.rb +362 -104
- data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
- data/spec/fixtures/diagram_definitions.lutaml +22 -0
- data/spec/fixtures/test.exp +121 -0
- data/spec/spec_helper.rb +34 -1
- data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +201 -3
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +47 -231
- data/spec/vcr_cassettes/isobib_get_123.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -116
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -58
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +292 -162
- metadata +59 -17
- data/.github/workflows/macos.yml +0 -46
- data/.github/workflows/ubuntu.yml +0 -49
- data/.github/workflows/windows.yml +0 -53
- data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +0 -123
- data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +0 -43
- data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +0 -43
- data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
- data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -10,7 +10,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
10
10
|
text, including **__nest__**ed markup.
|
11
11
|
INPUT
|
12
12
|
<?xml version="1.0" encoding="UTF-8"?>
|
13
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc">
|
13
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
14
14
|
<bibdata type="standard">
|
15
15
|
<title language="en" format="text/plain">Document title</title>
|
16
16
|
<language>en</language>
|
@@ -77,42 +77,147 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
77
77
|
OUTPUT
|
78
78
|
end
|
79
79
|
|
80
|
+
it "process mtext spaces" do
|
81
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
82
|
+
#{DUMBQUOTE_BLANK_HDR}
|
83
|
+
|
84
|
+
stem:[n < 1 " for all text "]
|
85
|
+
INPUT
|
86
|
+
#{BLANK_HDR}
|
87
|
+
<sections>
|
88
|
+
<p id='_'>
|
89
|
+
<stem type='MathML'>
|
90
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
91
|
+
<mi>n</mi>
|
92
|
+
<mo/>
|
93
|
+
<mn>1</mn>
|
94
|
+
<mtext> for all text </mtext>
|
95
|
+
</math>
|
96
|
+
</stem>
|
97
|
+
</p>
|
98
|
+
</sections>
|
99
|
+
</standard-document>
|
100
|
+
OUTPUT
|
101
|
+
end
|
102
|
+
|
80
103
|
it "properly handles inline substitution" do
|
81
104
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
82
105
|
#{DUMBQUOTE_BLANK_HDR}
|
83
106
|
|
84
107
|
stem:[n < 1] +
|
85
108
|
latexmath:[n < 1]
|
109
|
+
stem:["‌"^199 "Hg"^+]
|
86
110
|
INPUT
|
87
111
|
#{BLANK_HDR}
|
88
112
|
<sections>
|
89
113
|
<p id="_">
|
90
114
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem><br/>
|
91
115
|
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
116
|
+
<stem type='MathML'>
|
117
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
118
|
+
<msup>
|
119
|
+
<mrow>
|
120
|
+
<mtext></mtext>
|
121
|
+
</mrow>
|
122
|
+
<mrow>
|
123
|
+
<mn>199</mn>
|
124
|
+
</mrow>
|
125
|
+
</msup>
|
126
|
+
<msup>
|
127
|
+
<mrow>
|
128
|
+
<mtext>Hg</mtext>
|
129
|
+
</mrow>
|
130
|
+
<mrow>
|
131
|
+
<mo>+</mo>
|
132
|
+
</mrow>
|
133
|
+
</msup>
|
134
|
+
</math>
|
135
|
+
</stem>
|
92
136
|
</p>
|
93
137
|
</sections>
|
94
138
|
</standard-document>
|
95
139
|
OUTPUT
|
96
140
|
end
|
97
141
|
|
98
|
-
it "normalises inline stem" do
|
142
|
+
it "normalises inline stem, straight quotes" do
|
99
143
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
100
144
|
#{DUMBQUOTE_BLANK_HDR}
|
101
145
|
|
102
146
|
stem:[n < 1]
|
103
147
|
latexmath:[n < 1]
|
148
|
+
stem:["‌"^199 "Hg"^+]
|
149
|
+
INPUT
|
150
|
+
#{BLANK_HDR}
|
151
|
+
<sections>
|
152
|
+
<p id="_">
|
153
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
|
154
|
+
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
155
|
+
<stem type='MathML'>
|
156
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
157
|
+
<msup>
|
158
|
+
<mrow>
|
159
|
+
<mtext></mtext>
|
160
|
+
</mrow>
|
161
|
+
<mrow>
|
162
|
+
<mn>199</mn>
|
163
|
+
</mrow>
|
164
|
+
</msup>
|
165
|
+
<msup>
|
166
|
+
<mrow>
|
167
|
+
<mtext>Hg</mtext>
|
168
|
+
</mrow>
|
169
|
+
<mrow>
|
170
|
+
<mo>+</mo>
|
171
|
+
</mrow>
|
172
|
+
</msup>
|
173
|
+
</math>
|
174
|
+
</stem>
|
175
|
+
</p>
|
176
|
+
</sections>
|
177
|
+
</standard-document>
|
178
|
+
OUTPUT
|
179
|
+
end
|
180
|
+
|
181
|
+
it "normalises inline stem, smart quotes" do
|
182
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
183
|
+
#{ASCIIDOC_BLANK_HDR}
|
184
|
+
|
185
|
+
stem:[n < 1]
|
186
|
+
latexmath:[n < 1]
|
187
|
+
stem:["‌"^199 "Hg"^+]
|
104
188
|
INPUT
|
105
189
|
#{BLANK_HDR}
|
106
190
|
<sections>
|
107
191
|
<p id="_">
|
108
192
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
|
109
193
|
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
194
|
+
<stem type='MathML'>
|
195
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
196
|
+
<msup>
|
197
|
+
<mrow>
|
198
|
+
<mtext></mtext>
|
199
|
+
</mrow>
|
200
|
+
<mrow>
|
201
|
+
<mn>199</mn>
|
202
|
+
</mrow>
|
203
|
+
</msup>
|
204
|
+
<msup>
|
205
|
+
<mrow>
|
206
|
+
<mtext>Hg</mtext>
|
207
|
+
</mrow>
|
208
|
+
<mrow>
|
209
|
+
<mo>+</mo>
|
210
|
+
</mrow>
|
211
|
+
</msup>
|
212
|
+
</math>
|
213
|
+
</stem>
|
110
214
|
</p>
|
111
215
|
</sections>
|
112
216
|
</standard-document>
|
113
217
|
OUTPUT
|
114
218
|
end
|
115
219
|
|
220
|
+
|
116
221
|
it "generates desired smart quotes for 'dd'" do
|
117
222
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
118
223
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -201,8 +306,14 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
201
306
|
Inline Reference with Text to <<reference,text>>
|
202
307
|
Footnoted Reference with Text to <<reference,fn: text>>
|
203
308
|
Anchored Crossreference to other document <<a.adoc#b>>
|
309
|
+
Capitalised Reference to <<reference,droploc%capital%>>
|
310
|
+
Lowercase Footnoted Reference to <<reference,capital%droploc%fn>>
|
204
311
|
Capitalised Reference to <<reference,capital%>>
|
205
312
|
Lowercase Footnoted Reference to <<reference,capital%fn>>
|
313
|
+
Capitalised Reference to <<reference,droploc%>>
|
314
|
+
Lowercase Footnoted Reference to <<reference,droploc%fn>>
|
315
|
+
Capitalised Reference to <<reference,droploc%capital%>>
|
316
|
+
Lowercase Footnoted Reference to <<reference,droploc%capital%fn>>
|
206
317
|
INPUT
|
207
318
|
#{BLANK_HDR}
|
208
319
|
<sections>
|
@@ -213,8 +324,21 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
213
324
|
Inline Reference with Text to <xref target="reference">text</xref>
|
214
325
|
Footnoted Reference with Text to <xref target="reference">text</xref>
|
215
326
|
Anchored Crossreference to other document <xref target="a#b"/>
|
216
|
-
Capitalised Reference to <xref target='reference' case='capital'></xref>
|
217
|
-
Lowercase Footnoted Reference to <xref target='reference' case='capital'></xref
|
327
|
+
Capitalised Reference to <xref target='reference' case='capital' droploc="true"></xref>
|
328
|
+
Lowercase Footnoted Reference to <xref target='reference' case='capital' droploc="true"></xref>
|
329
|
+
Capitalised Reference to
|
330
|
+
<xref target='reference' case='capital'/>
|
331
|
+
Lowercase Footnoted Reference to
|
332
|
+
<xref target='reference' case='capital'/>
|
333
|
+
Capitalised Reference to
|
334
|
+
<xref target='reference' droploc='true'/>
|
335
|
+
Lowercase Footnoted Reference to
|
336
|
+
<xref target='reference' droploc='true'/>
|
337
|
+
Capitalised Reference to
|
338
|
+
<xref target='reference' case='capital' droploc='true'/>
|
339
|
+
Lowercase Footnoted Reference to
|
340
|
+
<xref target='reference' case='capital' droploc='true'/>
|
341
|
+
</p>
|
218
342
|
</clause>
|
219
343
|
</sections>
|
220
344
|
</standard-document>
|
@@ -48,16 +48,14 @@ EOS
|
|
48
48
|
<title type="title-intro" format="text/plain" language="en" script="Latn">Latex, rubber</title>
|
49
49
|
<title type="title-main" format="text/plain" language="en" script="Latn">Determination of total solids content</title>
|
50
50
|
<title type='main' format='text/plain' language='en' script='Latn'>Latex, rubber - Determination of total solids content</title>
|
51
|
-
<title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title>
|
52
|
-
<title type="title-main" format="text/plain" language="fr" script="Latn">Détermination des matières solides totales</title>
|
53
|
-
<title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc - Détermination des matières solides totales</title>
|
54
51
|
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
55
52
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
56
53
|
<uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
57
54
|
<docidentifier type="ISO">ISO 124:2014</docidentifier>
|
55
|
+
<docidentifier type='URN'>urn:iso:std:iso:124:stage-90.93:ed-7:en</docidentifier>
|
58
56
|
<docnumber>124</docnumber>
|
59
57
|
<date type="published">
|
60
|
-
<on>2014</on>
|
58
|
+
<on>2014-03</on>
|
61
59
|
</date>
|
62
60
|
<contributor>
|
63
61
|
<role type="publisher"/>
|
@@ -69,10 +67,8 @@ EOS
|
|
69
67
|
</contributor>
|
70
68
|
<edition>7</edition>
|
71
69
|
<language>en</language>
|
72
|
-
<language>fr</language>
|
73
70
|
<script>Latn</script>
|
74
71
|
<abstract format="text/plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract>
|
75
|
-
<abstract format="text/plain" language="fr" script="Latn">L'ISO 124:2014 spécifie des méthodes pour la détermination des matières solides totales dans le latex de plantation, le latex de concentré de caoutchouc naturel et le latex de caoutchouc synthétique. Ces méthodes ne conviennent pas nécessairement au latex d'origine naturelle autre que celui de l'Hevea brasiliensis, au latex vulcanisé, aux mélanges de latex, ou aux dispersions artificielles de caoutchouc.</abstract>
|
76
72
|
<status>
|
77
73
|
<stage>90</stage>
|
78
74
|
<substage>93</substage>
|
@@ -113,9 +109,6 @@ EOS
|
|
113
109
|
<title type="title-intro" format="text/plain" language="en" script="Latn">Rubber latex</title>
|
114
110
|
<title type="title-main" format="text/plain" language="en" script="Latn">Sampling</title>
|
115
111
|
<title type="main" format="text/plain" language="en" script="Latn">Rubber latex – Sampling</title>
|
116
|
-
<title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title>
|
117
|
-
<title type="title-main" format="text/plain" language="fr" script="Latn">Échantillonnage</title>
|
118
|
-
<title type="main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc – Échantillonnage</title>
|
119
112
|
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
120
113
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
121
114
|
<uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
@@ -131,7 +124,6 @@ EOS
|
|
131
124
|
</contributor>
|
132
125
|
<edition>3</edition>
|
133
126
|
<language>en</language>
|
134
|
-
<language>fr</language>
|
135
127
|
<script>Latn</script>
|
136
128
|
<status>
|
137
129
|
<stage>90</stage>
|
@@ -155,8 +147,6 @@ EOS
|
|
155
147
|
<fetched>#{Date.today}</fetched>
|
156
148
|
<title type="title-main" format="text/plain" language="en" script="Latn">Rubber latex – Sampling</title>
|
157
149
|
<title type="main" format="text/plain" language="en" script="Latn">Rubber latex – Sampling</title>
|
158
|
-
<title type="title-main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc – Échantillonnage</title>
|
159
|
-
<title type="main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc – Échantillonnage</title>
|
160
150
|
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
161
151
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
162
152
|
<uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
@@ -175,7 +165,6 @@ EOS
|
|
175
165
|
</contributor>
|
176
166
|
<edition>3</edition>
|
177
167
|
<language>en</language>
|
178
|
-
<language>fr</language>
|
179
168
|
<script>Latn</script>
|
180
169
|
<status>
|
181
170
|
<stage>90</stage>
|
@@ -218,16 +207,14 @@ EOS
|
|
218
207
|
<title type="title-intro" format="text/plain" language="en" script="Latn">Rubber latex</title>
|
219
208
|
<title type="title-main" format="text/plain" language="en" script="Latn">Sampling</title>
|
220
209
|
<title type='main' format='text/plain' language='en' script='Latn'>Rubber latex - Sampling</title>
|
221
|
-
<title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title>
|
222
|
-
<title type="title-main" format="text/plain" language="fr" script="Latn">Échantillonnage</title>
|
223
|
-
<title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc - Échantillonnage</title>
|
224
210
|
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
225
211
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
226
212
|
<uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
227
213
|
<docidentifier type="ISO">ISO 123:2001</docidentifier>
|
214
|
+
<docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en</docidentifier>
|
228
215
|
<docnumber>123</docnumber>
|
229
216
|
<date type="published">
|
230
|
-
<on>2001</on>
|
217
|
+
<on>2001-05</on>
|
231
218
|
</date>
|
232
219
|
<contributor>
|
233
220
|
<role type="publisher"/>
|
@@ -239,8 +226,14 @@ EOS
|
|
239
226
|
</contributor>
|
240
227
|
<edition>3</edition>
|
241
228
|
<language>en</language>
|
242
|
-
<language>fr</language>
|
243
229
|
<script>Latn</script>
|
230
|
+
<abstract format='text/plain' language='en' script='Latn'>
|
231
|
+
This International Standard specifies procedures for sampling natural rubber
|
232
|
+
latex concentrate and for sampling syntheticrubber latices and artificial
|
233
|
+
latices. It is also suitable for sampling rubber latex contained in drums,
|
234
|
+
tank cars ortanks. The procedures may also be used for sampling plastics
|
235
|
+
dispersions.
|
236
|
+
</abstract>
|
244
237
|
<status>
|
245
238
|
<stage>90</stage>
|
246
239
|
<substage>93</substage>
|
@@ -687,19 +680,19 @@ EOS
|
|
687
680
|
private
|
688
681
|
|
689
682
|
def mock_isobib_get_123
|
690
|
-
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", "2001", {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
|
683
|
+
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", "2001", {:lang=>"en", :title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
|
691
684
|
end
|
692
685
|
|
693
686
|
def mock_isobib_get_123_undated
|
694
|
-
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
|
687
|
+
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:lang=>"en", :title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
|
695
688
|
end
|
696
689
|
|
697
690
|
def mock_isobib_get_124
|
698
|
-
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 124", "2014", {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
|
691
|
+
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 124", "2014", {:lang=>"en", :title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
|
699
692
|
end
|
700
693
|
|
701
694
|
def mock_ietfbib_get_123
|
702
|
-
expect(RelatonIetf::IetfBibliography).to receive(:get).with("RFC 123", nil, {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
|
695
|
+
expect(RelatonIetf::IetfBibliography).to receive(:get).with("RFC 123", nil, {:lang=>"en", :title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
|
703
696
|
end
|
704
697
|
|
705
698
|
end
|
@@ -111,6 +111,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
111
111
|
+
|
112
112
|
Note 3.
|
113
113
|
|
114
|
+
[%key]
|
115
|
+
a:: b
|
116
|
+
|
114
117
|
INPUT
|
115
118
|
expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
116
119
|
#{BLANK_HDR}
|
@@ -174,7 +177,13 @@ RSpec.describe Asciidoctor::Standoc do
|
|
174
177
|
</li>
|
175
178
|
</ol>
|
176
179
|
</li>
|
177
|
-
</ol
|
180
|
+
</ol><dl id='_' key='true'>
|
181
|
+
<dt>a</dt>
|
182
|
+
<dd>
|
183
|
+
<p id='_'>b</p>
|
184
|
+
</dd>
|
185
|
+
</dl>
|
186
|
+
</sections>
|
178
187
|
</standard-document>
|
179
188
|
OUTPUT
|
180
189
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe 'Lutaml macros' do
|
4
|
+
let(:example_file) { fixtures_path("test.exp") }
|
5
|
+
|
6
|
+
context "Array of hashes" do
|
7
|
+
let(:input) do
|
8
|
+
<<~TEXT
|
9
|
+
= Document title
|
10
|
+
Author
|
11
|
+
:docfile: test.adoc
|
12
|
+
:nodoc:
|
13
|
+
:novalid:
|
14
|
+
:no-isobib:
|
15
|
+
:imagesdir: spec/assets
|
16
|
+
|
17
|
+
[lutaml,#{example_file},my_context]
|
18
|
+
----
|
19
|
+
|
20
|
+
{% for schema in my_context.schemas %}
|
21
|
+
== {{schema.id}}
|
22
|
+
|
23
|
+
{% for entity in schema.entities %}
|
24
|
+
=== {{entity.id}}
|
25
|
+
supertypes -> {{entity.supertypes.id}}
|
26
|
+
explicit -> {{entity.explicit.first.id}}
|
27
|
+
|
28
|
+
{% endfor %}
|
29
|
+
|
30
|
+
{% endfor %}
|
31
|
+
----
|
32
|
+
TEXT
|
33
|
+
end
|
34
|
+
let(:output) do
|
35
|
+
<<~TEXT
|
36
|
+
#{BLANK_METANORMA_HDR}
|
37
|
+
<sections>
|
38
|
+
<clause id="_" inline-header="false" obligation="normative"><title>annotated_3d_model_data_quality_criteria_schema</title>
|
39
|
+
<clause id="_" inline-header="false" obligation="normative">
|
40
|
+
<title>a3m_data_quality_criteria_representation</title>
|
41
|
+
<p id="_">supertypes →
|
42
|
+
explicit → </p>
|
43
|
+
</clause>
|
44
|
+
<clause id="_" inline-header="false" obligation="normative">
|
45
|
+
<title>a3m_data_quality_criterion</title>
|
46
|
+
<p id="_">supertypes →
|
47
|
+
explicit → </p>
|
48
|
+
</clause>
|
49
|
+
<clause id="_" inline-header="false" obligation="normative">
|
50
|
+
<title>a3m_data_quality_criterion_specific_applied_value</title>
|
51
|
+
<p id="_">supertypes →
|
52
|
+
explicit → </p>
|
53
|
+
</clause>
|
54
|
+
<clause id="_" inline-header="false" obligation="normative">
|
55
|
+
<title>a3m_data_quality_target_accuracy_association</title>
|
56
|
+
<p id="_">supertypes →
|
57
|
+
explicit → </p>
|
58
|
+
</clause>
|
59
|
+
<clause id="_" inline-header="false" obligation="normative">
|
60
|
+
<title>a3m_detailed_report_request</title>
|
61
|
+
<p id="_">supertypes →
|
62
|
+
explicit → </p>
|
63
|
+
</clause>
|
64
|
+
<clause id="_" inline-header="false" obligation="normative">
|
65
|
+
<title>a3m_summary_report_request_with_representative_value</title>
|
66
|
+
<p id="_">supertypes →
|
67
|
+
explicit → </p>
|
68
|
+
</clause></clause>
|
69
|
+
</sections>
|
70
|
+
</standard-document>
|
71
|
+
</body></html>
|
72
|
+
TEXT
|
73
|
+
end
|
74
|
+
|
75
|
+
it "correctly renders input" do
|
76
|
+
expect(xml_string_conent(metanorma_process(input)))
|
77
|
+
.to(be_equivalent_to(output))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -44,6 +44,40 @@ RSpec.describe Asciidoctor::Standoc do
|
|
44
44
|
OUTPUT
|
45
45
|
end
|
46
46
|
|
47
|
+
it "processes the Asciidoctor::Standoc variant macros" do
|
48
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
|
+
#{ASCIIDOC_BLANK_HDR}
|
50
|
+
== lang:en[English] lang:fr-Latn[Français]
|
51
|
+
|
52
|
+
this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
|
53
|
+
|
54
|
+
INPUT
|
55
|
+
#{BLANK_HDR}
|
56
|
+
<sections>
|
57
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
58
|
+
<title>
|
59
|
+
<variant lang='en'>English</variant>
|
60
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
61
|
+
</title>
|
62
|
+
<p id='_'>
|
63
|
+
this
|
64
|
+
<variant>
|
65
|
+
<variant lang='en'>English</variant>
|
66
|
+
<variant lang='fr' script='Latn'>Français</variant>
|
67
|
+
</variant>
|
68
|
+
section is
|
69
|
+
<variant>
|
70
|
+
<variant lang='en'>silly</variant>
|
71
|
+
<variant lang='fr'>fou</variant>
|
72
|
+
</variant>
|
73
|
+
</p>
|
74
|
+
</clause>
|
75
|
+
</sections>
|
76
|
+
</standard-document>
|
77
|
+
OUTPUT
|
78
|
+
end
|
79
|
+
|
80
|
+
|
47
81
|
it "processes the Asciidoctor::Standoc concept macros" do
|
48
82
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
49
83
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -361,6 +395,119 @@ OUTPUT
|
|
361
395
|
OUTPUT
|
362
396
|
end
|
363
397
|
|
398
|
+
it "processes the footnoteblock macro" do
|
399
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
400
|
+
#{ASCIIDOC_BLANK_HDR}
|
401
|
+
|
402
|
+
footnoteblock:[id1]
|
403
|
+
|
404
|
+
[[id1]]
|
405
|
+
[NOTE]
|
406
|
+
--
|
407
|
+
|===
|
408
|
+
|a |b
|
409
|
+
|
410
|
+
|c |d
|
411
|
+
|===
|
412
|
+
|
413
|
+
* A
|
414
|
+
* B
|
415
|
+
* C
|
416
|
+
--
|
417
|
+
INPUT
|
418
|
+
#{BLANK_HDR}
|
419
|
+
<sections>
|
420
|
+
<p id="_">
|
421
|
+
<fn reference='1'>
|
422
|
+
<table id='_'>
|
423
|
+
<thead>
|
424
|
+
<tr>
|
425
|
+
<th valign='top' align='left'>a</th>
|
426
|
+
<th valign='top' align='left'>b</th>
|
427
|
+
</tr>
|
428
|
+
</thead>
|
429
|
+
<tbody>
|
430
|
+
<tr>
|
431
|
+
<td valign='top' align='left'>c</td>
|
432
|
+
<td valign='top' align='left'>d</td>
|
433
|
+
</tr>
|
434
|
+
</tbody>
|
435
|
+
</table>
|
436
|
+
<ul id='_'>
|
437
|
+
<li>
|
438
|
+
<p id='_'>A</p>
|
439
|
+
</li>
|
440
|
+
<li>
|
441
|
+
<p id='_'>B</p>
|
442
|
+
</li>
|
443
|
+
<li>
|
444
|
+
<p id='_'>C</p>
|
445
|
+
</li>
|
446
|
+
</ul>
|
447
|
+
</fn>
|
448
|
+
</p>
|
449
|
+
</sections>
|
450
|
+
</standard-document>
|
451
|
+
OUTPUT
|
452
|
+
end
|
453
|
+
|
454
|
+
it "processes the footnoteblock macro with failed reference" do
|
455
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
456
|
+
#{ASCIIDOC_BLANK_HDR}
|
457
|
+
|
458
|
+
footnoteblock:[id1]
|
459
|
+
|
460
|
+
[[id2]]
|
461
|
+
[NOTE]
|
462
|
+
--
|
463
|
+
|===
|
464
|
+
|a |b
|
465
|
+
|
466
|
+
|c |d
|
467
|
+
|===
|
468
|
+
|
469
|
+
* A
|
470
|
+
* B
|
471
|
+
* C
|
472
|
+
--
|
473
|
+
INPUT
|
474
|
+
#{BLANK_HDR}
|
475
|
+
<sections>
|
476
|
+
<p id='_'>
|
477
|
+
<fn reference='1'>[ERROR]</fn>
|
478
|
+
</p>
|
479
|
+
<note id='id2'>
|
480
|
+
<table id='_'>
|
481
|
+
<thead>
|
482
|
+
<tr>
|
483
|
+
<th valign='top' align='left'>a</th>
|
484
|
+
<th valign='top' align='left'>b</th>
|
485
|
+
</tr>
|
486
|
+
</thead>
|
487
|
+
<tbody>
|
488
|
+
<tr>
|
489
|
+
<td valign='top' align='left'>c</td>
|
490
|
+
<td valign='top' align='left'>d</td>
|
491
|
+
</tr>
|
492
|
+
</tbody>
|
493
|
+
</table>
|
494
|
+
<ul id='_'>
|
495
|
+
<li>
|
496
|
+
<p id='_'>A</p>
|
497
|
+
</li>
|
498
|
+
<li>
|
499
|
+
<p id='_'>B</p>
|
500
|
+
</li>
|
501
|
+
<li>
|
502
|
+
<p id='_'>C</p>
|
503
|
+
</li>
|
504
|
+
</ul>
|
505
|
+
</note>
|
506
|
+
</sections>
|
507
|
+
</standard-document>
|
508
|
+
OUTPUT
|
509
|
+
end
|
510
|
+
|
364
511
|
it "processes the PlantUML macro" do
|
365
512
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
366
513
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -443,6 +590,117 @@ OUTPUT
|
|
443
590
|
OUTPUT
|
444
591
|
end
|
445
592
|
|
593
|
+
context 'when lutaml_diagram' do
|
594
|
+
let(:input) do
|
595
|
+
<<~"OUTPUT"
|
596
|
+
= Document title
|
597
|
+
Author
|
598
|
+
:docfile: test.adoc
|
599
|
+
:nodoc:
|
600
|
+
:novalid:
|
601
|
+
:no-isobib:
|
602
|
+
:imagesdir: spec/assets
|
603
|
+
|
604
|
+
[lutaml_diagram]
|
605
|
+
....
|
606
|
+
diagram MyView {
|
607
|
+
fontname "Arial"
|
608
|
+
title "my diagram"
|
609
|
+
class Foo {}
|
610
|
+
}
|
611
|
+
....
|
612
|
+
OUTPUT
|
613
|
+
end
|
614
|
+
let(:output) do
|
615
|
+
<<~"OUTPUT"
|
616
|
+
#{BLANK_HDR}
|
617
|
+
<sections>
|
618
|
+
<figure id="_">
|
619
|
+
<image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
620
|
+
</figure>
|
621
|
+
</sections>
|
622
|
+
</standard-document>
|
623
|
+
OUTPUT
|
624
|
+
end
|
625
|
+
|
626
|
+
it "processes the lutaml_diagram" do
|
627
|
+
expect(
|
628
|
+
xmlpp(
|
629
|
+
strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
|
630
|
+
.gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
|
631
|
+
.to(be_equivalent_to xmlpp(output))
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
=begin
|
636
|
+
context 'when lutaml_uml_attributes_table' do
|
637
|
+
let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
|
638
|
+
let(:input) do
|
639
|
+
<<~"OUTPUT"
|
640
|
+
= Document title
|
641
|
+
Author
|
642
|
+
:docfile: test.adoc
|
643
|
+
:nodoc:
|
644
|
+
:novalid:
|
645
|
+
:no-isobib:
|
646
|
+
:imagesdir: spec/assets
|
647
|
+
|
648
|
+
[lutaml_uml_attributes_table,#{example_file},AttributeProfile]
|
649
|
+
OUTPUT
|
650
|
+
end
|
651
|
+
let(:output) do
|
652
|
+
<<~"OUTPUT"
|
653
|
+
#{BLANK_HDR}
|
654
|
+
<sections>
|
655
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
656
|
+
<title>AttributeProfile</title>
|
657
|
+
<table id='_'>
|
658
|
+
<name>AttributeProfile attributes</name>
|
659
|
+
<thead>
|
660
|
+
<tr>
|
661
|
+
<th valign='top' align='left'>Name</th>
|
662
|
+
<th valign='top' align='left'>Definition</th>
|
663
|
+
<th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
|
664
|
+
<th valign='top' align='left'>Max Occur</th>
|
665
|
+
<th valign='top' align='left'>Data Type</th>
|
666
|
+
</tr>
|
667
|
+
</thead>
|
668
|
+
<tbody>
|
669
|
+
<tr>
|
670
|
+
<td valign='top' align='left'>addressClassProfile</td>
|
671
|
+
<td valign='top' align='left'>TODO: enum ‘s definition</td>
|
672
|
+
<td valign='top' align='left'>M</td>
|
673
|
+
<td valign='top' align='left'>1</td>
|
674
|
+
<td valign='top' align='left'>
|
675
|
+
<tt>CharacterString</tt>
|
676
|
+
</td>
|
677
|
+
</tr>
|
678
|
+
<tr>
|
679
|
+
<td valign='top' align='left'>imlicistAttributeProfile</td>
|
680
|
+
<td valign='top' align='left'>this is attribute definition with multiply lines</td>
|
681
|
+
<td valign='top' align='left'>M</td>
|
682
|
+
<td valign='top' align='left'>1</td>
|
683
|
+
<td valign='top' align='left'>
|
684
|
+
<tt>CharacterString</tt>
|
685
|
+
</td>
|
686
|
+
</tr>
|
687
|
+
</tbody>
|
688
|
+
</table>
|
689
|
+
</clause>
|
690
|
+
</sections>
|
691
|
+
</standard-document>
|
692
|
+
OUTPUT
|
693
|
+
end
|
694
|
+
|
695
|
+
it "processes the lutaml_diagram" do
|
696
|
+
expect(
|
697
|
+
xmlpp(
|
698
|
+
strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
|
699
|
+
.to(be_equivalent_to(xmlpp(output)))
|
700
|
+
end
|
701
|
+
end
|
702
|
+
=end
|
703
|
+
|
446
704
|
it "processes the PlantUML macro with PlantUML disabled" do
|
447
705
|
mock_plantuml_disabled
|
448
706
|
expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr
|