metanorma-standoc 2.1.1 → 2.1.4

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 +134 -39
  4. data/lib/metanorma/standoc/blocks.rb +8 -6
  5. data/lib/metanorma/standoc/blocks_notes.rb +4 -1
  6. data/lib/metanorma/standoc/cleanup.rb +1 -0
  7. data/lib/metanorma/standoc/cleanup_footnotes.rb +32 -25
  8. data/lib/metanorma/standoc/cleanup_inline.rb +17 -0
  9. data/lib/metanorma/standoc/cleanup_ref.rb +16 -0
  10. data/lib/metanorma/standoc/cleanup_section.rb +6 -0
  11. data/lib/metanorma/standoc/cleanup_terms.rb +3 -1
  12. data/lib/metanorma/standoc/cleanup_text.rb +9 -4
  13. data/lib/metanorma/standoc/cleanup_xref.rb +2 -1
  14. data/lib/metanorma/standoc/converter.rb +4 -0
  15. data/lib/metanorma/standoc/isodoc.rng +32 -0
  16. data/lib/metanorma/standoc/lists.rb +8 -3
  17. data/lib/metanorma/standoc/macros.rb +28 -1
  18. data/lib/metanorma/standoc/macros_note.rb +27 -6
  19. data/lib/metanorma/standoc/ref.rb +3 -1
  20. data/lib/metanorma/standoc/ref_sect.rb +5 -2
  21. data/lib/metanorma/standoc/ref_utility.rb +20 -5
  22. data/lib/metanorma/standoc/section.rb +1 -1
  23. data/lib/metanorma/standoc/version.rb +1 -1
  24. data/metanorma-standoc.gemspec +2 -2
  25. data/spec/examples/datamodel/address_class_profile.presentation.xml +14 -0
  26. data/spec/metanorma/base_spec.rb +41 -5
  27. data/spec/metanorma/blocks_spec.rb +58 -1
  28. data/spec/metanorma/cleanup_sections_spec.rb +60 -9
  29. data/spec/metanorma/cleanup_spec.rb +6 -6
  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 +50 -15
  34. data/spec/metanorma/refs_dl_spec.rb +18 -7
  35. data/spec/metanorma/refs_spec.rb +390 -450
  36. data/spec/metanorma/table_spec.rb +24 -6
  37. data/spec/spec_helper.rb +2 -2
  38. data/spec/vcr_cassettes/bsi16341.yml +57 -71
  39. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +67 -67
  40. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +14 -14
  41. data/spec/vcr_cassettes/hide_refs.yml +62 -62
  42. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  43. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  44. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +37 -37
  45. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
  46. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  47. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +228 -52
  48. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +47 -49
  49. data/spec/vcr_cassettes/std-link.yml +15 -15
  50. metadata +10 -10
  51. data/docs/quickstart.adoc +0 -375
@@ -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>
@@ -1299,7 +1299,7 @@ RSpec.describe Metanorma::Standoc do
1299
1299
  <sourcecode id='L__xf6_we'>
1300
1300
  <name>
1301
1301
  See
1302
- <eref type='inline' bibitemid='L__xf6_wner2016' citeas='L&amp;#xf6;wner et al. 2016'/>
1302
+ <eref type='inline' bibitemid='L__xf6_wner2016' citeas='Löwner et al. 2016'/>
1303
1303
  </name>
1304
1304
  ABC
1305
1305
  </sourcecode>
@@ -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>
@@ -165,6 +167,38 @@ RSpec.describe Metanorma::Standoc do
165
167
  .to be_equivalent_to xmlpp(output)
166
168
  end
167
169
 
