metanorma-standoc 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -15
  3. data/lib/asciidoctor/standoc/base.rb +3 -0
  4. data/lib/asciidoctor/standoc/blocks.rb +0 -53
  5. data/lib/asciidoctor/standoc/cleanup.rb +2 -0
  6. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +66 -0
  7. data/lib/asciidoctor/standoc/cleanup_ref.rb +1 -2
  8. data/lib/asciidoctor/standoc/converter.rb +3 -0
  9. data/lib/asciidoctor/standoc/front.rb +1 -1
  10. data/lib/asciidoctor/standoc/i18n.rb +38 -0
  11. data/lib/asciidoctor/standoc/reqt.rb +62 -0
  12. data/lib/asciidoctor-yaml/i18n-en.yaml +20 -0
  13. data/lib/asciidoctor-yaml/i18n-fr.yaml +13 -0
  14. data/lib/asciidoctor-yaml/i18n-zh-Hans.yaml +15 -0
  15. data/lib/metanorma/standoc/version.rb +1 -1
  16. data/spec/asciidoctor-standoc/blocks_spec.rb +13 -3
  17. data/spec/asciidoctor-standoc/cleanup_spec.rb +80 -1
  18. data/spec/asciidoctor-standoc/inline_spec.rb +1 -0
  19. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -0
  20. data/spec/asciidoctor-standoc/refs_dl_spec.rb +3 -0
  21. data/spec/asciidoctor-standoc/refs_spec.rb +15 -0
  22. data/spec/asciidoctor-standoc/section_spec.rb +141 -1
  23. data/spec/metanorma/processor_spec.rb +1 -2
  24. data/spec/spec_helper.rb +4 -0
  25. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +30 -30
  26. data/spec/vcr_cassettes/isobib_get_123.yml +24 -24
  27. data/spec/vcr_cassettes/isobib_get_123_2001.yml +23 -23
  28. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  29. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +4 -4
  30. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +35 -35
  31. metadata +8 -2
@@ -143,6 +143,7 @@ RSpec.describe Asciidoctor::Standoc do
143
143
  <sections>
144
144
  <terms id="_" obligation="normative">
145
145
  <title>Terms and definitions</title>
146
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
146
147
  <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
147
148
  <definition><p id="_">Time</p></definition></term>
148
149
  </terms>
@@ -164,6 +165,7 @@ RSpec.describe Asciidoctor::Standoc do
164
165
  <sections>
165
166
  <terms id="_" obligation="normative">
166
167
  <title>Terms and definitions</title>
168
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
167
169
  <term id="_">
168
170
  <preferred>Tempus</preferred>
169
171
  <domain>relativity</domain><definition><p id="_"> Time</p></definition>
@@ -198,6 +200,7 @@ RSpec.describe Asciidoctor::Standoc do
198
200
  <sections>
199
201
  <terms id="_" obligation="normative">
200
202
  <title>Terms and definitions</title>
203
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
201
204
  <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
202
205
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
203
206
  </formula>
@@ -225,6 +228,7 @@ RSpec.describe Asciidoctor::Standoc do
225
228
  #{BLANK_HDR}
226
229
  <sections>
227
230
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
231
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
228
232
 
229
233
  <term id="_">
230
234
  <preferred>Time</preferred>
@@ -300,6 +304,7 @@ r = 1 %</stem>
300
304
  </foreword></preface><sections>
301
305
  </sections><bibliography><references id="_" obligation="informative">
302
306
  <title>Normative References</title>
307
+ #{NORM_REF_BOILERPLATE}
303
308
  <bibitem id="iso216" type="standard">
304
309
  <title format="text/plain">Reference</title>
305
310
  <docidentifier>ISO 216:2001</docidentifier>
@@ -337,6 +342,7 @@ r = 1 %</stem>
337
342
  </foreword></preface><sections>
338
343
  </sections><bibliography><references id="_" obligation="informative">
339
344
  <title>Normative References</title>
