metanorma-iso 1.6.0 → 1.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9ff94c61e35de46dc7952d37bfff144de3138445e1deac3634627a2fa6f7a6a
4
- data.tar.gz: 053100705b2af0c4d3d26359948fa8ba23f811010b2096475664ee5b44c0d3dc
3
+ metadata.gz: 769601244fc001de9523edde3e6b139a897df0c82a255b786659a83a2e32d8a5
4
+ data.tar.gz: 1ea613b3740ec30cc508fa5817bed662f3fe539b7bf03e2cf7e40e4ab1e1c8c4
5
5
  SHA512:
6
- metadata.gz: a093a518a812e1fea3f5053f287b589010fc896954ff6da4a9674c72c4d0db566095ba0702ac85b6ba519f23e2d0a09d8697d984c998dbda6759698c6075726c
7
- data.tar.gz: 45b6dcdb5783272457a495e8c4f2ea2a3c4fab3114d48a8c7d6917782db82f3ee573af34c903fd07cda28447373721dd7cdb83c519bca9ae74208f4f9a77bd8c
6
+ metadata.gz: 870aaeca24c5e5878441a8346c2dc0d8d8cdd19604c50399c38b8af18bd29a90ab3c0dd8c8d080b977c35efc794bbfbffa4ca233113c3c3a103d90542981ba90
7
+ data.tar.gz: a6bb8b2d6f598ddf12b8982fa1203165d07f94df83a0f2f7d96eba635834b69e0420e7e46e5cfe86b5ba0283a553106a7941cd06be868032dec6e0179dc1fbb4
@@ -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 }}
@@ -253,6 +253,9 @@
253
253
  <data type="boolean"/>
254
254
  </attribute>
255
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
256
259
  <optional>
257
260
  <ref name="colgroup"/>
258
261
  </optional>
@@ -836,6 +839,9 @@
836
839
  <data type="boolean"/>
837
840
  </attribute>
838
841
  </optional>
842
+ <optional>
843
+ <attribute name="number"/>
844
+ </optional>
839
845
  <optional>
840
846
  <attribute name="obligation">
841
847
  <choice>
@@ -891,9 +897,11 @@
891
897
  <element name="code">
892
898
  <text/>
893
899
  </element>
894
- <element name="text">
895
- <text/>
896
- </element>
900
+ <optional>
901
+ <element name="text">
902
+ <text/>
903
+ </element>
904
+ </optional>
897
905
  </element>
898
906
  </define>
899
907
  <define name="standard-document">
@@ -1063,6 +1071,9 @@
1063
1071
  </choice>
1064
1072
  </attribute>
1065
1073
  </optional>
1074
+ <optional>
1075
+ <attribute name="number"/>
1076
+ </optional>
1066
1077
  <optional>
1067
1078
  <attribute name="type"/>
1068
1079
  </optional>
@@ -1116,6 +1127,9 @@
1116
1127
  <optional>
1117
1128
  <attribute name="type"/>
1118
1129
  </optional>
1130
+ <optional>
1131
+ <attribute name="number"/>
1132
+ </optional>
1119
1133
  <optional>
1120
1134
  <ref name="section-title"/>
1121
1135
  </optional>
@@ -1218,6 +1232,9 @@
1218
1232
  <optional>
1219
1233
  <attribute name="type"/>
1220
1234
  </optional>
1235
+ <optional>
1236
+ <attribute name="number"/>
1237
+ </optional>
1221
1238
  <optional>
1222
1239
  <attribute name="obligation">
1223
1240
  <choice>
@@ -1546,6 +1563,7 @@
1546
1563
  <value>add</value>
1547
1564
  <value>modify</value>
1548
1565
  <value>delete</value>
1566
+ <value>replace</value>
1549
1567
  </choice>
1550
1568
  </attribute>
1551
1569
  <optional>
@@ -1576,6 +1594,11 @@
1576
1594
  </optional>
1577
1595
  <optional>
1578
1596
  <element name="newcontent">