170
+ it "processes the macro for editorial notes" do
171
+ input = <<~INPUT
172
+ #{ASCIIDOC_BLANK_HDR}
173
+ EDITOR: Note1
174
+
175
+ [EDITOR]
176
+ ====
177
+ Note2
178
+ ====
179
+
180
+ [EDITOR]
181
+ Note3
182
+ INPUT
183
+ output = <<~OUTPUT
184
+ #{BLANK_HDR}
185
+ <sections>
186
+ <admonition id='_' type='editorial'>
187
+ <p id='_'>Note1</p>
188
+ </admonition>
189
+ <admonition id='_' type='editorial'>
190
+ <p id='_'>Note2</p>
191
+ </admonition>
192
+ <admonition id='_' type='editorial'>
193
+ <p id='_'>Note3</p>
194
+ </admonition>
195
+ </sections>
196
+ </standard-document>
197
+ OUTPUT
198
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
199
+ .to be_equivalent_to xmlpp(output)
200
+ end
201
+
168
202
  it "processes the Metanorma::Standoc concept and related macros" do
169
203
  input = <<~INPUT
170
204
  #{ASCIIDOC_BLANK_HDR}
@@ -818,7 +852,7 @@ RSpec.describe Metanorma::Standoc do
818
852
  output = <<~OUTPUT
819
853
  #{BLANK_HDR}
820
854
  <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
821
- <p id="_"/>
855
+ <p id="_">Note1</p>
822
856
  </review>
823
857
  <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
824
858
  <p id="_">Note2</p>
@@ -1326,7 +1360,7 @@ RSpec.describe Metanorma::Standoc do
1326
1360
  <from>2022</from>
1327
1361
  </copyright>
1328
1362
  <ext>
1329
- <doctype>article</doctype>
1363
+ <doctype>standard</doctype>
1330
1364
  </ext>
1331
1365
  <relation type='derivedFrom'>
1332
1366
  <bibitem>
@@ -1340,7 +1374,7 @@ RSpec.describe Metanorma::Standoc do
1340
1374
  <from>2022</from>
1341
1375
  </copyright>
1342
1376
  <ext>
1343
- <doctype>article</doctype>
1377
+ <doctype>standard</doctype>
1344
1378
  </ext>
1345
1379
  </bibitem>
1346
1380
  </relation>
@@ -1384,7 +1418,7 @@ RSpec.describe Metanorma::Standoc do
1384
1418
  <from>2022</from>
1385
1419
  </copyright>
1386
1420
  <ext>
1387
- <doctype>article</doctype>
1421
+ <doctype>standard</doctype>
1388
1422
  </ext>
1389
1423
  <relation type='derivedFrom'>
1390
1424
  <bibitem>
@@ -1398,7 +1432,7 @@ RSpec.describe Metanorma::Standoc do
1398
1432
  <from>2022</from>
1399
1433
  </copyright>
1400
1434
  <ext>
1401
- <doctype>article</doctype>
1435
+ <doctype>standard</doctype>
1402
1436
  </ext>
1403
1437
  </bibitem>
1404
1438
  </relation>
@@ -1436,7 +1470,7 @@ RSpec.describe Metanorma::Standoc do
1436
1470
  <from>2022</from>
1437
1471
  </copyright>
1438
1472
  <ext>
1439
- <doctype>article</doctype>
1473
+ <doctype>standard</doctype>
1440
1474
  </ext>
1441
1475
  <relation type='derivedFrom'>
1442
1476
  <bibitem>
@@ -1450,7 +1484,7 @@ RSpec.describe Metanorma::Standoc do
1450
1484
  <from>2022</from>
1451
1485
  </copyright>
1452
1486
  <ext>
1453
- <doctype>article</doctype>
1487
+ <doctype>standard</doctype>
1454
1488
  </ext>
1455
1489
  <relation type='derivedFrom'>
1456
1490
  <bibitem>
@@ -1464,7 +1498,7 @@ RSpec.describe Metanorma::Standoc do
1464
1498
  <from>2022</from>
1465
1499
  </copyright>
1466
1500
  <ext>
1467
- <doctype>article</doctype>
1501
+ <doctype>standard</doctype>
1468
1502
  </ext>
1469
1503
  <relation type='derivedFrom'>
1470
1504
  <bibitem>
@@ -1478,7 +1512,7 @@ RSpec.describe Metanorma::Standoc do
1478
1512
  <from>2022</from>