345
+ #{NORM_REF_BOILERPLATE}
340
346
  <bibitem id="iso216" type="standard">
341
347
  <title format="text/plain">Reference</title>
342
348
  <docidentifier>ISO 216</docidentifier>
@@ -402,6 +408,7 @@ r = 1 %</stem>
402
408
  <sections>
403
409
  <terms id="_" obligation="normative">
404
410
  <title>Terms and definitions</title>
411
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
405
412
  <term id="_">
406
413
  <preferred>Term1</preferred>
407
414
  <termsource status="identical">
@@ -427,6 +434,7 @@ r = 1 %</stem>
427
434
  #{BLANK_HDR}
428
435
  <sections></sections>
429
436
  <bibliography><references id="_" obligation="informative"><title>Normative References</title>
437
+ #{NORM_REF_BOILERPLATE}
430
438
  <bibitem id="iso216" type="standard">
431
439
  <title format="text/plain">Reference</title>
432
440
  <docidentifier>ISO 216</docidentifier>
@@ -763,6 +771,7 @@ r = 1 %</stem>
763
771
  </p>
764
772
  </clause></sections><bibliography><references id="_" obligation="informative">
765
773
  <title>Normative References</title>
774
+ #{NORM_REF_BOILERPLATE}
766
775
  <bibitem id="iso123" type="standard">
767
776
  <title format="text/plain">Standard</title>
768
777
  <docidentifier>ISO 123:—</docidentifier>
@@ -833,6 +842,7 @@ r = 1 %</stem>
833
842
  <sections>
834
843
  <terms id="_" obligation="normative">
835
844
  <title>Terms and definitions</title>
845
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
836
846
  <term id="_"><preferred>Term</preferred>
837
847
 
838
848
 
@@ -954,7 +964,9 @@ r = 1 %</stem>
954
964
  #{BLANK_HDR}
955
965
 
956
966
  <sections>
957
- <terms id="_" obligation="normative"><title>Terms and definitions</title><term id="_">
967
+ <terms id="_" obligation="normative"><title>Terms and definitions</title>
968
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
969
+ <term id="_">
958
970
  <preferred>Automation1</preferred>
959
971
  <termsource status="identical">
960
972
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009"><locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality></origin>
@@ -973,6 +985,7 @@ r = 1 %</stem>
973
985
  </termsource>
974
986
  </term></terms></sections><bibliography><references id="_" obligation="informative">
975
987
  <title>Normative References</title>
988
+ #{NORM_REF_BOILERPLATE}
976
989
  <bibitem type="standard" id="IEC60050-102">
977
990
  <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
978
991
  <title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics - General concepts and linear algebra</title>
@@ -1274,6 +1287,72 @@ OUTPUT
1274
1287
  OUTPUT
1275
1288
  end
1276
1289
 
1290
+ it "inserts boilerplate before empty Normative References" do
1291
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
1292
+ #{ASCIIDOC_BLANK_HDR}
1293
+
1294
+ [bibliography]
1295
+ == Normative References
1296
+
1297
+ INPUT
1298
+ #{BLANK_HDR}
1299
+ <sections>
1300
+
1301
+ </sections><bibliography><references id="_" obligation="informative">
1302
+ <title>Normative References</title><p>There are no normative references in this document.</p>
1303
+ </references></bibliography>
1304
+ </standard-document>
1305
+ OUTPUT
1306
+ end
1307
+
1308
+ it "inserts boilerplate before non-empty Normative References" do
1309
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
1310
+ #{ASCIIDOC_BLANK_HDR}
1311
+
1312
+ [bibliography]
1313
+ == Normative References
1314
+ * [[[a,b]]] A
1315
+
1316
+ INPUT
1317
+ #{BLANK_HDR}
1318
+ <sections>
1319
+
1320
+ </sections><bibliography><references id="_" obligation="informative">
1321
+ <title>Normative References</title><p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
1322
+ <bibitem id="a">
1323
+ <formattedref format="application/x-isodoc+xml">A</formattedref>
1324
+ <docidentifier>b</docidentifier>
1325
+ </bibitem>
1326
+ </references></bibliography>
1327
+ </standard-document>
1328
+
1329
+ OUTPUT
1330
+ end
1331
+
1332
+ it "inserts boilerplate before empty Normative References in French" do
1333
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
1334
+ = Document title
1335
+ Author
1336
+ :docfile: test.adoc
1337
+ :nodoc:
1338
+ :novalid:
1339
+ :no-isobib:
1340
+ :language: fr
1341
+
1342
+ [bibliography]
1343
+ == Normative References
1344
+
1345
+ INPUT
1346
+ #{BLANK_HDR.sub(/<language>en/, "<language>fr")}
1347
+ <sections>
1348
+
1349
+ </sections><bibliography><references id="_" obligation="informative">
1350
+ <title>Normative References</title><p>Le présent document ne contient aucune référence normative.</p>
1351
+ </references></bibliography>
1352
+ </standard-document>
1353
+ OUTPUT
1354
+ end
1355
+
1277
1356
 
