metanorma-iso 1.5.14 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +17 -0
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +20 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +118 -4
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +22 -10
  11. data/lib/asciidoctor/iso/validate.rb +78 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/html/header.html +12 -12
  14. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  15. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  16. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  18. data/lib/isodoc/iso/html_convert.rb +2 -2
  19. data/lib/isodoc/iso/i18n-en.yaml +2 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +1 -1
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
  22. data/lib/isodoc/iso/iso.amendment.xsl +451 -208
  23. data/lib/isodoc/iso/iso.international-standard.xsl +451 -208
  24. data/lib/isodoc/iso/sections.rb +1 -1
  25. data/lib/isodoc/iso/word_convert.rb +2 -2
  26. data/lib/isodoc/iso/xref.rb +28 -12
  27. data/lib/metanorma/iso/processor.rb +11 -0
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +2 -2
  30. data/spec/asciidoctor-iso/amd_spec.rb +575 -573
  31. data/spec/asciidoctor-iso/base_spec.rb +449 -458
  32. data/spec/asciidoctor-iso/blocks_spec.rb +333 -288
  33. data/spec/asciidoctor-iso/cleanup_spec.rb +814 -699
  34. data/spec/asciidoctor-iso/inline_spec.rb +116 -91
  35. data/spec/asciidoctor-iso/lists_spec.rb +128 -121
  36. data/spec/asciidoctor-iso/refs_spec.rb +308 -250
  37. data/spec/asciidoctor-iso/section_spec.rb +273 -242
  38. data/spec/asciidoctor-iso/table_spec.rb +258 -242
  39. data/spec/asciidoctor-iso/validate_spec.rb +1223 -919
  40. data/spec/isodoc/amd_spec.rb +967 -946
  41. data/spec/isodoc/blocks_spec.rb +530 -507
  42. data/spec/isodoc/i18n_spec.rb +953 -911
  43. data/spec/isodoc/inline_spec.rb +355 -293
  44. data/spec/isodoc/iso_spec.rb +340 -316
  45. data/spec/isodoc/metadata_spec.rb +392 -382
  46. data/spec/isodoc/postproc_spec.rb +834 -656
  47. data/spec/isodoc/ref_spec.rb +374 -331
  48. data/spec/isodoc/section_spec.rb +608 -525
  49. data/spec/isodoc/table_spec.rb +472 -411
  50. data/spec/isodoc/terms_spec.rb +209 -185
  51. data/spec/isodoc/xref_spec.rb +1370 -1236
  52. data/spec/metanorma/processor_spec.rb +28 -26
  53. data/spec/spec_helper.rb +184 -189
  54. metadata +7 -10
  55. data/.rubocop.ribose.yml +0 -66
  56. data/lib/metanorma/iso/fonts_manifest.yaml +0 -6
  57. data/spec/assets/xref_error.adoc +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e01ee8230b538949046cc2891d993eb0c6f3c3b9d3276d7e16ad05617c075eb
4
- data.tar.gz: b1f87a4bc24143414ff469dc73541e4e581c04a803231a1ad10e60faf2a8d6aa
3
+ metadata.gz: 69530242f8dcfcd209289f65397818d2d73e69920a2588b1bfa4c30b712ada50
4
+ data.tar.gz: 72261437fe21d308b4c01e4ba3ce7f9fe15a5c3a35dce4828dc7b04e2c941df4
5
5
  SHA512:
6
- metadata.gz: 7e5582b6f64fd353fdcf5dd67fe897a91fb1d500b240cc4ddf7cfceba99435eb75935d4eceb70e5b6512ba3a0a3d68c373e2ecfc2f7a4ee718524449d7891870
7
- data.tar.gz: 386d6f98b45ff9b03dc56e06177a0fa3b7b750732093c3697c1c32935b1b6e7c931f769d6f3ce4073c562ada67e7fc24e4ae6187337182a9d3234a7d72b6c5fe
6
+ metadata.gz: 8a01d3c261513bddc48ce11f6b331ab025939d41e234a02e6e63cd39ef15c865af2a7f086768a38cbbecbec8aac76fabbb1ea5febcb3f4fb0852aab58ba7b794
7
+ data.tar.gz: d83d323c7e9ca83dc5afaead3e837da9bc952074a4f913f5eb28dce637d98ffce6f4e6206b96ff8ef3a05a585b8a75c2de215fae8a36dfae325c1b632a0cb68a
@@ -36,6 +36,9 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
39
42
  - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
@@ -64,3 +67,17 @@ jobs:
64
67
  run: cinst -y plantuml
65
68
 
66
69
  - run: bundle exec rake
70
+
71
+ tests-passed:
72
+ needs: rake
73
+ runs-on: ubuntu-latest
74
+ continue-on-error: true
75
+ steps:
76
+ - name: Trigger tests passed event
77
+ uses: Sibz/github-status-action@v1
78
+ with:
79
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
80
+ context: 'tests-passed-successfully'
81
+ description: 'Tests passed successfully'
82
+ state: 'success'
83
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.rubocop.yml CHANGED
@@ -4,7 +4,3 @@
4
4
 
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
- AllCops:
8
- TargetRubyVersion: 2.3
9
- Rails:
10
- Enabled: true
@@ -44,23 +44,23 @@ module Asciidoctor
44
44
  @amd = %w(amendment technical-corrigendum).include? doctype(node)