1597
+ <optional>
1598
+ <attribute name="id">
1599
+ <data type="ID"/>
1600
+ </attribute>
1601
+ </optional>
1579
1602
  <zeroOrMore>
1580
1603
  <ref name="BasicBlock"/>
1581
1604
  </zeroOrMore>
@@ -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">
@@ -146,6 +146,17 @@ module Asciidoctor
146
146
  "#{iteration} is not a recognised iteration")
147
147
  end
148
148
 
149
+ # DRG directives 3.7; but anticipated by standoc
150
+ def figure_validate(xmldoc)
151
+ xmldoc.xpath("//figure//figure").each do |f|
152
+ { footnote: "fn", note: "note", key: "dl" }.each do |k, v|
153
+ f.xpath(".//#{v}").each do |n|
154
+ @log.add("Style", n, "#{k} is not permitted in a subfigure")
155
+ end
156
+ end
157
+ end
158
+ end
159
+
149
160
  def bibdata_validate(doc)
150
161
  doctype_validate(doc)
151
162
  script_validate(doc)
@@ -166,6 +177,7 @@ module Asciidoctor
166
177
  locality_erefs_validate(doc.root)
167
178
  bibdata_validate(doc.root)
168
179
  bibitem_validate(doc.root)
180
+ figure_validate(doc.root)
169
181
  end
170
182
 
171
183
  def bibitem_validate(xmldoc)
@@ -4,11 +4,14 @@ module Asciidoctor
4
4
  module ISO
5
5
  class Converter < Standoc::Converter
6
6
  def section_validate(doc)
7
- foreword_validate(doc.root)
8
- normref_validate(doc.root)
9
- symbols_validate(doc.root)
10
- sections_presence_validate(doc.root)
11
- sections_sequence_validate(doc.root)
7
+ doctype = doc&.at("//bibdata/ext/doctype")&.text
8
+ unless %w(amendment technical-corrigendum).include? doctype
9
+ foreword_validate(doc.root)
10
+ normref_validate(doc.root)
11
+ symbols_validate(doc.root)
12
+ sections_presence_validate(doc.root)
13
+ sections_sequence_validate(doc.root)
14
+ end
12
15
  section_style(doc.root)
13
16
  subclause_validate(doc.root)
14
17
  super
@@ -111,13 +114,13 @@ module Asciidoctor
111
114
  end
112
115
  n&.at("./self::clause") ||
113
116
  @log.add("Style", nil, "Document must contain clause after "\
114
- "Terms and Definitions")
117
+ "Terms and Definitions")
115
118
  n&.at("./self::clause[@type = 'scope']") &&
116
119
  @log.add("Style", nil, "Scope must occur before Terms and Definitions")
117
120
  n = names.shift
118
121
  while n&.name == "clause"
119
122
  n&.at("./self::clause[@type = 'scope']")
120
- @log.add("Style", nil, "Scope must occur before Terms and Definitions")
123
+ @log.add("Style", nil, "Scope must occur before Terms and Definitions")
121
124
  n = names.shift
122
125
  end
123
126
  unless %w(annex references).include? n&.name
@@ -127,12 +130,12 @@ module Asciidoctor
127
130
  n = names.shift
128
131
  if n.nil?
129
132
  @log.add("Style", nil, "Document must include (references) "\
130
- "Normative References")
133
+ "Normative References")
131
134
  end
132
135
  end
133
136
  n&.at("./self::references[@normative = 'true']") ||
134
137
  @log.add("Style", nil, "Document must include (references) "\
135
- "Normative References")
138
+ "Normative References")
136
139
  n = names&.shift
137
140
  n&.at("./self::references[@normative = 'false']") ||
138
141
  @log.add("Style", nil, "Final section must be (references) Bibliography")
@@ -2763,7 +2763,12 @@
2763
2763
 
2764
2764
  <xsl:variable name="table_attributes">
2765
2765
  <attribute name="table-layout">fixed</attribute>