1278
1357
  private
1279
1358
 
@@ -150,6 +150,7 @@ RSpec.describe Asciidoctor::Standoc do
150
150
 
151
151
  </sections><bibliography><references id="_" obligation="informative">
152
152
  <title>Normative References</title>
153
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
153
154
  <bibitem id="ISO712">
154
155
  <formattedref format="application/x-isodoc+xml">Reference</formattedref>
155
156
  <docidentifier>x</docidentifier>
@@ -55,6 +55,7 @@ EOS
55
55
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
56
56
  <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
57
57
  <docidentifier type="ISO">ISO 124:2014</docidentifier>
58
+ <docnumber>124</docnumber>
58
59
  <date type="published">
59
60
  <on>2014</on>
60
61
  </date>
@@ -117,6 +118,7 @@ EOS
117
118
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
118
119
  <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
119
120
  <docidentifier type="ISO">ISO 123</docidentifier>
121
+ <docnumber>123</docnumber>
120
122
  <contributor>
121
123
  <role type="publisher"/>
122
124
  <organization>
@@ -158,6 +160,7 @@ EOS
158
160
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
159
161
  <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
160
162
  <docidentifier type="ISO">ISO 123:2001</docidentifier>
163
+ <docnumber>123</docnumber>
161
164
  <date type="published">
162
165
  <on>2001</on>
163
166
  </date>
@@ -220,6 +223,7 @@ EOS
220
223
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
221
224
  <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
222
225
  <docidentifier type="ISO">ISO 123:2001</docidentifier>
226
+ <docnumber>123</docnumber>
223
227
  <date type="published">
224
228
  <on>2001</on>
225
229
  </date>
@@ -40,6 +40,7 @@ RSpec.describe Asciidoctor::Standoc do
40
40
  <sections>
41
41
  </sections><bibliography><references id="_" obligation="informative">
42
42
  <title>Normative References</title>
43
+ #{NORM_REF_BOILERPLATE}
43
44
  <bibitem id="iso123" type="standard">
44
45
  <fetched>#{Date.today}</fetched>
45
46
  <title type="main" format="text/plain" language="en" script="Latn">Standard</title>
@@ -288,6 +289,7 @@ formattedref::
288
289
  <sections>
289
290
  </sections><bibliography><references id="_" obligation="informative">
290
291
  <title>Normative References</title>
292
+ #{NORM_REF_BOILERPLATE}
291
293
  <bibitem id="TC211" type="standard">
292
294
  <fetched>2019-06-30</fetched>
293
295
  <title type="main" format="text/plain">Geographic information</title>
@@ -605,6 +607,7 @@ series.formattedref.script:: Latn
605
607
  <sections>
606
608
  </sections><bibliography><references id="_" obligation="informative">
607
609
  <title>Normative References</title>
610
+ #{NORM_REF_BOILERPLATE}
608
611
  <bibitem id="TC211" type="standard">
