metanorma-iso 1.5.13 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +17 -0
  3. data/lib/asciidoctor/iso/base.rb +1 -6
  4. data/lib/asciidoctor/iso/basicdoc.rng +52 -3
  5. data/lib/asciidoctor/iso/cleanup.rb +0 -6
  6. data/lib/asciidoctor/iso/front.rb +5 -5
  7. data/lib/asciidoctor/iso/isodoc.rng +114 -3
  8. data/lib/asciidoctor/iso/isostandard-amd.rng +8 -4
  9. data/lib/asciidoctor/iso/isostandard.rng +19 -10
  10. data/lib/asciidoctor/iso/validate.rb +78 -0
  11. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  12. data/lib/isodoc/iso/html/header.html +12 -12
  13. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  14. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  15. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  17. data/lib/isodoc/iso/html_convert.rb +2 -2
  18. data/lib/isodoc/iso/i18n-en.yaml +2 -0
  19. data/lib/isodoc/iso/i18n-fr.yaml +1 -1
  20. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
  21. data/lib/isodoc/iso/iso.amendment.xsl +486 -206
  22. data/lib/isodoc/iso/iso.international-standard.xsl +486 -206
  23. data/lib/isodoc/iso/sections.rb +1 -1
  24. data/lib/isodoc/iso/word_convert.rb +2 -2
  25. data/lib/isodoc/iso/xref.rb +28 -12
  26. data/lib/metanorma/iso/processor.rb +11 -0
  27. data/lib/metanorma/iso/version.rb +1 -1
  28. data/metanorma-iso.gemspec +2 -2
  29. data/spec/asciidoctor-iso/amd_spec.rb +14 -14
  30. data/spec/asciidoctor-iso/base_spec.rb +20 -20
  31. data/spec/asciidoctor-iso/blocks_spec.rb +21 -21
  32. data/spec/asciidoctor-iso/cleanup_spec.rb +32 -26
  33. data/spec/asciidoctor-iso/inline_spec.rb +7 -7
  34. data/spec/asciidoctor-iso/lists_spec.rb +3 -3
  35. data/spec/asciidoctor-iso/refs_spec.rb +4 -4
  36. data/spec/asciidoctor-iso/section_spec.rb +7 -7
  37. data/spec/asciidoctor-iso/table_spec.rb +4 -4
  38. data/spec/asciidoctor-iso/validate_spec.rb +457 -87
  39. data/spec/isodoc/amd_spec.rb +13 -13
  40. data/spec/isodoc/iso_spec.rb +2 -2
  41. data/spec/isodoc/postproc_spec.rb +1 -0
  42. data/spec/spec_helper.rb +12 -0
  43. metadata +7 -11
  44. data/lib/asciidoctor/iso/macros.rb +0 -21
  45. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
  46. data/lib/metanorma/iso/fonts_manifest.yaml +0 -6
  47. data/spec/asciidoctor-iso/macros_spec.rb +0 -310
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48a523e339d4400dcd168324b8e2452b9fd5e4a0708daa93d45afc96aa2a9ee6
4
- data.tar.gz: 5c39c558619bf58156b604017519b074416e185dbb6554ec78b3490cca6e5db6
3
+ metadata.gz: 9af9da09f9e17f25423843c284ed66d9f2206535631b334263bea9f80211acf6
4
+ data.tar.gz: 9987c2fcb45025dee73bc95fd21939104495dbf3e07e79afac877b7b9fcf81f4
5
5
  SHA512:
6
- metadata.gz: fbf69dcccc16ca0188cef8d64054a577ebf80e5a058581839c9985212db4c363418a3775a0c74dfd718ea1a2c318d59ee10d9f1fe4124ebf74a2ead892deabbc
7
- data.tar.gz: adcf3750158172d4cce858a5a128990d10eee1b297ecdb0530f2ba9110694010061b0e570187f51bffdb11576768a71db7307f7cd53f331a9feb4739606f5556
6
+ metadata.gz: f947d939ce553a170f712c09c903bf5d8c1192c7de45063d9407b4a7c300d31ee325cb269db9046d917a0184a18c78f654377922e23b2eca33add015139e5af9
7
+ data.tar.gz: c5d5d07e2c558293c926c3f4a4be46ff96659670082f2c09951f58dada582f6d93a3d8ccaeba15016bc0548dceda5c5f32d664a8cb05110d69e25179c67f1c4d
@@ -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 }}
@@ -5,7 +5,6 @@ require "pathname"
5
5
  require "open-uri"
6
6
  require "isodoc"
7
7
  require "fileutils"
8
- require 'asciidoctor/iso/macros'
9
8
 
10
9
  module Asciidoctor
11
10
  module ISO
@@ -13,10 +12,6 @@ module Asciidoctor
13
12
  XML_ROOT_TAG = "iso-standard".freeze
14
13
  XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
15
14
 
16
- Asciidoctor::Extensions.register do
17
- inline_macro Asciidoctor::Iso::TermRefInlineMacro
18
- end
19
-
20
15
  def html_converter(node)
21
16
  IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node))
22
17
  end
@@ -51,7 +46,7 @@ module Asciidoctor
51
46
 
52
47
  def ol_attrs(node)
53
48
  attr_code(keep_attrs(node).
54
- merge(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node)))
49
+ merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
55
50
  end
56
51
 
57
52
  def outputs(node, ret)
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <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>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -4,7 +4,6 @@ require "htmlentities"
4
4
  require "json"
5
5
  require "pathname"
6
6
  require "open-uri"
7
- require "asciidoctor/iso/term_lookup_cleanup"
8
7
 
9
8
  module Asciidoctor
10
9
  module ISO
@@ -89,11 +88,6 @@ module Asciidoctor
89
88
  end
90
89
  end
91
90
 
92
- def termdef_cleanup(xmldoc)
93
- Asciidoctor::ISO::TermLookupCleanup.new(xmldoc, @log).call
94
- super
95
- end
96
-
97
91
  # TODO sort by authors
98
92
  # sort by: doc class (ISO, IEC, other standard (not DOI &c), other
99
93
  # then standard class (docid class other than DOI &c)
@@ -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,12 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
249
262
  <optional>
250
263
  <ref name="tname"/>
251
264
  </optional>
@@ -764,6 +777,21 @@
764
777
  </define>
765
778
  </include>
766
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
767
795
  <define name="TextElement" combine="choice">
768
796
  <ref name="concept"/>
769
797
  </define>
@@ -784,6 +812,8 @@
784
812
  <ref name="requirement"/>
785
813
  <ref name="recommendation"/>
786
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
787
817
  </choice>
788
818
  </define>
789
819
  <define name="bibliography">
@@ -814,6 +844,9 @@
814
844
  <data type="boolean"/>
815
845
  </attribute>
816
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
817
850
  <optional>
818
851
  <attribute name="obligation">
819
852
  <choice>
@@ -869,9 +902,11 @@
869
902
  <element name="code">
870
903
  <text/>
871
904
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
875
910
  </element>
876
911
  </define>
877
912
  <define name="standard-document">
@@ -1041,6 +1076,9 @@
1041
1076
  </choice>
1042
1077
  </attribute>
1043
1078
  </optional>
1079
+ <optional>
1080
+ <attribute name="number"/>
1081
+ </optional>
1044
1082
  <optional>
1045
1083
  <attribute name="type"/>
1046
1084
  </optional>
@@ -1094,6 +1132,9 @@
1094
1132
  <optional>
1095
1133
  <attribute name="type"/>
1096
1134
  </optional>
1135
+ <optional>
1136
+ <attribute name="number"/>
1137
+ </optional>
1097
1138
  <optional>
1098
1139
  <ref name="section-title"/>
1099
1140
  </optional>
