metanorma-iso 2.2.0 → 2.2.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 +4 -4
- data/lib/isodoc/iso/i18n-en.yaml +2 -0
- data/lib/isodoc/iso/i18n-fr.yaml +1 -0
- data/lib/isodoc/iso/iso.amendment.xsl +33 -1
- data/lib/isodoc/iso/iso.international-standard.xsl +33 -1
- data/lib/isodoc/iso/xref.rb +37 -88
- data/lib/isodoc/iso/xref_section.rb +79 -0
- data/lib/metanorma/iso/isodoc.rng +9 -0
- data/lib/metanorma/iso/isostandard.rng +3 -0
- data/lib/metanorma/iso/validate.rb +1 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma/requirements/modspec.rb +10 -7
- data/spec/metanorma/base_spec.rb +3 -3
- data/spec/metanorma/refs_spec.rb +7 -7
- data/spec/requirements/requirement_components_spec.rb +2 -2
- data/spec/requirements/requirements_spec.rb +3 -3
- data/spec/requirements/xref_spec.rb +35 -35
- data/spec/vcr_cassettes/docrels.yml +32 -32
- data/spec/vcr_cassettes/withdrawn_iso.yml +27 -27
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64ff031dbcbae3aeb600c99c3c200b27983e96d865a49c52413245c470885824
|
|
4
|
+
data.tar.gz: 81ea3cfa5672feae8e31aff1341224310f15f85d74d85a0ca017e3ceba829421
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fdb2b2f7a30d439df33decf4e0f97fedf91f7545aa7ee7f1c43e9a4a66b21ef942ddb7e9f77520ebdbb68dcc509332e0651a866f2ec33e98835e70c67f641546
|
|
7
|
+
data.tar.gz: 03500425f5f236f69010d688aaa906719f52eac6695d4dbe1ed78d6b63e6d2943a8b2299f8d19a05ae18570deb6f3d22b380a6f1b69da4d386d2d817da42273e
|
data/lib/isodoc/iso/i18n-en.yaml
CHANGED
data/lib/isodoc/iso/i18n-fr.yaml
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
|
|
6
6
|
|
|
7
7
|
<xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
|
|
8
|
+
<xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
|
|
8
9
|
|
|
9
10
|
<xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
|
|
10
11
|
|
|
@@ -435,6 +436,15 @@
|
|
|
435
436
|
<xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
|
|
436
437
|
<pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
|
|
437
438
|
</xsl:for-each>
|
|
439
|
+
<xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments2',@bibitemid)[1])]">
|
|
440
|
+
<xsl:variable name="bibitemid" select="@bibitemid"/>
|
|
441
|
+
<xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
|
|
442
|
+
<xsl:if test="$uri != ''">
|
|
443
|
+
<xsl:variable name="url" select="concat('url(file:',$basepath, $uri, ')')"/>
|
|
444
|
+
<xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
|
|
445
|
+
<pdf:embedded-file src="{$url}" filename="{$filename}"/>
|
|
446
|
+
</xsl:if>
|
|
447
|
+
</xsl:for-each>
|
|
438
448
|
</fo:declarations>
|
|
439
449
|
|
|
440
450
|
<xsl:call-template name="addBookmarks">
|
|
@@ -1948,6 +1958,28 @@
|
|
|
1948
1958
|
</fo:inline>
|
|
1949
1959
|
</xsl:template>
|
|
1950
1960
|
|
|
1961
|
+
<xsl:template match="*[local-name() = 'eref'][contains(@bibitemid,'.exp_')]" priority="2">
|
|
1962
|
+
<xsl:variable name="bibitemid" select="@bibitemid"/>
|
|
1963
|
+
<xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
|
|
1964
|
+
<xsl:choose>
|
|
1965
|
+
<xsl:when test="$uri != ''">
|
|
1966
|
+
<xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
|
|
1967
|
+
<fo:inline xsl:use-attribute-sets="eref-style">
|
|
1968
|
+
<xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
|
|
1969
|
+
<fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
|
|
1970
|
+
<xsl:if test="normalize-space(@citeas) = ''">
|
|
1971
|
+
<xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
|
|
1972
|
+
</xsl:if>
|
|
1973
|
+
<xsl:apply-templates/>
|
|
1974
|
+
</fo:basic-link>
|
|
1975
|
+
</fo:inline>
|
|
1976
|
+
</xsl:when>
|
|
1977
|
+
<xsl:otherwise>
|
|
1978
|
+
<xsl:call-template name="eref"/>
|
|
1979
|
+
</xsl:otherwise>
|
|
1980
|
+
</xsl:choose>
|
|
1981
|
+
</xsl:template>
|
|
1982
|
+
|
|
1951
1983
|
<!-- =================== -->
|
|
1952
1984
|
<!-- Index processing -->
|
|
1953
1985
|
<!-- =================== -->
|
|
@@ -9049,7 +9081,7 @@
|
|
|
9049
9081
|
<!-- ====== -->
|
|
9050
9082
|
<!-- eref -->
|
|
9051
9083
|
<!-- ====== -->
|
|
9052
|
-
<xsl:template match="*[local-name() = 'eref']">
|
|
9084
|
+
<xsl:template match="*[local-name() = 'eref']" name="eref">
|
|
9053
9085
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
|
9054
9086
|
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
|
9055
9087
|
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
|
|
6
6
|
|
|
7
7
|
<xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
|
|
8
|
+
<xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
|
|
8
9
|
|
|
9
10
|
<xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
|
|
10
11
|
|
|
@@ -435,6 +436,15 @@
|
|
|
435
436
|
<xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
|
|
436
437
|
<pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
|
|
437
438
|
</xsl:for-each>
|
|
439
|
+
<xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments2',@bibitemid)[1])]">
|
|
440
|
+
<xsl:variable name="bibitemid" select="@bibitemid"/>
|
|
441
|
+
<xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
|
|
442
|
+
<xsl:if test="$uri != ''">
|
|
443
|
+
<xsl:variable name="url" select="concat('url(file:',$basepath, $uri, ')')"/>
|
|
444
|
+
<xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
|
|
445
|
+
<pdf:embedded-file src="{$url}" filename="{$filename}"/>
|
|
446
|
+
</xsl:if>
|
|
447
|
+
</xsl:for-each>
|
|
438
448
|
</fo:declarations>
|
|
439
449
|
|
|
440
450
|
<xsl:call-template name="addBookmarks">
|
|
@@ -1948,6 +1958,28 @@
|
|
|
1948
1958
|
</fo:inline>
|
|
1949
1959
|
</xsl:template>
|
|
1950
1960
|
|
|
1961
|
+
<xsl:template match="*[local-name() = 'eref'][contains(@bibitemid,'.exp_')]" priority="2">
|
|
1962
|
+
<xsl:variable name="bibitemid" select="@bibitemid"/>
|
|
1963
|
+
<xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
|
|
1964
|
+
<xsl:choose>
|
|
1965
|
+
<xsl:when test="$uri != ''">
|
|
1966
|
+
<xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
|
|
1967
|
+
<fo:inline xsl:use-attribute-sets="eref-style">
|
|
1968
|
+
<xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
|
|
1969
|
+
<fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
|
|
1970
|
+
<xsl:if test="normalize-space(@citeas) = ''">
|
|
1971
|
+
<xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
|
|
1972
|
+
</xsl:if>
|
|
1973
|
+
<xsl:apply-templates/>
|
|
1974
|
+
</fo:basic-link>
|
|
1975
|
+
</fo:inline>
|
|
1976
|
+
</xsl:when>
|
|
1977
|
+
<xsl:otherwise>
|
|
1978
|
+
<xsl:call-template name="eref"/>
|
|
1979
|
+
</xsl:otherwise>
|
|
1980
|
+
</xsl:choose>
|
|
1981
|
+
</xsl:template>
|
|
1982
|
+
|
|
1951
1983
|
<!-- =================== -->
|
|
1952
1984
|
<!-- Index processing -->
|
|
1953
1985
|
<!-- =================== -->
|
|
@@ -9049,7 +9081,7 @@
|
|
|
9049
9081
|
<!-- ====== -->
|
|
9050
9082
|
<!-- eref -->
|
|
9051
9083
|
<!-- ====== -->
|
|
9052
|
-
<xsl:template match="*[local-name() = 'eref']">
|
|
9084
|
+
<xsl:template match="*[local-name() = 'eref']" name="eref">
|
|
9053
9085
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
|
9054
9086
|
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
|
9055
9087
|
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
data/lib/isodoc/iso/xref.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require_relative "xref_section"
|
|
2
|
+
|
|
1
3
|
module IsoDoc
|
|
2
4
|
module Iso
|
|
3
5
|
class Counter < IsoDoc::XrefGen::Counter
|
|
@@ -17,11 +19,10 @@ module IsoDoc
|
|
|
17
19
|
|
|
18
20
|
def initial_anchor_names_amd(doc)
|
|
19
21
|
if @parse_settings.empty? || @parse_settings[:clauses]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
c.element? and preface_names(c)
|
|
22
|
+
["//preface/*", "//sections/clause"].each do |xpath|
|
|
23
|
+
doc.xpath(ns(xpath)).each do |c|
|
|
24
|
+
c.element? and preface_names(c)
|
|
25
|
+
end
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
end
|
|
@@ -49,76 +50,6 @@ module IsoDoc
|
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
|
|
52
|
-
# we can reference 0-number clauses in introduction
|
|
53
|
-
def introduction_names(clause)
|
|
54
|
-
return if clause.nil?
|
|
55
|
-
|
|
56
|
-
clause.at(ns("./clause")) and
|
|
57
|
-
@anchors[clause["id"]] = { label: "0", level: 1, type: "clause",
|
|
58
|
-
xref: clause.at(ns("./title"))&.text }
|
|
59
|
-
i = Counter.new
|
|
60
|
-
clause.xpath(ns("./clause")).each do |c|
|
|
61
|
-
i.increment(c)
|
|
62
|
-
section_names1(c, "0.#{i.print}", 2)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def annex_names(clause, num)
|
|
67
|
-
appendix_names(clause, num)
|
|
68
|
-
super
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def appendix_names(clause, _num)
|
|
72
|
-
i = Counter.new
|
|
73
|
-
clause.xpath(ns("./appendix")).each do |c|
|
|
74
|
-
i.increment(c)
|
|
75
|
-
@anchors[c["id"]] =
|
|
76
|
-
anchor_struct(i.print, nil, @labels["appendix"],
|
|
77
|
-
"clause").merge(level: 2, subtype: "annex",
|
|
78
|
-
container: clause["id"])
|
|
79
|
-
j = Counter.new
|
|
80
|
-
c.xpath(ns("./clause | ./references")).each do |c1|
|
|
81
|
-
j.increment(c1)
|
|
82
|
-
lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
|
|
83
|
-
appendix_names1(c1, l10n(lbl), 3, clause["id"])
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# subclauses are not prefixed with "Clause"
|
|
89
|
-
# retaining subtype for the semantics
|
|
90
|
-
def section_names1(clause, num, level)
|
|
91
|
-
@anchors[clause["id"]] =
|
|
92
|
-
{ label: num, level: level, xref: num, subtype: "clause" }
|
|
93
|
-
i = Counter.new
|
|
94
|
-
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
|
95
|
-
"./references"))
|
|
96
|
-
.each do |c|
|
|
97
|
-
i.increment(c)
|
|
98
|
-
section_names1(c, "#{num}.#{i.print}", level + 1)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def annex_names1(clause, num, level)
|
|
103
|
-
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
|
104
|
-
subtype: "annex" }
|
|
105
|
-
i = Counter.new
|
|
106
|
-
clause.xpath(ns("./clause | ./references")).each do |c|
|
|
107
|
-
i.increment(c)
|
|
108
|
-
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def appendix_names1(clause, num, level, container)
|
|
113
|
-
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
|
114
|
-
container: container }
|
|
115
|
-
i = Counter.new
|
|
116
|
-
clause.xpath(ns("./clause | ./references")).each do |c|
|
|
117
|
-
i.increment(c)
|
|
118
|
-
appendix_names1(c, "#{num}.#{i.print}", level + 1, container)
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
53
|
def hierarchical_formula_names(clause, num)
|
|
123
54
|
c = IsoDoc::XrefGen::Counter.new
|
|
124
55
|
clause.xpath(ns(".//formula")).each do |t|
|
|
@@ -132,10 +63,10 @@ module IsoDoc
|
|
|
132
63
|
end
|
|
133
64
|
end
|
|
134
65
|
|
|
135
|
-
def figure_anchor(elem, sublabel, label)
|
|
66
|
+
def figure_anchor(elem, sublabel, label, klass)
|
|
136
67
|
@anchors[elem["id"]] = anchor_struct(
|
|
137
68
|
(sublabel ? "#{label} #{sublabel}" : label),
|
|
138
|
-
nil, @labels[
|
|
69
|
+
nil, @labels[klass] || klass.capitalize, klass, elem["unnumbered"]
|
|
139
70
|
)
|
|
140
71
|
sublabel && elem["unnumbered"] != "true" and
|
|
141
72
|
@anchors[elem["id"]][:label] = sublabel
|
|
@@ -143,27 +74,49 @@ module IsoDoc
|
|
|
143
74
|
|
|
144
75
|
def sequential_figure_names(clause)
|
|
145
76
|
j = 0
|
|
146
|
-
clause.xpath(ns(
|
|
77
|
+
clause.xpath(ns(FIGURE_NO_CLASS)).noblank
|
|
147
78
|
.each_with_object(IsoDoc::XrefGen::Counter.new) do |t, c|
|
|
148
79
|
j = subfigure_increment(j, c, t)
|
|
149
80
|
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
|
150
|
-
|
|
81
|
+
figure_anchor(t, sublabel, c.print, "figure")
|
|
82
|
+
end
|
|
83
|
+
sequential_figure_class_names(clause)
|
|
84
|
+
end
|
|
151
85
|
|
|
152
|
-
|
|
86
|
+
def sequential_figure_class_names(clause)
|
|
87
|
+
c = {}
|
|
88
|
+
j = 0
|
|
89
|
+
clause.xpath(ns(".//figure[@class][not(@class = 'pseudocode')]"))
|
|
90
|
+
.each do |t|
|
|
91
|
+
c[t["class"]] ||= IsoDoc::XrefGen::Counter.new
|
|
92
|
+
j = subfigure_increment(j, c[t["class"]], t)
|
|
93
|
+
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
|
94
|
+
figure_anchor(t, sublabel, c.print, t["class"])
|
|
153
95
|
end
|
|
154
96
|
end
|
|
155
97
|
|
|
156
98
|
def hierarchical_figure_names(clause, num)
|
|
157
99
|
c = IsoDoc::XrefGen::Counter.new
|
|
158
100
|
j = 0
|
|
159
|
-
clause.xpath(ns(
|
|
160
|
-
.each do |t|
|
|
101
|
+
clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
|
|
161
102
|
j = subfigure_increment(j, c, t)
|
|
162
103
|
label = "#{num}#{hiersep}#{c.print}"
|
|
163
104
|
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
|
164
|
-
|
|
105
|
+
figure_anchor(t, sublabel, label, "figure")
|
|
106
|
+
end
|
|
107
|
+
hierarchical_figure_class_names(clause, num)
|
|
108
|
+
end
|
|
165
109
|
|
|
166
|
-
|
|
110
|
+
def hierarchical_figure_class_names(clause, num)
|
|
111
|
+
c = {}
|
|
112
|
+
j = 0
|
|
113
|
+
clause.xpath(ns(".//figure[@class][not(@class = 'pseudocode')]"))
|
|
114
|
+
.noblank.each do |t|
|
|
115
|
+
c[t["class"]] ||= IsoDoc::XrefGen::Counter.new
|
|
116
|
+
j = subfigure_increment(j, c[t["class"]], t)
|
|
117
|
+
label = "#{num}#{hiersep}#{c.print}"
|
|
118
|
+
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
|
119
|
+
figure_anchor(t, sublabel, label, t["class"])
|
|
167
120
|
end
|
|
168
121
|
end
|
|
169
122
|
|
|
@@ -180,10 +133,6 @@ module IsoDoc
|
|
|
180
133
|
end
|
|
181
134
|
end
|
|
182
135
|
|
|
183
|
-
def annex_name_lbl(clause, num)
|
|
184
|
-
super.sub(%r{<br/>(.*)$}, "<br/><span class='obligation'>\\1</span>")
|
|
185
|
-
end
|
|
186
|
-
|
|
187
136
|
def list_anchor_names(sections)
|
|
188
137
|
sections.each do |s|
|
|
189
138
|
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module IsoDoc
|
|
2
|
+
module Iso
|
|
3
|
+
class Xref < IsoDoc::Xref
|
|
4
|
+
# we can reference 0-number clauses in introduction
|
|
5
|
+
def introduction_names(clause)
|
|
6
|
+
return if clause.nil?
|
|
7
|
+
|
|
8
|
+
clause.at(ns("./clause")) and
|
|
9
|
+
@anchors[clause["id"]] = { label: "0", level: 1, type: "clause",
|
|
10
|
+
xref: clause.at(ns("./title"))&.text }
|
|
11
|
+
i = Counter.new
|
|
12
|
+
clause.xpath(ns("./clause")).each do |c|
|
|
13
|
+
i.increment(c)
|
|
14
|
+
section_names1(c, "0.#{i.print}", 2)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def annex_names(clause, num)
|
|
19
|
+
appendix_names(clause, num)
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def appendix_names(clause, _num)
|
|
24
|
+
i = Counter.new
|
|
25
|
+
clause.xpath(ns("./appendix")).each do |c|
|
|
26
|
+
i.increment(c)
|
|
27
|
+
@anchors[c["id"]] =
|
|
28
|
+
anchor_struct(i.print, nil, @labels["appendix"],
|
|
29
|
+
"clause").merge(level: 2, subtype: "annex",
|
|
30
|
+
container: clause["id"])
|
|
31
|
+
j = Counter.new
|
|
32
|
+
c.xpath(ns("./clause | ./references")).each do |c1|
|
|
33
|
+
j.increment(c1)
|
|
34
|
+
lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
|
|
35
|
+
appendix_names1(c1, l10n(lbl), 3, clause["id"])
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# subclauses are not prefixed with "Clause"
|
|
41
|
+
# retaining subtype for the semantics
|
|
42
|
+
def section_names1(clause, num, level)
|
|
43
|
+
@anchors[clause["id"]] =
|
|
44
|
+
{ label: num, level: level, xref: num, subtype: "clause" }
|
|
45
|
+
i = Counter.new
|
|
46
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
|
47
|
+
"./references"))
|
|
48
|
+
.each do |c|
|
|
49
|
+
i.increment(c)
|
|
50
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def annex_names1(clause, num, level)
|
|
55
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
|
56
|
+
subtype: "annex" }
|
|
57
|
+
i = Counter.new
|
|
58
|
+
clause.xpath(ns("./clause | ./references")).each do |c|
|
|
59
|
+
i.increment(c)
|
|
60
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def appendix_names1(clause, num, level, container)
|
|
65
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
|
66
|
+
container: container }
|
|
67
|
+
i = Counter.new
|
|
68
|
+
clause.xpath(ns("./clause | ./references")).each do |c|
|
|
69
|
+
i.increment(c)
|
|
70
|
+
appendix_names1(c, "#{num}.#{i.print}", level + 1, container)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def annex_name_lbl(clause, num)
|
|
75
|
+
super.sub(%r{<br/>(.*)$}, "<br/><span class='obligation'>\\1</span>")
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -205,6 +205,15 @@
|
|
|
205
205
|
<data type="boolean"/>
|
|
206
206
|
</attribute>
|
|
207
207
|
</optional>
|
|
208
|
+
<optional>
|
|
209
|
+
<attribute name="style">
|
|
210
|
+
<choice>
|
|
211
|
+
<value>basic</value>
|
|
212
|
+
<value>full</value>
|
|
213
|
+
<value>short</value>
|
|
214
|
+
</choice>
|
|
215
|
+
</attribute>
|
|
216
|
+
</optional>
|
|
208
217
|
<ref name="XrefBody"/>
|
|
209
218
|
</element>
|
|
210
219
|
</define>
|
|
@@ -18,9 +18,9 @@ module Metanorma
|
|
|
18
18
|
return lbl unless title &&
|
|
19
19
|
elem.ancestors("requirement, recommendation, permission").empty?
|
|
20
20
|
|
|
21
|
-
lbl +=
|
|
21
|
+
lbl += ": " if lbl
|
|
22
22
|
lbl += title.children.to_xml
|
|
23
|
-
lbl
|
|
23
|
+
l10n(lbl)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# ISO labels modspec reqt as table, with reqt label as title
|
|
@@ -38,7 +38,8 @@ module Metanorma
|
|
|
38
38
|
def requirement_component_parse(node, out)
|
|
39
39
|
if node["exclude"] != "true" && node.name == "description"
|
|
40
40
|
lbl = "statement"
|
|
41
|
-
|
|
41
|
+
recommend_class(node.parent) == "recommendclass" and
|
|
42
|
+
lbl = "description"
|
|
42
43
|
out << "<tr><td>#{@labels['modspec'][lbl]}</td>"\
|
|
43
44
|
"<td>#{node.children.to_xml}</td></tr>"
|
|
44
45
|
else
|
|
@@ -46,11 +47,13 @@ module Metanorma
|
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
def requirement_table_cleanup(table)
|
|
50
|
+
def requirement_table_cleanup(node, table)
|
|
50
51
|
return table unless table["type"] == "recommendclass"
|
|
51
52
|
|
|
53
|
+
label = if node["type"] == "conformanceclass" then "conformancetests"
|
|
54
|
+
else "provisions" end
|
|
52
55
|
ins = table.at(ns("./tbody/tr[td/table]")) or return table
|
|
53
|
-
ins.replace("<tr><td>#{@labels['modspec'][
|
|
56
|
+
ins.replace("<tr><td>#{@labels['modspec'][label]}</td>" +
|
|
54
57
|
"<td>#{nested_tables_names(table)}</td></tr>")
|
|
55
58
|
table.xpath(ns("./tbody/tr[td/table]")).each(&:remove)
|
|
56
59
|
table
|
|
@@ -67,8 +70,8 @@ module Metanorma
|
|
|
67
70
|
super
|
|
68
71
|
anchor[:xref_reqt2reqt] = anchor[:xref_bare]
|
|
69
72
|
if l = block.at(ns("./title"))
|
|
70
|
-
anchor[:xref_reqt2reqt]
|
|
71
|
-
l10n(":
|
|
73
|
+
anchor[:xref_reqt2reqt] =
|
|
74
|
+
l10n("#{anchor[:xref_reqt2reqt]}: #{l.children.to_xml.strip}")
|
|
72
75
|
end
|
|
73
76
|
anchor
|
|
74
77
|
end
|
data/spec/metanorma/base_spec.rb
CHANGED
|
@@ -1005,7 +1005,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
1005
1005
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
|
1006
1006
|
<uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
|
1007
1007
|
<docidentifier type='ISO' primary="true">ISO 123:2001</docidentifier>
|
|
1008
|
-
<docidentifier type='URN'>urn:iso:std:iso:123:
|
|
1008
|
+
<docidentifier type='URN'>urn:iso:std:iso:123:ed-3</docidentifier>
|
|
1009
1009
|
<docnumber>123</docnumber>
|
|
1010
1010
|
<date type='published'><on>2001-05</on></date>
|
|
1011
1011
|
<contributor>
|
|
@@ -1078,7 +1078,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
1078
1078
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
|
|
1079
1079
|
<uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
|
|
1080
1080
|
<docidentifier type='ISO' primary="true">ISO 125</docidentifier>
|
|
1081
|
-
<docidentifier type='URN'>urn:iso:std:iso:125:
|
|
1081
|
+
<docidentifier type='URN'>urn:iso:std:iso:125:ed-7</docidentifier>
|
|
1082
1082
|
<docnumber>125</docnumber>
|
|
1083
1083
|
<contributor>
|
|
1084
1084
|
<role type='publisher'/>
|
|
@@ -1130,7 +1130,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
1130
1130
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
|
|
1131
1131
|
<uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
|
|
1132
1132
|
<docidentifier type='ISO' primary="true">ISO 125:2020</docidentifier>
|
|
1133
|
-
<docidentifier type='URN'>urn:iso:std:iso:125:
|
|
1133
|
+
<docidentifier type='URN'>urn:iso:std:iso:125:ed-7</docidentifier>
|
|
1134
1134
|
<docnumber>125</docnumber>
|
|
1135
1135
|
<date type='published'>
|
|
1136
1136
|
<on>2020-02</on>
|
data/spec/metanorma/refs_spec.rb
CHANGED
|
@@ -78,7 +78,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
78
78
|
<uri type="src">https://www.iso.org/standard/81720.html</uri>
|
|
79
79
|
<uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
|
|
80
80
|
<docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
|
|
81
|
-
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:
|
|
81
|
+
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:ed-1:fr</docidentifier>
|
|
82
82
|
<docnumber>17664</docnumber>
|
|
83
83
|
<contributor>
|
|
84
84
|
<role type="publisher"/>
|
|
@@ -127,7 +127,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
127
127
|
<uri type="src">https://www.iso.org/standard/81720.html</uri>
|
|
128
128
|
<uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
|
|
129
129
|
<docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
|
|
130
|
-
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:
|
|
130
|
+
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:ed-1:fr</docidentifier>
|
|
131
131
|
<docnumber>17664</docnumber>
|
|
132
132
|
<contributor>
|
|
133
133
|
<role type="publisher"/>
|
|
@@ -410,7 +410,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
410
410
|
<uri type='src'>https://www.iso.org/standard/2405.html</uri>
|
|
411
411
|
<uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
|
|
412
412
|
<docidentifier type='ISO' primary='true'>ISO 31-0</docidentifier>
|
|
413
|
-
<docidentifier type='URN'>urn:iso:std:iso:31:-0:
|
|
413
|
+
<docidentifier type='URN'>urn:iso:std:iso:31:-0:ed-1</docidentifier>
|
|
414
414
|
<docnumber>31</docnumber>
|
|
415
415
|
<contributor>
|
|
416
416
|
<role type='publisher'/>
|
|
@@ -447,7 +447,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
447
447
|
<uri type='src'>https://www.iso.org/standard/2405.html</uri>
|
|
448
448
|
<uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
|
|
449
449
|
<docidentifier type='ISO' primary='true'>ISO 31-0:1974</docidentifier>
|
|
450
|
-
<docidentifier type='URN'>urn:iso:std:iso:31:-0:
|
|
450
|
+
<docidentifier type='URN'>urn:iso:std:iso:31:-0:ed-1</docidentifier>
|
|
451
451
|
<docnumber>31</docnumber>
|
|
452
452
|
<date type='published'>
|
|
453
453
|
<on>1974-01</on>
|
|
@@ -494,7 +494,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
494
494
|
<uri type='src'>https://www.iso.org/standard/76389.html</uri>
|
|
495
495
|
<uri type='rss'>https://www.iso.org/contents/data/standard/07/63/76389.detail.rss</uri>
|
|
496
496
|
<docidentifier type='ISO' primary='true'>ISO 683-3:2019</docidentifier>
|
|
497
|
-
<docidentifier type='URN'>urn:iso:std:iso:683:-3:
|
|
497
|
+
<docidentifier type='URN'>urn:iso:std:iso:683:-3:ed-3</docidentifier>
|
|
498
498
|
<docnumber>683</docnumber>
|
|
499
499
|
<date type='published'>
|
|
500
500
|
<on>2019-01</on>
|
|
@@ -589,7 +589,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
589
589
|
<uri type="src">https://www.iso.org/standard/81720.html</uri>
|
|
590
590
|
<uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
|
|
591
591
|
<docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
|
|
592
|
-
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:
|
|
592
|
+
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:ed-1:fr</docidentifier>
|
|
593
593
|
<docnumber>17664</docnumber>
|
|
594
594
|
<contributor>
|
|
595
595
|
<role type="publisher"/>
|
|
@@ -630,7 +630,7 @@ RSpec.describe Metanorma::ISO do
|
|
|
630
630
|
<uri type="src">https://www.iso.org/standard/81720.html</uri>
|
|
631
631
|
<uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
|
|
632
632
|
<docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
|
|
633
|
-
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:
|
|
633
|
+
<docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:ed-1:fr</docidentifier>
|
|
634
634
|
<docnumber>17664</docnumber>
|
|
635
635
|
<contributor>
|
|
636
636
|
<role type="publisher"/>
|
|
@@ -544,7 +544,7 @@ RSpec.describe Metanorma::Requirements::Iso::Modspec do
|
|
|
544
544
|
<td>Conformance test</td>
|
|
545
545
|
<td>
|
|
546
546
|
<xref target='A2'>
|
|
547
|
-
|
|
547
|
+
Conformance test 1:
|
|
548
548
|
Second
|
|
549
549
|
</xref>
|
|
550
550
|
</td>
|
|
@@ -552,7 +552,7 @@ RSpec.describe Metanorma::Requirements::Iso::Modspec do
|
|
|
552
552
|
</tbody>
|
|
553
553
|
</table>
|
|
554
554
|
<table id='A2' class='modspec' type='recommendtest'>
|
|
555
|
-
<name>Table 2 —
|
|
555
|
+
<name>Table 2 — Conformance test 1: Second</name>
|
|
556
556
|
<tbody>
|
|
557
557
|
<tr>
|
|
558
558
|
<td>Identifier</td>
|
|
@@ -693,7 +693,7 @@ RSpec.describe Metanorma::Requirements::Iso::Modspec do
|
|
|
693
693
|
<foreword id='A' displayorder='1'>
|
|
694
694
|
<title>Preface</title>
|
|
695
695
|
<table id='A1' class='modspec' type='recommendtest'>
|
|
696
|
-
<name>Table 1 —
|
|
696
|
+
<name>Table 1 — Conformance test 1: First</name>
|
|
697
697
|
<tbody>
|
|
698
698
|
<tr>
|
|
699
699
|
<td>Identifier</td>
|
|
@@ -1058,7 +1058,7 @@ RSpec.describe Metanorma::Requirements::Iso::Modspec do
|
|
|
1058
1058
|
</td>
|
|
1059
1059
|
</tr>
|
|
1060
1060
|
<tr>
|
|
1061
|
-
<td>
|
|
1061
|
+
<td>Conformance tests</td>
|
|
1062
1062
|
<td>
|
|
1063
1063
|
<xref target='B2'>
|
|
1064
1064
|
Permission 1:
|
|
@@ -1198,7 +1198,7 @@ RSpec.describe Metanorma::Requirements::Iso::Modspec do
|
|
|
1198
1198
|
</td>
|
|
1199
1199
|
</tr>
|
|
1200
1200
|
<tr>
|
|
1201
|
-
<td>
|
|
1201
|
+
<td>Tests de conformité</td>
|
|
1202
1202
|
<td>
|
|
1203
1203
|
<xref target='B2'>
|
|
1204
1204
|
Autorisation 1 :
|