609
612
  <fetched>2019-06-30</fetched>
610
613
  <title type="main" format="text/plain">Geographic information</title>
@@ -15,6 +15,7 @@ RSpec.describe Asciidoctor::Standoc do
15
15
  <sections>
16
16
  </sections><bibliography><references id="_" obligation="informative">
17
17
  <title>Normative References</title>
18
+ #{NORM_REF_BOILERPLATE}
18
19
  <bibitem id="iso123" type="standard">
19
20
  <title format="text/plain">Standard</title>
20
21
  <docidentifier>ISO 123</docidentifier>
@@ -43,6 +44,7 @@ RSpec.describe Asciidoctor::Standoc do
43
44
  <sections>
44
45
  </sections><bibliography><references id="_" obligation="informative">
45
46
  <title>Normative References</title>
47
+ #{NORM_REF_BOILERPLATE}
46
48
  <bibitem id="iso123" type="standard">
47
49
  <title format="text/plain">Standard</title>
48
50
  <docidentifier>ISO 123:1066-1067</docidentifier>
@@ -76,6 +78,7 @@ RSpec.describe Asciidoctor::Standoc do
76
78
  #{BLANK_HDR}
77
79
  <sections>
78
80
  </sections><bibliography><references id="_" obligation="informative"><title>Normative References</title>
81
+ #{NORM_REF_BOILERPLATE}
79
82
  <bibitem type="standard" id="iso123">
80
83
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
81
84
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
@@ -139,6 +142,7 @@ RSpec.describe Asciidoctor::Standoc do
139
142
  <sections>
140
143
 
141
144
  </sections><bibliography><references id="_" obligation="informative"><title>Normative References</title>
145
+ #{NORM_REF_BOILERPLATE}
142
146
  <bibitem id="iso123" type="standard">
143
147
  <fetched>#{Date.today}</fetched>
144
148
  <title type="title-intro" format="text/plain" language="en" script="Latn">Rubber latex</title>
@@ -150,6 +154,7 @@ RSpec.describe Asciidoctor::Standoc do
150
154
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
151
155
  <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
152
156
  <docidentifier type="ISO">ISO 123</docidentifier>
157
+ <docnumber>123</docnumber>
153
158
  <contributor>
154
159
  <role type="publisher"/>
155
160
  <organization>
@@ -191,6 +196,7 @@ RSpec.describe Asciidoctor::Standoc do
191
196
  <uri type="src">https://www.iso.org/standard/23281.html</uri>
192
197
  <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
193
198
  <docidentifier type="ISO">ISO 123:2001</docidentifier>
199
+ <docnumber>123</docnumber>
194
200
  <date type="published">
195
201
  <on>2001</on>
196
202
  </date>
@@ -243,6 +249,7 @@ RSpec.describe Asciidoctor::Standoc do
243
249
  <sections>
244
250
  </sections><bibliography><references id="_" obligation="informative">
245
251
  <title>Normative References</title>
252
+ #{NORM_REF_BOILERPLATE}
246
253
  <bibitem id="iso123" type="standard">
247
254
  <title format="text/plain">Standard</title>
248
255
  <docidentifier>IEC 123</docidentifier>
@@ -276,6 +283,7 @@ RSpec.describe Asciidoctor::Standoc do
276
283
 
277
284
  </sections><bibliography><references id="_" obligation="informative">
278
285
  <title>Normative References</title>
286
+ #{NORM_REF_BOILERPLATE}
279
287
  <bibitem type="standard" id="iso123">
280
288
  <fetched>#{Date.today}</fetched>
281
289
  <title type="title-main" format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
@@ -286,6 +294,7 @@ RSpec.describe Asciidoctor::Standoc do
286
294
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
287
295
  <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
288
296
  <docidentifier type="ISO">ISO/IEC TR 12382:1992</docidentifier>
297
+ <docnumber>12382</docnumber>
289
298
  <date type="published">
