metanorma-standoc 2.0.7 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +3 -1
  3. data/lib/metanorma/standoc/biblio.rng +69 -42
  4. data/lib/metanorma/standoc/blocks.rb +8 -3
  5. data/lib/metanorma/standoc/blocks_notes.rb +20 -11
  6. data/lib/metanorma/standoc/cleanup.rb +1 -0
  7. data/lib/metanorma/standoc/cleanup_block.rb +10 -0
  8. data/lib/metanorma/standoc/cleanup_footnotes.rb +14 -9
  9. data/lib/metanorma/standoc/cleanup_inline.rb +17 -0
  10. data/lib/metanorma/standoc/cleanup_maths.rb +5 -4
  11. data/lib/metanorma/standoc/cleanup_reqt.rb +1 -1
  12. data/lib/metanorma/standoc/cleanup_section.rb +15 -13
  13. data/lib/metanorma/standoc/cleanup_terms.rb +3 -1
  14. data/lib/metanorma/standoc/cleanup_text.rb +9 -4
  15. data/lib/metanorma/standoc/converter.rb +2 -0
  16. data/lib/metanorma/standoc/inline.rb +2 -1
  17. data/lib/metanorma/standoc/isodoc.rng +65 -0
  18. data/lib/metanorma/standoc/lists.rb +8 -3
  19. data/lib/metanorma/standoc/macros.rb +31 -4
  20. data/lib/metanorma/standoc/macros_form.rb +1 -1
  21. data/lib/metanorma/standoc/macros_note.rb +1 -6
  22. data/lib/metanorma/standoc/reqt.rb +5 -3
  23. data/lib/metanorma/standoc/version.rb +1 -1
  24. data/metanorma-standoc.gemspec +2 -2
  25. data/spec/metanorma/base_spec.rb +41 -5
  26. data/spec/metanorma/blocks_spec.rb +78 -3
  27. data/spec/metanorma/cleanup_blocks_spec.rb +9 -0
  28. data/spec/metanorma/cleanup_sections_spec.rb +5 -5
  29. data/spec/metanorma/cleanup_spec.rb +5 -5
  30. data/spec/metanorma/cleanup_terms_spec.rb +1 -1
  31. data/spec/metanorma/inline_spec.rb +3 -3
  32. data/spec/metanorma/lists_spec.rb +10 -4
  33. data/spec/metanorma/macros_spec.rb +21 -12
  34. data/spec/metanorma/refs_dl_spec.rb +17 -5
  35. data/spec/metanorma/refs_spec.rb +1 -7
  36. data/spec/metanorma/table_spec.rb +24 -6
  37. data/spec/spec_helper.rb +1 -1
  38. data/spec/vcr_cassettes/bsi16341.yml +496 -0
  39. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -49
  40. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  41. data/spec/vcr_cassettes/hide_refs.yml +168 -168
  42. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  43. data/spec/vcr_cassettes/isobib_get_123_1.yml +96 -96
  44. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +110 -110
  45. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  46. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  47. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -22
  48. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  49. data/spec/vcr_cassettes/std-link.yml +207 -0
  50. metadata +11 -10
  51. data/docs/quickstart.adoc +0 -375
@@ -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>
@@ -2,8 +2,8 @@ require "spec_helper"
2
2
  require "relaton_iso"
3
3
 
4
4
  RSpec.describe Metanorma::Standoc do
5
- it "processes simple dl reference" do
6
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ it "processes simple dl reference" do
6
+ input = <<~INPUT
7
7
  #{ASCIIDOC_BLANK_HDR}
8
8
  [bibliography]
9
9
  == Normative References
@@ -36,6 +36,7 @@ RSpec.describe Metanorma::Standoc do
36
36
  completename::::: Jack
37
37
 
38
38
  INPUT
39
+ output = <<~OUTPUT
39
40
  #{BLANK_HDR}
40
41
  <sections>
41
42
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -69,10 +70,12 @@ RSpec.describe Metanorma::Standoc do
69
70
  </bibliography>
70
71
  </standard-document>
71
72
  OUTPUT
73
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
74
+ .to be_equivalent_to xmlpp(output)
72
75
  end
73
76
 
74
77
  it "processes complex dl reference" do
75
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
78
+ input = <<~INPUT
76
79
  #{ASCIIDOC_BLANK_HDR}