1479
1513
  </copyright>
1480
1514
  <ext>
1481
- <doctype>article</doctype>
1515
+ <doctype>standard</doctype>
1482
1516
  </ext>
1483
1517
  </bibitem>
1484
1518
  </relation>
@@ -1494,7 +1528,7 @@ RSpec.describe Metanorma::Standoc do
1494
1528
  <from>2022</from>
1495
1529
  </copyright>
1496
1530
  <ext>
1497
- <doctype>article</doctype>
1531
+ <doctype>standard</doctype>
1498
1532
  </ext>
1499
1533
  </bibitem>
1500
1534
  </relation>
@@ -1557,7 +1591,7 @@ RSpec.describe Metanorma::Standoc do
1557
1591
  <from>2022</from>
1558
1592
  </copyright>
1559
1593
  <ext>
1560
- <doctype>article</doctype>
1594
+ <doctype>standard</doctype>
1561
1595
  </ext>
1562
1596
  <relation type='derivedFrom'>
1563
1597
  <bibitem>
@@ -1607,12 +1641,13 @@ RSpec.describe Metanorma::Standoc do
1607
1641
  </owner>
1608
1642
  </copyright>
1609
1643
  <ext>
1610
- <doctype>article</doctype>
1644
+ <doctype>standard</doctype>
1611
1645
  <editorialgroup>
1612
- <technical-committee/>
1613
- <subcommittee/>
1614
- <workgroup/>
1646
+ <agency>ISO</agency>
1615
1647
  </editorialgroup>
1648
+ <approvalgroup>
1649
+ <agency>ISO</agency>
1650
+ </approvalgroup>
1616
1651
  <stagename>International standard</stagename>
1617
1652
  </ext>
1618
1653
  </bibitem>
@@ -43,7 +43,6 @@ RSpec.describe Metanorma::Standoc do
43
43
  <title>Normative references</title>
44
44
  #{NORM_REF_BOILERPLATE}
45
45
  <bibitem id="iso123" type="standard">
46
- <fetched/>
47
46
  <title type='title-main' format='text/plain'>Standard</title>
48
47
  <title type='main' format='text/plain'>Standard</title>
49
48
  <docidentifier type="ISO">ISO 123</docidentifier>
@@ -102,6 +101,7 @@ RSpec.describe Metanorma::Standoc do
102
101
  docid::
103
102
  type::: ISO
104
103
  id::: TC211
104
+ primary::: true
105
105
  docnumber:: 211
106
106
  edition:: 1
107
107
  language::
@@ -256,6 +256,7 @@ RSpec.describe Metanorma::Standoc do
256
256
  ==== Relation
257
257
  type:: updates
258
258
  bibitem::
259
+ title::: Geographic information
259
260
  formattedref::: ISO 19115:2003
260
261
  bib_locality:::
261
262
  type:::: page
@@ -267,6 +268,7 @@ RSpec.describe Metanorma::Standoc do
267
268
  bibitem::
268
269
  type::: standard
269
270
  formattedref::: ISO 19115:2003/Cor 1:2006
271
+ title::: Geographic information
270
272
 
271
273
  ==== Series
272
274
  type:: main
@@ -289,6 +291,7 @@ RSpec.describe Metanorma::Standoc do
289
291
 
290
292
  ==== Series
291
293
  type:: alt
294
+ title:: seriestitle
292
295
  formattedref::
293
296
  content::: serieref
294
297
  language::: en
@@ -317,7 +320,7 @@ RSpec.describe Metanorma::Standoc do
317
320
  <uri type="src">https://www.iso.org/standard/53798.html</uri>
318
321
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
319
322
  <uri type="rss">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
320
- <docidentifier type="ISO">TC211</docidentifier>
323
+ <docidentifier type='ISO' primary='true'>TC211</docidentifier>
321
324
  <docnumber>211</docnumber>
322
325
  <date type="issued">
323
326
  <on>2014</on>
@@ -417,12 +420,14 @@ RSpec.describe Metanorma::Standoc do
417
420
  </copyright>