290
299
  <on>1992</on>
291
300
  </date>
@@ -335,6 +344,7 @@ RSpec.describe Asciidoctor::Standoc do
335
344
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
336
345
  <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
337
346
  <docidentifier type="ISO">ISO 124:2014</docidentifier>
347
+ <docnumber>124</docnumber>
338
348
  <date type="published">
339
349
  <on>2014</on>
340
350
  </date>
@@ -391,6 +401,7 @@ RSpec.describe Asciidoctor::Standoc do
391
401
  <sections>
392
402
  </sections><bibliography><references id="_" obligation="informative">
393
403
  <title>Normative References</title>
404
+ #{NORM_REF_BOILERPLATE}
394
405
  <bibitem id="iso123" type="standard">
395
406
  <title format="text/plain">Standard</title>
396
407
  <docidentifier>ISO 123:—</docidentifier>
@@ -425,6 +436,7 @@ RSpec.describe Asciidoctor::Standoc do
425
436
  <sections>
426
437
  </sections><bibliography><references id="_" obligation="informative">
427
438
  <title>Normative References</title>
439
+ #{NORM_REF_BOILERPLATE}
428
440
  <bibitem id="iso123" type="standard">
429
441
  <title format="text/plain">Standard</title>
430
442
  <docidentifier>ISO 123:1066 (all parts)</docidentifier>
@@ -471,6 +483,7 @@ RSpec.describe Asciidoctor::Standoc do
471
483
  </clause>
472
484
  </sections><bibliography><references id="_" obligation="informative">
473
485
  <title>Normative References</title>
486
+ #{NORM_REF_BOILERPLATE}
474
487
  <bibitem id="iso123">
475
488
  <fetched>#{Date.today}</fetched>
476
489
  <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
@@ -540,6 +553,7 @@ RSpec.describe Asciidoctor::Standoc do
540
553
 
541
554
  </sections><bibliography><references id="_" obligation="informative">
542
555
  <title>Normative References</title>
556
+ #{NORM_REF_BOILERPLATE}
543
557
  <bibitem id="iso123">
544
558
  <formattedref format="application/x-isodoc+xml">
545
559
  <em>Standard</em>
@@ -606,6 +620,7 @@ RSpec.describe Asciidoctor::Standoc do
606
620
 
607
621
  </sections><bibliography><references id="_" obligation="informative">
608
622
  <title>Normative References</title>
623
+ #{NORM_REF_BOILERPLATE}
609
624
  <bibitem id="iso123" type="standard">
610
625
  <title format="text/plain">Standard</title>
611
626
  <docidentifier type="ISO">ISO 123</docidentifier>
@@ -95,6 +95,8 @@ RSpec.describe Asciidoctor::Standoc do
95
95
 
96
96
  <terms id="_" obligation="normative">
97
97
  <title>Terms and definitions</title>
98
+ <p>For the purposes of this document,
99
+ the following terms and definitions apply.</p>
98
100
  <term id="_">
99
101
  <preferred>Term1</preferred>
100
102
  </term>
@@ -152,6 +154,7 @@ RSpec.describe Asciidoctor::Standoc do
152
154
  </clause>
153
155
  </annex><bibliography><references id="_" obligation="informative">
154
156
  <title>Normative References</title>
157
+ <p>There are no normative references in this document.</p>
155
158
  </references><clause id="_" obligation="informative">
156
159
  <title>Bibliography</title>
157
160
  <references id="_" obligation="informative">
@@ -279,6 +282,8 @@ RSpec.describe Asciidoctor::Standoc do
279
282
 
280
283
  <terms id="_" language="en" script="Latn" obligation="normative">
281
284
  <title>Terms and definitions</title>
285
+ <p>For the purposes of this document,
286
+ the following terms and definitions apply.</p>
282
287
  <term id="_" language="en" script="Latn">
283
288
  <preferred>Term1</preferred>
284
289
  </term>
@@ -336,6 +341,7 @@ RSpec.describe Asciidoctor::Standoc do
336
341
  </clause>