77
80
 
78
81
  == Clause
@@ -292,6 +295,7 @@ RSpec.describe Metanorma::Standoc do
292
295
  script::: Latn
293
296
 
294
297
  INPUT
298
+ output = <<~OUTPUT
295
299
  #{BLANK_HDR}
296
300
  <sections>
297
301
  <clause id='_' inline-header='false' obligation='normative'>
@@ -455,10 +459,12 @@ RSpec.describe Metanorma::Standoc do
455
459
  </bibitem></references></bibliography>
456
460
  </standard-document>
457
461
  OUTPUT
462
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
463
+ .to be_equivalent_to xmlpp(output)
458
464
  end
459
465
 
460
466
  it "processes complex dl reference with dot path keys" do
461
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
467
+ input = <<~INPUT
462
468
  #{ASCIIDOC_BLANK_HDR}
463
469
  [bibliography]
464
470
  == Normative References
@@ -621,6 +627,7 @@ RSpec.describe Metanorma::Standoc do
621
627
  series.formattedref.script:: Latn
622
628
 
623
629
  INPUT
630
+ output = <<~OUTPUT
624
631
  #{BLANK_HDR}
625
632
  <sections>
626
633
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -775,10 +782,12 @@ RSpec.describe Metanorma::Standoc do
775
782
  </bibitem></references></bibliography>
776
783
  </standard-document>
777
784
  OUTPUT
785
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
786
+ .to be_equivalent_to xmlpp(output)
778
787
  end
779
788
 
780
789
  it "processes mix of dl and default references" do
781
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
790
+ input = <<~INPUT
782
791
  #{ASCIIDOC_BLANK_HDR}
783
792
 
784
793
  == Section
@@ -818,6 +827,7 @@ RSpec.describe Metanorma::Standoc do
818
827
  completename::::: Jack
819
828
 
820
829
  INPUT
830
+ output = <<~OUTPUT
821
831
  #{BLANK_HDR}
822
832
  <sections>
823
833
  <clause id='_' inline-header='false' obligation='normative'>
@@ -864,5 +874,7 @@ RSpec.describe Metanorma::Standoc do
864
874
  </sections>
865
875
  </standard-document>
866
876
  OUTPUT
877
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
878
+ .to be_equivalent_to xmlpp(output)
867
879
  end
868
880
  end
@@ -1665,9 +1665,6 @@ RSpec.describe Metanorma::Standoc do
1665
1665
  <bibitem id='iso123' type='standard'>
1666
1666
  <fetched/>
1667
1667
  <title format='text/plain' language='en' script='Latn'>Network Configuration Access Control Model</title>
1668
- <uri type='xml'>
1669
- https://raw.githubusercontent.com/relaton/relaton-data-ietf/master/data/reference.RFC.8341.xml
1670
- </uri>
1671
1668
  <uri type='src'>https://www.rfc-editor.org/info/rfc8341</uri>
1672
1669
  <docidentifier type='RFC' primary="true">RFC 8341</docidentifier>
1673
1670
  <docidentifier type='RFC' scope='anchor'>RFC8341</docidentifier>
@@ -1725,9 +1722,6 @@ RSpec.describe Metanorma::Standoc do
1725
1722
  <bibitem id='iso124' type='standard'>
1726
1723
  <fetched/>
1727
1724
  <title format='text/plain' language='en' script='Latn'>Network Configuration Access Control Model</title>
1728
- <uri type='xml'>
1729
- https://raw.githubusercontent.com/relaton/relaton-data-ietf/master/data/reference.RFC.8341.xml
1730
- </uri>
1731
1725
  <uri type='src'>https://www.rfc-editor.org/info/rfc8341</uri>
1732
1726
  <docidentifier type='RFC' primary="true">RFC 8341</docidentifier>
1733
1727
  <docidentifier type='metanorma'>[1]</docidentifier>
@@ -1912,7 +1906,7 @@ RSpec.describe Metanorma::Standoc do
1912
1906
  <from>#{Date.today.year}</from>
1913
1907
  </copyright>
1914
1908
  <ext>
1915
- <doctype>article</doctype>
1909
+ <doctype>standard</doctype>
1916
1910
  </ext>
1917
1911
  </bibdata>
1918
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