metanorma-standoc 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +3 -1
  3. data/lib/metanorma/standoc/biblio.rng +32 -34
  4. data/lib/metanorma/standoc/blocks.rb +8 -3
  5. data/lib/metanorma/standoc/blocks_notes.rb +3 -0
  6. data/lib/metanorma/standoc/cleanup.rb +1 -0
  7. data/lib/metanorma/standoc/cleanup_footnotes.rb +14 -9
  8. data/lib/metanorma/standoc/cleanup_inline.rb +17 -0
  9. data/lib/metanorma/standoc/cleanup_terms.rb +3 -1
  10. data/lib/metanorma/standoc/cleanup_text.rb +9 -4
  11. data/lib/metanorma/standoc/converter.rb +2 -0
  12. data/lib/metanorma/standoc/isodoc.rng +9 -0
  13. data/lib/metanorma/standoc/lists.rb +8 -3
  14. data/lib/metanorma/standoc/macros.rb +28 -1
  15. data/lib/metanorma/standoc/macros_note.rb +1 -6
  16. data/lib/metanorma/standoc/version.rb +1 -1
  17. data/metanorma-standoc.gemspec +1 -1
  18. data/spec/metanorma/base_spec.rb +41 -5
  19. data/spec/metanorma/blocks_spec.rb +53 -1
  20. data/spec/metanorma/cleanup_sections_spec.rb +5 -5
  21. data/spec/metanorma/cleanup_spec.rb +5 -5
  22. data/spec/metanorma/cleanup_terms_spec.rb +1 -1
  23. data/spec/metanorma/inline_spec.rb +3 -3
  24. data/spec/metanorma/lists_spec.rb +10 -4
  25. data/spec/metanorma/macros_spec.rb +21 -12
  26. data/spec/metanorma/refs_spec.rb +1 -1
  27. data/spec/metanorma/table_spec.rb +24 -6
  28. data/spec/spec_helper.rb +1 -1
  29. data/spec/vcr_cassettes/bsi16341.yml +64 -64
  30. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +83 -83
  31. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
  32. data/spec/vcr_cassettes/hide_refs.yml +55 -55
  33. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  34. data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
  35. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
  36. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  37. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  38. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  39. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +47 -49
  40. data/spec/vcr_cassettes/std-link.yml +12 -12
  41. metadata +7 -8
  42. data/docs/quickstart.adoc +0 -375
@@ -467,7 +467,7 @@ RSpec.describe Metanorma::Standoc do
467
467
  <from>#{Time.now.year}</from>
468
468
  </copyright>
469
469
  <ext>
470
- <doctype>article</doctype>
470
+ <doctype>standard</doctype>
471
471
  </ext>
472
472
  </bibdata>
473
473
  <preface>
@@ -762,7 +762,7 @@ RSpec.describe Metanorma::Standoc do
762
762
  <from>#{Time.now.year}</from>
763
763
  </copyright>
764
764
  <ext>
765
- <doctype>article</doctype>
765
+ <doctype>standard</doctype>
766
766
  </ext>
767
767
  </bibdata>
768
768
  <preface>
@@ -996,7 +996,7 @@ RSpec.describe Metanorma::Standoc do
996
996
  <from>#{Time.now.year}</from>
997
997
  </copyright>
998
998
  <ext>
999
- <doctype>article</doctype>
999
+ <doctype>standard</doctype>
1000
1000
  </ext>
1001
1001
  </bibdata>
1002
1002
  <preface>
@@ -1233,7 +1233,7 @@ RSpec.describe Metanorma::Standoc do
1233
1233
  <from>#{Time.now.year}</from>
1234
1234
  </copyright>
1235
1235
  <ext>
1236
- <doctype>article</doctype>
1236
+ <doctype>standard</doctype>
1237
1237
  </ext>
1238
1238
  </bibdata>
1239
1239
  <preface>
@@ -1467,7 +1467,7 @@ RSpec.describe Metanorma::Standoc do
1467
1467
  <from>#{Time.now.year}</from>
1468
1468
  </copyright>
1469
1469
  <ext>
1470
- <doctype>article</doctype>
1470
+ <doctype>standard</doctype>
1471
1471
  </ext>
1472
1472
  </bibdata>
1473
1473
  <preface>
@@ -1042,7 +1042,7 @@ RSpec.describe Metanorma::Standoc do
1042
1042
  </bibitem>
1043
1043
  </relation>