337
342
  </annex><bibliography><references id="_" language="en" script="Latn" obligation="informative">
338
343
  <title>Normative References</title>
344
+ <p>There are no normative references in this document.</p>
339
345
  </references><clause id="_" language="en" script="Latn" obligation="informative">
340
346
  <title>Bibliography</title>
341
347
  <references id="_" language="en" script="Latn" obligation="informative">
@@ -415,6 +421,8 @@ RSpec.describe Asciidoctor::Standoc do
415
421
  <sections>
416
422
  <terms id="_" obligation="normative">
417
423
  <title>Terms and definitions</title>
424
+ <p>For the purposes of this document,
425
+ the following terms and definitions apply.</p>
418
426
  <term id="_">
419
427
  <preferred>Term1</preferred>
420
428
  </term>
@@ -441,6 +449,7 @@ RSpec.describe Asciidoctor::Standoc do
441
449
  </clause>
442
450
  </annex><bibliography><references id="_" obligation="informative">
443
451
  <title>Normative References</title>
452
+ <p>There are no normative references in this document.</p>
444
453
  </references><clause id="_" obligation="informative">
445
454
  <title>Bibliography</title>
446
455
  <references id="_" obligation="informative">
@@ -534,7 +543,61 @@ RSpec.describe Asciidoctor::Standoc do
534
543
  OUTPUT
535
544
  end
536
545
 
537
- it "processes term document sources" do
546
+ it "processes terms & definitions with external source" do
547
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
548
+ #{ASCIIDOC_BLANK_HDR}
549
+
550
+ Foreword
551
+
552
+ [source="iso1234,iso5678"]
553
+ == Terms and Definitions
554
+
555
+ === Term1
556
+
557
+ INPUT
558
+ #{BLANK_HDR}
559
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
560
+ <preface><foreword obligation="informative">
561
+ <title>Foreword</title>
562
+ <p id="_">Foreword</p>
563
+ </foreword></preface><sections>
564
+ <terms id="_" obligation="normative">
565
+ <title>Terms and definitions</title><p>For the purposes of this document, the terms and definitions
566
+ given in <eref bibitem="iso1234"/> and <eref bibitem="iso5678"/> and the following apply.</p>
567
+ <term id="_">
568
+ <preferred>Term1</preferred>
569
+ </term>
570
+ </terms></sections>
571
+ </standard-document>
572
+
573
+ OUTPUT
574
+ end
575
+
576
+ it "processes empty terms & definitions" do
577
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
578
+ #{ASCIIDOC_BLANK_HDR}
579
+
580
+ Foreword
581
+
582
+ == Terms and Definitions
583
+
584
+
585
+ INPUT
586
+ #{BLANK_HDR}
587
+ <preface><foreword obligation="informative">
588
+ <title>Foreword</title>
589
+ <p id="_">Foreword</p>
590
+ </foreword></preface><sections>
591
+ <terms id="_" obligation="normative">
592
+ <title>Terms and definitions</title><p>No terms and definitions are listed in this document.</p>
593
+ </terms></sections>
594
+ </standard-document>
595
+
596
+ OUTPUT
597
+ end
598
+
599
+
600
+ it "processes empty terms & definitions with external source" do
538
601
  expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
539
602
  #{ASCIIDOC_BLANK_HDR}
540
603
 
@@ -552,6 +615,41 @@ RSpec.describe Asciidoctor::Standoc do
552
615
  </foreword></preface><sections>
553
616
  <terms id="_" obligation="normative">
554
617
  <title>Terms and definitions</title>