418
421
  <relation type="updates">
419
422
  <bibitem>
420
- <formattedref format="text/plain">ISO 19115:2003</formattedref>
423
+ <title type='title-main' format='text/plain'>Geographic information</title>
424
+ <title type='main' format='text/plain'>Geographic information</title>
421
425
  </bibitem>
422
426
  </relation>
423
427
  <relation type="updates">
424
428
  <bibitem type="standard">
425
- <formattedref format="text/plain">ISO 19115:2003/Cor 1:2006</formattedref>
429
+ <title type='title-main' format='text/plain'>Geographic information</title>
430
+ <title type='main' format='text/plain'>Geographic information</title>
426
431
  </bibitem>
427
432
  </relation>
428
433
  <series type="main">
@@ -437,6 +442,7 @@ RSpec.describe Metanorma::Standoc do
437
442
  </series>
438
443
  <series type="alt">
439
444
  <formattedref format="text/plain" language="en" script="Latn">serieref</formattedref>
445
+ <title format='text/plain'>seriestitle</title>
440
446
  </series>
441
447
  <medium>
442
448
  <form>medium form</form>
@@ -596,6 +602,7 @@ RSpec.describe Metanorma::Standoc do
596
602
  contributor.role:: author
597
603
  relation::
598
604
  relation.type:: updates
605
+ relation.bibitem.title:: Geographic information
599
606
  relation.bibitem.formattedref:: ISO 19115:2003
600
607
  relation.bibitem.bib_locality.type:: page
601
608
  relation.bibitem.bib_locality.reference_from:: 7
@@ -603,6 +610,7 @@ RSpec.describe Metanorma::Standoc do
603
610
  relation::
604
611
  relation.type:: updates
605
612
  relation.bibitem.type:: standard
613
+ relation.bibitem.title:: Geographic information
606
614
  relation.bibitem.formattedref:: ISO 19115:2003/Cor 1:2006
607
615
  series::
608
616
  series.type:: main
@@ -622,6 +630,7 @@ RSpec.describe Metanorma::Standoc do
622
630
  series.partnumber:: part5678
623
631
  series::
624
632
  series.type:: alt
633
+ series.title:: seriestitle
625
634
  series.formattedref.content:: serieref
626
635
  series.formattedref.language:: en
627
636
  series.formattedref.script:: Latn
@@ -740,12 +749,14 @@ RSpec.describe Metanorma::Standoc do
740
749
  </copyright>
741
750
  <relation type="updates">
742
751
  <bibitem>
743
- <formattedref format="text/plain">ISO 19115:2003</formattedref>
752
+ <title type='title-main' format='text/plain'>Geographic information</title>
753
+ <title type='main' format='text/plain'>Geographic information</title>
744
754
  </bibitem>
745
755
  </relation>
746
756
  <relation type="updates">
747
757
  <bibitem type="standard">
748
- <formattedref format="text/plain">ISO 19115:2003/Cor 1:2006</formattedref>
758
+ <title type='title-main' format='text/plain'>Geographic information</title>
759
+ <title type='main' format='text/plain'>Geographic information</title>
749
760
  </bibitem>
750
761
  </relation>
751
762
  <series type="main">
@@ -760,6 +771,7 @@ RSpec.describe Metanorma::Standoc do
760
771
  </series>
761
772
  <series type="alt">
762
773
  <formattedref format="text/plain" language="en" script="Latn">serieref</formattedref>
774
+ <title format='text/plain'>seriestitle</title>
763
775
  </series>
764
776
  <medium>
765
777
  <form>medium form</form>
@@ -842,7 +854,6 @@ RSpec.describe Metanorma::Standoc do
842
854
  <docidentifier>B</docidentifier>
843
855
  </bibitem>
844
856
  <bibitem id='iso123' type='standard'>
845
- <fetched/>
846
857
  <title type='title-main' format='text/plain'>Standard</title>
847
858
  <title type='main' format='text/plain'>Standard</title>
848
859
  <docidentifier type='ISO'>ISO 123</docidentifier>