1044
1044
  <ext>
1045
- <doctype>article</doctype>
1045
+ <doctype>standard</doctype>
1046
1046
  </ext>
1047
1047
  </bibdata>
1048
1048
  <sections> </sections>
@@ -1085,7 +1085,7 @@ RSpec.describe Metanorma::Standoc do
1085
1085
  <from>#{Date.today.year}</from>
1086
1086
  </copyright>
1087
1087
  <ext>
1088
- <doctype>article</doctype>
1088
+ <doctype>standard</doctype>
1089
1089
  </ext>
1090
1090
  </bibdata>
1091
1091
  <boilerplate>
@@ -1281,7 +1281,7 @@ RSpec.describe Metanorma::Standoc do
1281
1281
  <from>#{Time.now.year}</from>
1282
1282
  </copyright>
1283
1283
  <ext>
1284
- <doctype>article</doctype>
1284
+ <doctype>standard</doctype>
1285
1285
  </ext>
1286
1286
  </bibdata>
1287
1287
  <sections>
@@ -1382,7 +1382,7 @@ RSpec.describe Metanorma::Standoc do
1382
1382
  <from>#{Time.now.year}</from>
1383
1383
  </copyright>
1384
1384
  <ext>
1385
- <doctype>article</doctype>
1385
+ <doctype>standard</doctype>
1386
1386
  </ext>
1387
1387
  </bibdata>
1388
1388
  <sections> </sections>
@@ -1836,7 +1836,7 @@ RSpec.describe Metanorma::Standoc do
1836
1836
  <from>#{Time.now.year}</from>
1837
1837
  </copyright>
1838
1838
  <ext>
1839
- <doctype>article</doctype>
1839
+ <doctype>standard</doctype>
1840
1840
  </ext>
1841
1841
  </bibdata>
1842
1842
  <preface>
@@ -1430,7 +1430,7 @@ RSpec.describe Metanorma::Standoc do
1430
1430
  <from>#{Time.now.year}</from>
1431
1431
  </copyright>
1432
1432
  <ext>
1433
- <doctype>article</doctype>
1433
+ <doctype>standard</doctype>
1434
1434
  </ext>
1435
1435
  </bibdata>
1436
1436
  <sections>
@@ -23,7 +23,7 @@ RSpec.describe Metanorma::Standoc do
23
23
  <from>#{Date.today.year}</from>
24
24
  </copyright>
25
25
  <ext>
26
- <doctype>article</doctype>
26
+ <doctype>standard</doctype>
27
27
  </ext>
28
28
  </bibdata>
29
29
  <sections>
@@ -685,13 +685,13 @@ RSpec.describe Metanorma::Standoc do
685
685
  input = <<~INPUT
686
686
  #{ASCIIDOC_BLANK_HDR}
687
687
 