@@ -1196,6 +1237,9 @@
1196
1237
  <optional>
1197
1238
  <attribute name="type"/>
1198
1239
  </optional>
1240
+ <optional>
1241
+ <attribute name="number"/>
1242
+ </optional>
1199
1243
  <optional>
1200
1244
  <attribute name="obligation">
1201
1245
  <choice>
@@ -1524,6 +1568,7 @@
1524
1568
  <value>add</value>
1525
1569
  <value>modify</value>
1526
1570
  <value>delete</value>
1571
+ <value>replace</value>
1527
1572
  </choice>
1528
1573
  </attribute>
1529
1574
  <optional>
@@ -1554,6 +1599,11 @@
1554
1599
  </optional>
1555
1600
  <optional>
1556
1601
  <element name="newcontent">
1602
+ <optional>
1603
+ <attribute name="id">
1604
+ <data type="ID"/>
1605
+ </attribute>
1606
+ </optional>
1557
1607
  <zeroOrMore>
1558
1608
  <ref name="BasicBlock"/>
1559
1609
  </zeroOrMore>
@@ -1587,4 +1637,65 @@
1587
1637
  <text/>
1588
1638
  </element>
1589
1639
  </define>
1640
+ <define name="imagemap">
1641
+ <element name="imagemap">
1642
+ <ref name="figure"/>
1643
+ <zeroOrMore>
1644
+ <element name="area">
1645
+ <attribute name="type">
1646
+ <choice>
1647
+ <value>rect</value>
1648
+ <value>circle</value>
1649
+ <value>ellipse</value>
1650
+ <value>poly</value>
1651
+ </choice>
1652
+ </attribute>
1653
+ <choice>
1654
+ <ref name="xref"/>
1655
+ <ref name="hyperlink"/>
1656
+ <ref name="eref"/>
1657
+ </choice>
1658
+ <oneOrMore>
1659
+ <element name="coords">
1660
+ <attribute name="x">
1661
+ <data type="float"/>
1662
+ </attribute>
1663
+ <attribute name="y">
1664
+ <data type="float"/>
1665
+ </attribute>
1666
+ </element>
1667
+ </oneOrMore>
1668
+ <optional>
1669
+ <element name="radius">
1670
+ <attribute name="x">
1671
+ <data type="float"/>
1672
+ </attribute>
1673
+ <optional>
1674
+ <attribute name="y">
1675
+ <data type="float"/>
1676
+ </attribute>
1677
+ </optional>
1678
+ </element>
1679
+ </optional>
1680
+ </element>
1681
+ </zeroOrMore>
1682
+ </element>
1683
+ </define>
1684
+ <define name="svgmap">
1685
+ <element name="svgmap">
1686
+ <ref name="figure"/>
1687
+ <zeroOrMore>
1688
+ <element name="target">
1689
+ <attribute name="href">
1690
+ <data type="anyURI"/>
1691
+ </attribute>
1692
+ <choice>
1693
+ <ref name="xref"/>
1694
+ <ref name="hyperlink"/>
1695
+ <ref name="eref"/>
1696
+ </choice>
1697
+ </element>
1698
+ </zeroOrMore>
1699
+ </element>
1700
+ </define>
1590
1701
  </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,6 +31,13 @@
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"/>
38
42
  <optional>
39
43
  <ref name="boilerplate"/>
@@ -68,7 +72,7 @@
68
72
  </optional>
69
73
  <optional>
70
74
  <attribute name="origyr">
71
- <data type="int"/>
75
+ <ref name="ISO8601Date"/>
72
76
  </attribute>
73
77
  </optional>
74
78
  <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">
@@ -382,6 +388,9 @@
382
388
  <data type="anyURI"/>
383
389
  </attribute>
384
390
  </optional>
391
+ <optional>
392
+ <ref name="colgroup"/>
393
+ </optional>
385
394
  <optional>
386
395
  <ref name="tname"/>
387
396
  </optional>