45
45
  end
46
46
 
47
- def ol_attrs(node)
47
+ def ol_attrs(node)
48
48
  attr_code(keep_attrs(node).
49
- merge(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node)))
49
+ merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
50
50
  end
51
51
 
52
52
  def outputs(node, ret)
53
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
- presentation_xml_converter(node).convert(@filename + ".xml")
55
- html_converter_alt(node).convert(@filename + ".presentation.xml",
56
- nil, false, "#{@filename}_alt.html")
57
- html_converter(node).convert(@filename + ".presentation.xml",
58
- nil, false, "#{@filename}.html")
59
- doc_converter(node).convert(@filename + ".presentation.xml",
60
- nil, false, "#{@filename}.doc")
61
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
62
- nil, false, "#{@filename}.pdf")
63
- #sts_converter(node)&.convert(@filename + ".xml")
53
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
+ presentation_xml_converter(node).convert(@filename + ".xml")
55
+ html_converter_alt(node).convert(@filename + ".presentation.xml",
56
+ nil, false, "#{@filename}_alt.html")
57
+ html_converter(node).convert(@filename + ".presentation.xml",
58
+ nil, false, "#{@filename}.html")
59
+ doc_converter(node).convert(@filename + ".presentation.xml",
60
+ nil, false, "#{@filename}.doc")
61
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
62
+ nil, false, "#{@filename}.pdf")
63
+ #sts_converter(node)&.convert(@filename + ".xml")
64
64
  end
65
65
  end
66
66
  end
@@ -729,12 +729,29 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="primary"/>
733
732
  <optional>
734
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
735
748
  </optional>
736
749
  <optional>
737
- <attribute name="tertiary"/>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
738
755
  </optional>
739
756
  </element>
740
757
  </define>
@@ -61,7 +61,7 @@ module Asciidoctor
61
61
  id.content = id_prefix(prefix, id)
62
62
  end
63
63
 
64
- def format_ref(ref, type, isopub)
64
+ def format_ref(ref, type)
65
65
  ref = ref.sub(/ \(All Parts\)/i, "")
66
66
  super
67
67
  end
@@ -85,27 +85,27 @@ module Asciidoctor
85
85
  def title_intro(node, t, lang, at)
86
86
  return unless node.attr("title-intro-#{lang}")
87
87
  t.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
88
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
88
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
89
89
  end
90
90
  end
91
91
 
92
92
  def title_main(node, t, lang, at)
93
93
  t.title **attr_code(at.merge(type: "title-main")) do |t1|
94
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
94
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
95
95
  end
96
96
  end
97
97
 
98
98
  def title_part(node, t, lang, at)
99
99
  return unless node.attr("title-part-#{lang}")
100
100
  t.title(**attr_code(at.merge(type: "title-part"))) do |t1|
101
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
101
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
102
102
  end
103
103
  end
104
104
 
105
105
  def title_amd(node, t, lang, at)
106
106
  return unless node.attr("title-amendment-#{lang}")
107
107
  t.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
108
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
108
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
109
109
  end
110
110
  end
111
111
 
@@ -118,7 +118,7 @@ module Asciidoctor
118
118
  title = "#{title} -- #{part}" if part
119
119
  title = "#{title} -- #{amd}" if amd && @amd
120
120
  t.title **attr_code(at.merge(type: "main")) do |t1|
121
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
121
+ t1 << Metanorma::Utils::asciidoc_sub(title)
122
122
  end
123
123
  end
124
124
 
@@ -55,6 +55,13 @@
55
55
  <param name="pattern">\i\c*|\c+#\c+</param>
56
56
  </data>
57
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
58
65
  <optional>
59
66
  <attribute name="type">
60
67
  <ref name="ReferenceFormat"/>
@@ -246,6 +253,9 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
249
259
  <optional>
250
260
  <ref name="colgroup"/>
251
261
  </optional>
@@ -779,6 +789,9 @@
779
789
  <attribute name="width"/>
780
790
  </element>
781
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
782
795
  <define name="TextElement" combine="choice">
783
796
  <ref name="concept"/>
784
797
  </define>
@@ -799,6 +812,8 @@
799
812
  <ref name="requirement"/>
800
813
  <ref name="recommendation"/>
801
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
802
817
  </choice>
803
818
  </define>
804
819
  <define name="bibliography">
@@ -829,6 +844,9 @@
829
844
  <data type="boolean"/>
830
845
  </attribute>
831
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
832
850
  <optional>
833
851
  <attribute name="obligation">
834
852
  <choice>
@@ -884,9 +902,11 @@
884
902
  <element name="code">
885
903
  <text/>
886
904
  </element>
887
- <element name="text">
888
- <text/>
889
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
890
910
  </element>
891
911
  </define>
892
912
  <define name="standard-document">
@@ -899,6 +919,9 @@
899
919
  </choice>
900
920
  </attribute>
901
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
902
925
  <optional>