688
- pass-format:rfc,html[<abc>X &gt; Y</abc>]
688
+ pass-format:rfc,html[<abc>X &gt; Y</abc> http://www.example.com (c)]
689
689
  INPUT
690
690
  output = <<~OUTPUT
691
691
  #{BLANK_HDR}
692
692
  <sections>
693
693
  <p id='_'>
694
- <passthrough formats='rfc,html'>&lt;abc&gt;X &gt; Y&lt;/abc&gt;</passthrough>
694
+ <passthrough formats='rfc,html'>&lt;abc&gt;X &gt; Y&lt;/abc&gt; http://www.example.com (c)</passthrough>
695
695
  </p>
696
696
  </sections>
697
697
  </standard-document>
@@ -4,6 +4,7 @@ RSpec.describe Metanorma::Standoc do
4
4
  it "processes simple lists" do
5
5
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
6
6
  #{ASCIIDOC_BLANK_HDR}
7
+ .Unordered list
7
8
  * List 1
8
9
  * List 2
9
10
  * List 3
@@ -12,10 +13,12 @@ RSpec.describe Metanorma::Standoc do
12
13
  * [x] also checked
13
14
  * [ ] not checked
14
15
 
16
+ .Ordered list
15
17
  . List A
16
18
  . List B
17
19
  . List C
18
20
 
21
+ .Definition list
19
22
  List D:: List E
20
23
  List F:: List G
21
24
 
@@ -24,6 +27,7 @@ RSpec.describe Metanorma::Standoc do
24
27
  #{BLANK_HDR}
25
28
  <sections>
26
29
  <ul id='_'>
30
+ <name>Unordered list</name>
27
31
  <li>
28
32
  <p id='_'>List 1</p>
29
33
  </li>
@@ -41,7 +45,10 @@ RSpec.describe Metanorma::Standoc do
41
45
  </li>
42
46
  <li uncheckedcheckbox='true' checkedcheckbox='false'>
43
47
  <p id='_'>not checked</p>
48
+ </li>
49
+ </ul>
44
50
  <ol id='_' type='arabic'>
51
+ <name>Ordered list</name>
45
52
  <li>
46
53
  <p id='_'>List A</p>
47
54
  </li>
@@ -50,7 +57,10 @@ RSpec.describe Metanorma::Standoc do
50
57
  </li>
51
58
  <li>
52
59
  <p id='_'>List C</p>
60
+ </li>
61
+ </ol>
53
62
  <dl id='_'>
63
+ <name>Definition list</name>
54
64
  <dt>List D</dt>
55
65
  <dd>
56
66
  <p id='_'>List E</p>
@@ -60,10 +70,6 @@ RSpec.describe Metanorma::Standoc do
60
70
  <p id='_'>List G</p>
61
71
  </dd>
62
72
  </dl>
63
- </li>
64
- </ol>
65
- </li>
66
- </ul>
67
73
  </sections>
68
74
  </standard-document>
69
75
  OUTPUT
@@ -12,6 +12,7 @@ RSpec.describe Metanorma::Standoc do
12
12
  inherit:[<<ref1>>]
13
13
  autonumber:table[3]
14
14
  add:[a <<clause>>] del:[B]
15
+ identifier:[a http://example.com]
15
16
 
16
17
  [bibliography]
17
18
  == Bibliography
@@ -36,6 +37,7 @@ RSpec.describe Metanorma::Standoc do
36
37
  <xref target='clause'/>
37
38
  </add>
38
39
  <del>B</del>
40
+ <identifier>a http://example.com</identifier>
39
41
  </foreword>
40
42
  </preface>
41
43
  <sections> </sections>
@@ -818,7 +820,7 @@ RSpec.describe Metanorma::Standoc do
818
820
  output = <<~OUTPUT
819
821
  #{BLANK_HDR}
820
822
  <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
821
- <p id="_"/>
823
+ <p id="_">Note1</p>
822
824
  </review>
823
825
  <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
824
826
  <p id="_">Note2</p>
@@ -1326,7 +1328,7 @@ RSpec.describe Metanorma::Standoc do
1326
1328
  <from>2022</from>
1327
1329
  </copyright>
1328
1330
  <ext>
1329
- <doctype>article</doctype>
1331
+ <doctype>standard</doctype>
1330
1332
  </ext>
1331
1333
  <relation type='derivedFrom'>
1332
1334
  <bibitem>
@@ -1340,7 +1342,7 @@ RSpec.describe Metanorma::Standoc do
1340
1342
  <from>2022</from>
1341
1343
  </copyright>
1342
1344
  <ext>
1343
- <doctype>article</doctype>
1345
+ <doctype>standard</doctype>
1344
1346
  </ext>
1345
1347
  </bibitem>
1346
1348
  </relation>
@@ -1384,7 +1386,7 @@ RSpec.describe Metanorma::Standoc do
1384
1386
  <from>2022</from>
1385
1387
  </copyright>
1386
1388
  <ext>
1387
- <doctype>article</doctype>
1389
+ <doctype>standard</doctype>
1388
1390
  </ext>
1389
1391
  <relation type='derivedFrom'>
1390
1392
  <bibitem>
@@ -1398,7 +1400,7 @@ RSpec.describe Metanorma::Standoc do
1398
1400
  <from>2022</from>
1399
1401
  </copyright>
1400
1402
  <ext>
1401
- <doctype>article</doctype>
1403
+ <doctype>standard</doctype>
1402
1404
  </ext>
1403
1405
  </bibitem>
1404
1406
  </relation>
@@ -1436,7 +1438,7 @@ RSpec.describe Metanorma::Standoc do
1436
1438
  <from>2022</from>
1437
1439
  </copyright>
1438
1440
  <ext>
1439
- <doctype>article</doctype>
1441
+ <doctype>standard</doctype>
1440
1442
  </ext>
1441
1443
  <relation type='derivedFrom'>
1442
1444
  <bibitem>
@@ -1450,7 +1452,7 @@ RSpec.describe Metanorma::Standoc do
1450
1452
  <from>2022</from>
1451
1453
  </copyright>
1452
1454
  <ext>
1453
- <doctype>article</doctype>
1455
+ <doctype>standard</doctype>
1454
1456
  </ext>
1455
1457
  <relation type='derivedFrom'>
1456
1458
  <bibitem>
@@ -1464,7 +1466,7 @@ RSpec.describe Metanorma::Standoc do
1464
1466
  <from>2022</from>
1465
1467
  </copyright>
1466
1468
  <ext>
1467
- <doctype>article</doctype>
1469
+ <doctype>standard</doctype>
1468
1470
  </ext>
1469
1471
  <relation type='derivedFrom'>
1470
1472
  <bibitem>
@@ -1478,7 +1480,7 @@ RSpec.describe Metanorma::Standoc do
1478
1480
  <from>2022</from>
1479
1481
  </copyright>
1480
1482
  <ext>
1481
- <doctype>article</doctype>
1483
+ <doctype>standard</doctype>
1482
1484
  </ext>
1483
1485
  </bibitem>
1484
1486
  </relation>
@@ -1494,7 +1496,7 @@ RSpec.describe Metanorma::Standoc do
1494
1496
  <from>2022</from>
1495
1497
  </copyright>
1496
1498
  <ext>
1497
- <doctype>article</doctype>
1499
+ <doctype>standard</doctype>
1498
1500
  </ext>
1499
1501
  </bibitem>
1500
1502
  </relation>
@@ -1557,7 +1559,7 @@ RSpec.describe Metanorma::Standoc do
1557
1559
  <from>2022</from>
1558
1560
  </copyright>
1559
1561
  <ext>
1560
- <doctype>article</doctype>
1562
+ <doctype>standard</doctype>
1561
1563
  </ext>
1562
1564
  <relation type='derivedFrom'>
1563
1565
  <bibitem>
@@ -1607,12 +1609,19 @@ RSpec.describe Metanorma::Standoc do
1607
1609
  </owner>
1608
1610
  </copyright>
1609
1611
  <ext>
1610
- <doctype>article</doctype>
1612
+ <doctype>standard</doctype>
1611
1613
  <editorialgroup>
1614
+ <agency>ISO</agency>
1612
1615
  <technical-committee/>
1613
1616
  <subcommittee/>
1614
1617
  <workgroup/>
1615
1618
  </editorialgroup>
1619
+ <approvalgroup>
1620
+ <agency>ISO</agency>
1621
+ <technical-committee/>
1622
+ <subcommittee/>
1623
+ <workgroup/>
1624
+ </approvalgroup>
1616
1625
  <stagename>International standard</stagename>
1617
1626
  </ext>
1618
1627
  </bibitem>
@@ -1906,7 +1906,7 @@ RSpec.describe Metanorma::Standoc do
1906
1906
  <from>#{Date.today.year}</from>
1907
1907
  </copyright>
1908
1908
  <ext>
1909
- <doctype>article</doctype>
1909
+ <doctype>standard</doctype>
1910
1910
  </ext>
1911
1911
  </bibdata>
1912
1912
  <sections>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Metanorma::Standoc do
4
4
  it "processes basic tables" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  .Table Name
8
8
  |===
@@ -11,6 +11,7 @@ RSpec.describe Metanorma::Standoc do
11
11
  h|1 |2 |3
12
12
  |===
13
13
  INPUT
14
+ output = <<~OUTPUT
14
15
  #{BLANK_HDR}
15
16
  <sections>
16
17
  <table id="_">
@@ -33,10 +34,12 @@ RSpec.describe Metanorma::Standoc do
33
34
  </sections>
34
35
  </standard-document>
35
36
  OUTPUT
37
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
38
+ .to be_equivalent_to xmlpp(output)
36
39
  end
37
40
 
38
41
  it "processes table widths" do
39
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
42
+ input = <<~INPUT
40
43
  #{ASCIIDOC_BLANK_HDR}
41
44
  [width=75%]
42
45
  |===
@@ -57,6 +60,7 @@ RSpec.describe Metanorma::Standoc do
57
60
  |===
58
61
 
59
62
  INPUT
63
+ output = <<~OUTPUT
60
64
  #{BLANK_HDR}
61
65
  <sections>
62
66
  <table id='_' width='75%'>
@@ -93,10 +97,12 @@ RSpec.describe Metanorma::Standoc do
93
97
  </standard-document>
94
98
 
95
99
  OUTPUT
100
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
101
+ .to be_equivalent_to xmlpp(output)
96
102
  end
97
103
 
98
104
  it "processes column widths in tables" do
99
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
105
+ input = <<~INPUT
100
106
  #{ASCIIDOC_BLANK_HDR}
101
107
  [cols=".<,.^,^.>"]
102
108
  |===
@@ -120,6 +126,7 @@ RSpec.describe Metanorma::Standoc do
120
126
  |1 |2 |3
121
127
  |===
122
128
  INPUT
129
+ output = <<~OUTPUT
123
130
  #{BLANK_HDR}
124
131
  <sections>
125
132
  <table id='_'>
@@ -178,10 +185,12 @@ RSpec.describe Metanorma::Standoc do
178
185
  </sections>
179
186
  </standard-document>
180
187
  OUTPUT
188
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
189
+ .to be_equivalent_to xmlpp(output)
181
190
  end
182
191
 
183
192
  it "inserts header rows in a table with a name and no header" do
184
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
193
+ input = <<~INPUT
185
194
  #{ASCIIDOC_BLANK_HDR}
186
195
  [headerrows=2]
187
196
  .Table Name
@@ -191,6 +200,7 @@ RSpec.describe Metanorma::Standoc do
191
200
  h|1 |2 |3
192
201
  |===
193
202
  INPUT
203
+ output = <<~OUTPUT
194
204
  #{BLANK_HDR}
195
205
  <sections>
196
206
  <table id="_">
@@ -217,10 +227,12 @@ RSpec.describe Metanorma::Standoc do
217
227
  </sections>
218
228
  </standard-document>
219
229
  OUTPUT
230
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
231
+ .to be_equivalent_to xmlpp(output)
220
232
  end
221
233
 
222
234
  it "inserts header rows in a table without a name and no header" do
223
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
235
+ input = <<~INPUT
224
236
  #{ASCIIDOC_BLANK_HDR}
225
237
  [headerrows=2]
226
238
  |===
@@ -229,6 +241,7 @@ RSpec.describe Metanorma::Standoc do
229
241
  h|1 |2 |3
230
242
  |===
231
243
  INPUT
244
+ output = <<~OUTPUT
232
245
  #{BLANK_HDR}
233
246
  <sections>
234
247
  <table id="_"><thead><tr>
@@ -253,10 +266,12 @@ RSpec.describe Metanorma::Standoc do
253
266
  </sections>
254
267
  </standard-document>
255
268
  OUTPUT
269
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
270
+ .to be_equivalent_to xmlpp(output)
256
271
  end
257
272
 
258
273
  it "processes complex tables" do
259
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
274
+ input = <<~INPUT
260
275
  #{ASCIIDOC_BLANK_HDR}
261
276
  [cols="<.^,^.<,^.>,^,^",options="header,footer",headerrows=2,alt="An extensive summary, and illustration, of tables",subsequence="A",options="unnumbered",summary="This is an extremely long, convoluted summary",width=70%,number="3",keep-with-next=true,keep-lines-together=true]
262
277
  .Maximum _permissible_ mass fraction of defects
@@ -286,6 +301,7 @@ RSpec.describe Metanorma::Standoc do
286
301
  5+a| Live insects shall not be present. Dead insects shall be included in extraneous matter.
287
302
  |===
288
303
  INPUT
304
+ output = <<~OUTPUT
289
305
  #{BLANK_HDR}
290
306
  <sections>
291
307
  <table id="_" alt="An extensive summary, and illustration, of tables" unnumbered="true" subsequence="A" summary="This is an extremely long, convoluted summary" width="70%" number="3" keep-with-next="true" keep-lines-together="true">
@@ -452,5 +468,7 @@ RSpec.describe Metanorma::Standoc do
452
468
  </sections>
453
469
  </standard-document>
454
470
  OUTPUT
471
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
472
+ .to be_equivalent_to xmlpp(output)
455
473
  end
456
474
  end
data/spec/spec_helper.rb CHANGED
@@ -161,7 +161,7 @@ BLANK_HDR = <<~"HDR".freeze
161
161
  <from>#{Time.new.year}</from>
162
162
  </copyright>
163
163
  <ext>
164
- <doctype>article</doctype>
164
+ <doctype>standard</doctype>
165
165
  </ext>
166
166
  </bibdata>
167
167
  HDR