618
+ <p>For the purposes of this document,
619
+ the terms and definitions given in <eref bibitem="iso1234"/> and <eref bibitem="iso5678"/> apply.</p>
620
+
621
+
622
+ </terms></sections>
623
+ </standard-document>
624
+
625
+ OUTPUT
626
+ end
627
+
628
+ it "processes term document sources in French" do
629
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
630
+ = Document title
631
+ Author
632
+ :docfile: test.adoc
633
+ :nodoc:
634
+ :novalid:
635
+ :no-isobib:
636
+ :language: fr
637
+
638
+ Foreword
639
+
640
+ [source="iso1234,iso5678"]
641
+ == Terms and Definitions
642
+
643
+ INPUT
644
+ #{BLANK_HDR.sub(%r{<language>en</language>}, "<language>fr</language>")}
645
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
646
+ <preface><foreword obligation="informative">
647
+ <title>Foreword</title>
648
+ <p id="_">Foreword</p>
649
+ </foreword></preface><sections>
650
+ <terms id="_" obligation="normative">
651
+ <title>Terms and definitions</title>
652
+ <p>Pour les besoins du présent document, les termes et définitions de <eref bibitem="iso1234"/> et <eref bibitem="iso5678"/> s'appliquent.</p>
555
653
 
556
654
 
557
655
  </terms></sections>
@@ -560,4 +658,46 @@ RSpec.describe Asciidoctor::Standoc do
560
658
  OUTPUT
561
659
  end
562
660
 
661
+ it "processes term document sources in Chinese" do
662
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
663
+ = Document title
664
+ Author
665
+ :docfile: test.adoc
666
+ :nodoc:
667
+ :novalid:
668
+ :no-isobib:
669
+ :language: zh
670
+ :script: Hans
671
+
672
+ Foreword
673
+
674
+ [source="iso1234,iso5678"]
675
+ == Terms and Definitions
676
+
677
+ INPUT
678
+ #{BLANK_HDR.sub(%r{<language>en</language>}, "<language>zh</language>").sub(%r{<script>Latn</script>}, "<script>Hans</script>")}
679
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/><preface><foreword obligation="informative">
680
+ <title>Foreword</title>
681
+ <p id="_">Foreword</p>
682
+ </foreword></preface><sections>
683
+ <terms id="_" obligation="normative">
684
+ <title>Terms and definitions</title><p><eref bibitem="iso1234"/>和<eref bibitem="iso5678"/>界定的术语和定义适用于本文件。</p>
685
+
686
+
687
+
688
+ </terms></sections>
689
+ </standard-document>
690
+ OUTPUT
691
+ end
692
+
693
+ it "warn about external source for terms & definitions that does not point anywhere" do
694
+ expect{Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)}.to output(/not referenced/).to_stderr
695
+ #{ASCIIDOC_BLANK_HDR}
696
+
697
+ [source="iso712"]
698
+ == Terms and Definitions
699
+ === Term2
700
+ INPUT
701
+ end
702
+
563
703
  end
@@ -49,8 +49,7 @@ RSpec.describe Metanorma::Standoc::Processor do
49
49
  expect(File.read("test.html", encoding: "utf-8").gsub(%r{^.*<main}m, "<main").gsub(%r{</main>.*}m, "</main>")).to be_equivalent_to <<~"OUTPUT"
50
50
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
51
51
  <p class="zzSTDTitle1"></p>
52
- <div id="H"><h1>1.&#xA0; Terms and definitions</h1><p>For the purposes of this document,
53
- the following terms and definitions apply.</p>
52
+ <div id="H"><h1>1.&#xA0; Terms and definitions</h1>
54
53
  <h2 class="TermNum" id="J">1.1.</h2>
55
54
  <p class="Terms" style="text-align:left;">Term2</p>
56
55
  </div>
data/spec/spec_helper.rb CHANGED
@@ -113,6 +113,10 @@ VALIDATING_BLANK_HDR = <<~"HDR"
113
113
 
114
114
  HDR
115
115
 
116
+ NORM_REF_BOILERPLATE = <<~"HDR"
117
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
118
+ HDR
119
+
116
120
  BLANK_HDR = <<~"HDR"
117
121
  <?xml version="1.0" encoding="UTF-8"?>
118
122
  <standard-document xmlns="http://riboseinc.com/isoxml">