903
926
  <ref name="boilerplate"/>
904
927
  </optional>
@@ -909,11 +932,21 @@
909
932
  <zeroOrMore>
910
933
  <ref name="annex"/>
911
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
912
938
  <zeroOrMore>
913
- <ref name="references"/>
939
+ <ref name="indexsect"/>
914
940
  </zeroOrMore>
915
941
  </element>
916
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
917
950
  <define name="preface">
918
951
  <element name="preface">
919
952
  <oneOrMore>
@@ -937,6 +970,11 @@
937
970
  <ref name="Content-Section"/>
938
971
  </element>
939
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
940
978
  <define name="boilerplate">
941
979
  <element name="boilerplate">
942
980
  <optional>
@@ -1056,6 +1094,9 @@
1056
1094
  </choice>
1057
1095
  </attribute>
1058
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1059
1100
  <optional>
1060
1101
  <attribute name="type"/>
1061
1102
  </optional>
@@ -1109,6 +1150,9 @@
1109
1150
  <optional>
1110
1151
  <attribute name="type"/>
1111
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1112
1156
  <optional>
1113
1157
  <ref name="section-title"/>
1114
1158
  </optional>
@@ -1211,6 +1255,9 @@
1211
1255
  <optional>
1212
1256
  <attribute name="type"/>
1213
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1214
1261
  <optional>
1215
1262
  <attribute name="obligation">
1216
1263
  <choice>
@@ -1539,6 +1586,7 @@
1539
1586
  <value>add</value>
1540
1587
  <value>modify</value>
1541
1588
  <value>delete</value>
1589
+ <value>replace</value>
1542
1590
  </choice>
1543
1591
  </attribute>
1544
1592
  <optional>
@@ -1569,6 +1617,11 @@
1569
1617
  </optional>
1570
1618
  <optional>
1571
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1572
1625
  <zeroOrMore>
1573
1626
  <ref name="BasicBlock"/>
1574
1627
  </zeroOrMore>
@@ -1602,4 +1655,65 @@
1602
1655
  <text/>
1603
1656
  </element>
1604
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1605
1719
  </grammar>
@@ -14,9 +14,6 @@
14
14
  </define>
15
15
  <define name="clause">
16
16
  <element name="clause">
17
- <optional>
18
- <attribute name="type"/>
19
- </optional>
20
17
  <optional>
21
18
  <attribute name="change">
22
19
  <choice>
@@ -34,7 +31,17 @@
34
31
  </define>
35
32
  <define name="iso-standard">
36
33
  <element name="iso-standard">
34
+ <attribute name="version"/>
35
+ <attribute name="type">
36
+ <choice>
37
+ <value>semantic</value>
38
+ <value>presentation</value>
39
+ </choice>
40
+ </attribute>
37
41
  <ref name="bibdata"/>
42
+ <optional>
43
+ <ref name="misccontainer"/>
44
+ </optional>
38
45
  <optional>
39
46
  <ref name="boilerplate"/>
40
47
  </optional>
@@ -68,7 +75,7 @@
68
75
  </optional>
69
76
  <optional>
70
77
  <attribute name="origyr">
71
- <data type="int"/>
78
+ <ref name="ISO8601Date"/>
72
79
  </attribute>
73
80
  </optional>
74
81
  <text/>
@@ -140,22 +140,28 @@
140
140
  </choice>
141
141
  </attribute>
142
142
  </optional>
143
+ <optional>
144
+ <attribute name="type"/>
145
+ </optional>
143
146
  <optional>
144
147
  <ref name="section-title"/>
145
148
  </optional>
146
- <choice>
147
- <group>
148
- <oneOrMore>
149
- <ref name="BasicBlock"/>
150
- </oneOrMore>
151
- <zeroOrMore>
152
- <ref name="note"/>
153
- </zeroOrMore>
154
- </group>
149
+ <group>
150
+ <choice>
151
+ <group>
152
+ <oneOrMore>
153
+ <ref name="BasicBlock"/>
154
+ </oneOrMore>
155
+ <zeroOrMore>
156
+ <ref name="note"/>
157
+ </zeroOrMore>
158
+ </group>
159
+ <ref name="amend"/>
160
+ </choice>
155
161
  <oneOrMore>
156
162
  <ref name="clause-subsection"/>
157
163
  </oneOrMore>
158
- </choice>
164
+ </group>
159
165
  </define>
160
166
  <define name="term">
161
167
  <element name="term">
@@ -422,6 +428,9 @@
422
428
  <zeroOrMore>
423
429
  <ref name="termdocsource"/>
424
430
  </zeroOrMore>
431
+ <optional>
432
+ <ref name="misccontainer"/>
433
+ </optional>
425
434
  <optional>
426
435
  <ref name="boilerplate"/>
427
436
  </optional>
@@ -433,6 +442,9 @@
433
442
  <ref name="annex"/>
434
443
  </zeroOrMore>
435
444
  <ref name="bibliography"/>
445
+ <zeroOrMore>
446
+ <ref name="indexsect"/>
447
+ </zeroOrMore>
436
448
  </element>
437
449
  </define>
438
450
  <define name="horizontal">