2766
- <attribute name="width">100%</attribute>
2766
+ <attribute name="width">
2767
+ <xsl:choose>
2768
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2769
+ <xsl:otherwise>100%</xsl:otherwise>
2770
+ </xsl:choose>
2771
+ </attribute>
2767
2772
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2768
2773
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2769
2774
 
@@ -4017,6 +4022,10 @@
4017
4022
  </xsl:if>
4018
4023
  <xsl:apply-templates/>
4019
4024
  </fo:inline>
4025
+ </xsl:template><xsl:template match="*[local-name()='underline']">
4026
+ <fo:inline text-decoration="underline">
4027
+ <xsl:apply-templates/>
4028
+ </fo:inline>
4020
4029
  </xsl:template><xsl:template match="*[local-name()='del']">
4021
4030
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4022
4031
  <xsl:apply-templates/>
@@ -5584,6 +5593,8 @@
5584
5593
  <xsl:value-of select="translate(.,'. ','')"/>
5585
5594
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5586
5595
  <xsl:value-of select="substring(.,1,1)"/>
5596
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5597
+ <fo:inline><xsl:apply-templates/></fo:inline>
5587
5598
  </xsl:template><xsl:template name="convertDate">
5588
5599
  <xsl:param name="date"/>
5589
5600
  <xsl:param name="format" select="'short'"/>
@@ -5863,6 +5874,11 @@
5863
5874
  <xsl:call-template name="getLang"/>
5864
5875
  </xsl:variable>
5865
5876
 
5866
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5877
+ <xsl:choose>
5878
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5879
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5880
+ </xsl:when>
5881
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5882
+ </xsl:choose>
5867
5883
 
5868
5884
  </xsl:template></xsl:stylesheet>
@@ -2763,7 +2763,12 @@
2763
2763
 
2764
2764
  <xsl:variable name="table_attributes">
2765
2765
  <attribute name="table-layout">fixed</attribute>
2766
- <attribute name="width">100%</attribute>
2766
+ <attribute name="width">
2767
+ <xsl:choose>
2768
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2769
+ <xsl:otherwise>100%</xsl:otherwise>
2770
+ </xsl:choose>
2771
+ </attribute>
2767
2772
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2768
2773
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2769
2774
 
@@ -4017,6 +4022,10 @@
4017
4022
  </xsl:if>
4018
4023
  <xsl:apply-templates/>
4019
4024
  </fo:inline>
4025
+ </xsl:template><xsl:template match="*[local-name()='underline']">
4026
+ <fo:inline text-decoration="underline">
4027
+ <xsl:apply-templates/>
4028
+ </fo:inline>
4020
4029
  </xsl:template><xsl:template match="*[local-name()='del']">
4021
4030
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4022
4031
  <xsl:apply-templates/>
@@ -5584,6 +5593,8 @@
5584
5593
  <xsl:value-of select="translate(.,'. ','')"/>
5585
5594
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5586
5595
  <xsl:value-of select="substring(.,1,1)"/>
5596
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5597
+ <fo:inline><xsl:apply-templates/></fo:inline>
5587
5598
  </xsl:template><xsl:template name="convertDate">
5588
5599
  <xsl:param name="date"/>
5589
5600
  <xsl:param name="format" select="'short'"/>
@@ -5863,6 +5874,11 @@
5863
5874
  <xsl:call-template name="getLang"/>
5864
5875
  </xsl:variable>
5865
5876
 
5866
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5877
+ <xsl:choose>
5878
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5879
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5880
+ </xsl:when>
5881
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5882
+ </xsl:choose>
5867
5883
 
5868
5884
  </xsl:template></xsl:stylesheet>
@@ -1,7 +1,7 @@
1
1
  module IsoDoc
2
2
  module Iso
3
3
  module BaseConvert
4
- def middle_title(out)
4
+ def middle_title(isoxml, out)
5
5
  middle_title_main(out)
6
6
  middle_title_amd(out)
7
7
  end
@@ -1,10 +1,14 @@
1
1
  module IsoDoc
2
2
  module Iso
3
+ class Counter < IsoDoc::XrefGen::Counter
4
+ end
5
+
3
6
  class Xref < IsoDoc::Xref
4
7
  def initial_anchor_names(d)
5
8
  if @klass.amd(d)
6
9
  d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
7
10
  sequential_asset_names(d.xpath(ns("//preface/*")))
11
+ d.xpath(ns("//sections/clause")).each { |c| c.element? and preface_names(c) }
8
12
  middle_section_asset_names(d)
9
13
  termnote_anchor_names(d)
10
14
  termexample_anchor_names(d)
@@ -19,8 +23,10 @@ module IsoDoc
19
23
  return if clause.nil?
20
24
  clause.at(ns("./clause")) and @anchors[clause["id"]] =
21
25
  { label: "0", level: 1, xref: clause.at(ns("./title"))&.text, type: "clause" }
22
- clause.xpath(ns("./clause")).each_with_index do |c, i|
23
- section_names1(c, "0.#{i + 1}", 2)
26
+ i = Counter.new
27
+ clause.xpath(ns("./clause")).each do |c|
28
+ i.increment(c)
29
+ section_names1(c, "0.#{i.print}", 2)
24
30
  end
25
31
  end
26
32
 
@@ -30,12 +36,16 @@ module IsoDoc
30
36
  end
31
37
 
32
38
  def appendix_names(clause, num)
33
- clause.xpath(ns("./appendix")).each_with_index do |c, i|
34
- @anchors[c["id"]] = anchor_struct(i + 1, nil, @labels["appendix"], "clause")
39
+ i = Counter.new
40
+ clause.xpath(ns("./appendix")).each do |c|
41
+ i.increment(c)
42
+ @anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"], "clause")
35
43
  @anchors[c["id"]][:level] = 2
36
44
  @anchors[c["id"]][:container] = clause["id"]
37
- c.xpath(ns("./clause | ./references")).each_with_index do |c, j|
38
- appendix_names1(c, l10n("#{@labels["appendix"]} #{i + 1}.#{j + 1}"), 3, clause["id"])
45
+ j = Counter.new
46
+ c.xpath(ns("./clause | ./references")).each do |c1|
47
+ j.increment(c1)
48
+ appendix_names1(c1, l10n("#{@labels["appendix"]} #{i.print}.#{j.print}"), 3, clause["id"])
39
49
  end
40
50
  end
41
51
  end
@@ -44,24 +54,30 @@ module IsoDoc
44
54
  @anchors[clause["id"]] =
45
55
  { label: num, level: level, xref: num }
46
56
  # subclauses are not prefixed with "Clause"
57
+ i = Counter.new
47
58
  clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
48
59
  "./references")).
49
- each_with_index do |c, i|
50
- section_names1(c, "#{num}.#{i + 1}", level + 1)
60
+ each do |c|
61
+ i.increment(c)
62
+ section_names1(c, "#{num}.#{i.print}", level + 1)
51
63
  end
52
64
  end
53
65
 
54
66
  def annex_names1(clause, num, level)
55
67
  @anchors[clause["id"]] = { label: num, xref: num, level: level }
56
- clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
57
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
68
+ i = Counter.new
69
+ clause.xpath(ns("./clause | ./references")).each do |c|
70
+ i.increment(c)
71
+ annex_names1(c, "#{num}.#{i.print}", level + 1)
58
72
  end
59
73
  end
60
74
 
61
75
  def appendix_names1(clause, num, level, container)
62
76
  @anchors[clause["id"]] = { label: num, xref: num, level: level, container: container }
63
- clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
64
- appendix_names1(c, "#{num}.#{i + 1}", level + 1, container)
77
+ i = Counter.new
78
+ clause.xpath(ns("./clause | ./references")).each do |c|
79
+ i.increment(c)
80
+ appendix_names1(c, "#{num}.#{i.print}", level + 1, container)
65
81
  end
66
82
  end
67
83