metanorma-iso 3.2.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9ebdf7fb2219640ce408b74a41160519e4acad19d5140935c0d2f9446a50731
4
- data.tar.gz: 428f1918880a76ba9919b66e6f710d9325eb1dcf0f8e1b0d7135d9ef40a5aec3
3
+ metadata.gz: 8e84e2085d6343fd60bd793e41db41da5a8cdbeec698c43b87f27f607091dd59
4
+ data.tar.gz: 4a8ccb3f84e9f60a932aee916cfb160d2d96c3f9266d86c5160b3db7299ed169
5
5
  SHA512:
6
- metadata.gz: 52d472026038f5df1df1be69125db80726cc0659e427a68611c32ea7891e06ce4e53327d5aa5603632b524d2b92a02e36a47582d1ed46d79a478c6a42509dc6b
7
- data.tar.gz: 7752a342b66a659d6c9e855c0acdba9b7a41d737dd54e98e8814420c400f146ab35dce930c1e1b404d874ef64179dce5004d49f2cf928a1e76babdf5bf2c03f7
6
+ metadata.gz: 66b8a34284ee31e3c496b0682750306566be09c7e8fa93f5d347e04b815830cfc854ffd618f537d211610f084451881efd94ddd74d42e0309efa5eed8be3f8d7
7
+ data.tar.gz: 2929a8cd66d14ecf35f93abff89b59160a343ffefc2e45cab566ff6353f210a674045f360ae4cf7b3e49e288cba6ab269d7b948dbd5345f54e62978ceaf1718d
@@ -4115,38 +4115,6 @@
4115
4115
  <!-- title -->
4116
4116
  <!-- ====== -->
4117
4117
 
4118
- <xsl:template match="mn:annex/mn:fmt-title">
4119
- <xsl:choose>
4120
- <xsl:when test="$doctype = 'amendment'">
4121
- <xsl:call-template name="titleAmendment"/>
4122
- </xsl:when>
4123
- <xsl:otherwise>
4124
- <fo:block xsl:use-attribute-sets="annex-title-style">
4125
- <xsl:call-template name="refine_annex-title-style"/>
4126
-
4127
- <xsl:apply-templates/>
4128
- <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
4129
- </fo:block>
4130
- </xsl:otherwise>
4131
- </xsl:choose>
4132
- </xsl:template>
4133
-
4134
- <!-- Bibliography -->
4135
- <xsl:template match="mn:references[not(@normative='true')]/mn:fmt-title">
4136
- <xsl:choose>
4137
- <xsl:when test="$doctype = 'amendment'">
4138
- <xsl:call-template name="titleAmendment"/>
4139
- </xsl:when>
4140
- <xsl:otherwise>
4141
- <fo:block xsl:use-attribute-sets="references-non-normative-title-style">
4142
- <xsl:call-template name="refine_references-non-normative-title-style"/>
4143
-
4144
- <xsl:apply-templates/>
4145
- </fo:block>
4146
- </xsl:otherwise>
4147
- </xsl:choose>
4148
- </xsl:template>
4149
-
4150
4118
  <xsl:template match="mn:fmt-title" name="title">
4151
4119
  <xsl:param name="without_number">false</xsl:param>
4152
4120
 
@@ -4309,19 +4277,6 @@
4309
4277
  </xsl:choose>
4310
4278
  </xsl:template>
4311
4279
 
4312
- <xsl:template name="titleAmendment">
4313
- <!-- <xsl:variable name="id">
4314
- <xsl:call-template name="getId"/>
4315
- </xsl:variable> id="{$id}" -->
4316
- <fo:block font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
4317
- <xsl:call-template name="setIDforNamedDestination"/>
4318
- <!-- <xsl:if test="$layoutVersion = '2024'">
4319
- <xsl:attribute name="font-size">10.5pt</xsl:attribute>
4320
- </xsl:if> -->
4321
- <xsl:apply-templates/>
4322
- </fo:block>
4323
- </xsl:template>
4324
-
4325
4280
  <!-- ====== -->
4326
4281
  <!-- ====== -->
4327
4282
 
@@ -16249,17 +16204,18 @@
16249
16204
  <!-- END Admonition -->
16250
16205
  <!-- ================ -->
16251
16206
 
16252
- <xsl:attribute-set name="references-non-normative-title-style">
16207
+ <xsl:attribute-set name="bibliography-title-style">
16253
16208
  <xsl:attribute name="font-size">16pt</xsl:attribute>
16254
16209
  <xsl:attribute name="font-weight">bold</xsl:attribute>
16255
16210
  <xsl:attribute name="text-align">center</xsl:attribute>
16211
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
16256
16212
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
16257
16213
  <xsl:attribute name="margin-bottom">30pt</xsl:attribute>
16258
16214
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
16259
16215
  <xsl:attribute name="role">H1</xsl:attribute>
16260
16216
  </xsl:attribute-set>
16261
16217
 
16262
- <xsl:template name="refine_references-non-normative-title-style">
16218
+ <xsl:template name="refine_bibliography-title-style">
16263
16219
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
16264
16220
  <xsl:attribute name="font-size">14pt</xsl:attribute>
16265
16221
  <xsl:attribute name="span">all</xsl:attribute>
@@ -18366,15 +18322,17 @@
18366
18322
  <!-- ===================================== -->
18367
18323
 
18368
18324
  <xsl:attribute-set name="annex-title-style">
18325
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
18369
18326
  <xsl:attribute name="font-size">16pt</xsl:attribute>
18327
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
18370
18328
  <xsl:attribute name="text-align">center</xsl:attribute>
18329
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
18371
18330
  <xsl:attribute name="margin-bottom">48pt</xsl:attribute>
18372
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
18373
18331
  <xsl:attribute name="role">H1</xsl:attribute>
18374
18332
  </xsl:attribute-set> <!-- annex-title-style -->
18375
18333
 
18376
18334
  <xsl:template name="refine_annex-title-style">
18377
- <xsl:call-template name="setIDforNamedDestination"/>
18335
+ <!-- <xsl:call-template name="setIDforNamedDestination"/> -->
18378
18336
  <xsl:if test="$layoutVersion = '2024'">
18379
18337
  <xsl:attribute name="line-height">1.1</xsl:attribute>
18380
18338
  <!-- <xsl:attribute name="margin-bottom">52pt</xsl:attribute> -->
@@ -18652,6 +18610,20 @@
18652
18610
  <xsl:otherwise>12pt</xsl:otherwise>
18653
18611
  </xsl:choose>
18654
18612
  </xsl:attribute>
18613
+
18614
+ <xsl:if test="parent::mn:annex"><!-- Annex title -->
18615
+ <xsl:variable name="annex_title_styles">
18616
+ <styles xsl:use-attribute-sets="annex-title-style"><xsl:call-template name="refine_annex-title-style"/></styles>
18617
+ </xsl:variable>
18618
+ <xsl:copy-of select="xalan:nodeset($annex_title_styles)/styles/@*"/>
18619
+ </xsl:if>
18620
+
18621
+ <xsl:if test="parent::mn:references[not(@normative='true')]"><!-- Bibliography section title -->
18622
+ <xsl:variable name="bibliography_title_styles">
18623
+ <styles xsl:use-attribute-sets="bibliography-title-style"><xsl:call-template name="refine_bibliography-title-style"/></styles>
18624
+ </xsl:variable>
18625
+ <xsl:copy-of select="xalan:nodeset($bibliography_title_styles)/styles/@*"/>
18626
+ </xsl:if>
18655
18627
  <!-- $namespace = 'iso' -->
18656
18628
  <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
18657
18629
  </xsl:template> <!-- refine_title-style -->
@@ -4115,38 +4115,6 @@
4115
4115
  <!-- title -->
4116
4116
  <!-- ====== -->
4117
4117
 
4118
- <xsl:template match="mn:annex/mn:fmt-title">
4119
- <xsl:choose>
4120
- <xsl:when test="$doctype = 'amendment'">
4121
- <xsl:call-template name="titleAmendment"/>
4122
- </xsl:when>
4123
- <xsl:otherwise>
4124
- <fo:block xsl:use-attribute-sets="annex-title-style">
4125
- <xsl:call-template name="refine_annex-title-style"/>
4126
-
4127
- <xsl:apply-templates/>
4128
- <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
4129
- </fo:block>
4130
- </xsl:otherwise>
4131
- </xsl:choose>
4132
- </xsl:template>
4133
-
4134
- <!-- Bibliography -->
4135
- <xsl:template match="mn:references[not(@normative='true')]/mn:fmt-title">
4136
- <xsl:choose>
4137
- <xsl:when test="$doctype = 'amendment'">
4138
- <xsl:call-template name="titleAmendment"/>
4139
- </xsl:when>
4140
- <xsl:otherwise>
4141
- <fo:block xsl:use-attribute-sets="references-non-normative-title-style">
4142
- <xsl:call-template name="refine_references-non-normative-title-style"/>
4143
-
4144
- <xsl:apply-templates/>
4145
- </fo:block>
4146
- </xsl:otherwise>
4147
- </xsl:choose>
4148
- </xsl:template>
4149
-
4150
4118
  <xsl:template match="mn:fmt-title" name="title">
4151
4119
  <xsl:param name="without_number">false</xsl:param>
4152
4120
 
@@ -4309,19 +4277,6 @@
4309
4277
  </xsl:choose>
4310
4278
  </xsl:template>
4311
4279
 
4312
- <xsl:template name="titleAmendment">
4313
- <!-- <xsl:variable name="id">
4314
- <xsl:call-template name="getId"/>
4315
- </xsl:variable> id="{$id}" -->
4316
- <fo:block font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
4317
- <xsl:call-template name="setIDforNamedDestination"/>
4318
- <!-- <xsl:if test="$layoutVersion = '2024'">
4319
- <xsl:attribute name="font-size">10.5pt</xsl:attribute>
4320
- </xsl:if> -->
4321
- <xsl:apply-templates/>
4322
- </fo:block>
4323
- </xsl:template>
4324
-
4325
4280
  <!-- ====== -->
4326
4281
  <!-- ====== -->
4327
4282
 
@@ -16249,17 +16204,18 @@
16249
16204
  <!-- END Admonition -->
16250
16205
  <!-- ================ -->
16251
16206
 
16252
- <xsl:attribute-set name="references-non-normative-title-style">
16207
+ <xsl:attribute-set name="bibliography-title-style">
16253
16208
  <xsl:attribute name="font-size">16pt</xsl:attribute>
16254
16209
  <xsl:attribute name="font-weight">bold</xsl:attribute>
16255
16210
  <xsl:attribute name="text-align">center</xsl:attribute>
16211
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
16256
16212
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
16257
16213
  <xsl:attribute name="margin-bottom">30pt</xsl:attribute>
16258
16214
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
16259
16215
  <xsl:attribute name="role">H1</xsl:attribute>
16260
16216
  </xsl:attribute-set>
16261
16217
 
16262
- <xsl:template name="refine_references-non-normative-title-style">
16218
+ <xsl:template name="refine_bibliography-title-style">
16263
16219
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
16264
16220
  <xsl:attribute name="font-size">14pt</xsl:attribute>
16265
16221
  <xsl:attribute name="span">all</xsl:attribute>
@@ -18366,15 +18322,17 @@
18366
18322
  <!-- ===================================== -->
18367
18323
 
18368
18324
  <xsl:attribute-set name="annex-title-style">
18325
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
18369
18326
  <xsl:attribute name="font-size">16pt</xsl:attribute>
18327
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
18370
18328
  <xsl:attribute name="text-align">center</xsl:attribute>
18329
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
18371
18330
  <xsl:attribute name="margin-bottom">48pt</xsl:attribute>
18372
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
18373
18331
  <xsl:attribute name="role">H1</xsl:attribute>
18374
18332
  </xsl:attribute-set> <!-- annex-title-style -->
18375
18333
 
18376
18334
  <xsl:template name="refine_annex-title-style">
18377
- <xsl:call-template name="setIDforNamedDestination"/>
18335
+ <!-- <xsl:call-template name="setIDforNamedDestination"/> -->
18378
18336
  <xsl:if test="$layoutVersion = '2024'">
18379
18337
  <xsl:attribute name="line-height">1.1</xsl:attribute>
18380
18338
  <!-- <xsl:attribute name="margin-bottom">52pt</xsl:attribute> -->
@@ -18652,6 +18610,20 @@
18652
18610
  <xsl:otherwise>12pt</xsl:otherwise>
18653
18611
  </xsl:choose>
18654
18612
  </xsl:attribute>
18613
+
18614
+ <xsl:if test="parent::mn:annex"><!-- Annex title -->
18615
+ <xsl:variable name="annex_title_styles">
18616
+ <styles xsl:use-attribute-sets="annex-title-style"><xsl:call-template name="refine_annex-title-style"/></styles>
18617
+ </xsl:variable>
18618
+ <xsl:copy-of select="xalan:nodeset($annex_title_styles)/styles/@*"/>
18619
+ </xsl:if>
18620
+
18621
+ <xsl:if test="parent::mn:references[not(@normative='true')]"><!-- Bibliography section title -->
18622
+ <xsl:variable name="bibliography_title_styles">
18623
+ <styles xsl:use-attribute-sets="bibliography-title-style"><xsl:call-template name="refine_bibliography-title-style"/></styles>
18624
+ </xsl:variable>
18625
+ <xsl:copy-of select="xalan:nodeset($bibliography_title_styles)/styles/@*"/>
18626
+ </xsl:if>
18655
18627
  <!-- $namespace = 'iso' -->
18656
18628
  <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
18657
18629
  </xsl:template> <!-- refine_title-style -->
@@ -0,0 +1,119 @@
1
+ module IsoDoc
2
+ module Iso
3
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
+ def origin(docxml)
5
+ short_style_origin(docxml)
6
+ super
7
+ bracketed_refs_processing(docxml)
8
+ end
9
+
10
+ def short_style_origin(docxml)
11
+ docxml.xpath(ns("//fmt-origin")).each do |o|
12
+ xref_empty?(o) or next
13
+ fmt_origin_cite_full?(o) and o["style"] ||= "short"
14
+ end
15
+ end
16
+
17
+ def fmt_origin_cite_full?(elem)
18
+ sem_xml_descendant?(elem) and return
19
+ id = elem["bibitemid"] or return
20
+ b = @bibitem_lookup[id] or return
21
+ b["type"] != "standard" ||
22
+ !b.at(ns("./docidentifier[not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"))
23
+ end
24
+
25
+ # style [1] references as [Reference 1], eref or origin
26
+ def bracketed_refs_processing(docxml)
27
+ (docxml.xpath(ns("//semx[@element = 'eref']")) -
28
+ docxml.xpath(ns("//semx[@element = 'erefstack']//semx[@element = 'eref']")))
29
+ .each { |n| bracket_eref_style(n) }
30
+ docxml.xpath(ns("//semx[@element = 'erefstack']")).each do |n|
31
+ bracket_erefstack_style(n)
32
+ end
33
+ docxml.xpath(ns("//semx[@element = 'origin']")).each do |n|
34
+ bracket_origin_style(n)
35
+ end
36
+ end
37
+
38
+ def bracket_eref_style(elem)
39
+ semx = bracket_eref_original(elem) or return
40
+ if semx["style"] == "superscript"
41
+ elem.children.wrap("<sup></sup>")
42
+ remove_preceding_space(elem)
43
+ else
44
+ r = @i18n.reference
45
+ elem.add_first_child l10n("#{r} ")
46
+ end
47
+ end
48
+
49
+ # is the eref corresponding to this semx a simple [n] reference?
50
+ def bracket_eref_original(elem)
51
+ semx = elem.document.at("//*[@id = '#{elem['source']}']") or return
52
+ dup = elem.at(ns(".//fmt-eref | .//fmt-xref | .//fmt-origin"))
53
+ non_locality_elems(semx).empty? or return
54
+ /^\[\d+\]$/.match?(semx["citeas"]) or return
55
+ %w(full short).include?(dup["style"]) and return
56
+ semx
57
+ end
58
+
59
+ def bracket_erefstack_style(elem)
60
+ semx, erefstack_orig = bracket_erefstack_style_prep(elem)
61
+ semx.empty? and return
62
+ if erefstack_orig && erefstack_orig["style"]
63
+ elem.children.each do |e|
64
+ e.name == "span" and e.remove
65
+ e.text.strip.empty? and e.remove
66
+ end
67
+ elem.children.wrap("<sup></sup>")
68
+ remove_preceding_space(elem)
69
+ else
70
+ r = @i18n.inflect(@i18n.reference, number: "pl")
71
+ elem.add_first_child l10n("#{r} ")
72
+ end
73
+ end
74
+
75
+ def bracket_erefstack_style_prep(elem)
76
+ semx = elem.xpath(ns(".//semx[@element = 'eref']"))
77
+ .map { |e| bracket_eref_original(e) }.compact
78
+ erefstack_orig = elem.document.at("//*[@id = '#{elem['source']}']")
79
+ [semx, erefstack_orig]
80
+ end
81
+
82
+ def bracket_origin_style(elem)
83
+ bracket_eref_style(elem)
84
+ insert_biblio_callout(elem)
85
+ end
86
+
87
+ # TODO share with metanorma dir
88
+ ISO_PUBLISHER_XPATH = <<~XPATH.freeze
89
+ ./contributor[role/@type = 'publisher']/organization[abbreviation = 'ISO' or abbreviation = 'IEC' or name = 'International Organization for Standardization' or name = 'International Electrotechnical Commission']
90
+ XPATH
91
+
92
+ def insert_biblio_callout(elem)
93
+ semx = elem.document.at("//*[@id = '#{elem['source']}']") or return
94
+ if ref = @bibitem_lookup[semx["bibitemid"]]
95
+ ref.at(ns(ISO_PUBLISHER_XPATH)) and return
96
+ # is this reference cited with a [n],
97
+ # even if it has its own SDO identifier?
98
+ citeas = ref.at(ns("./docidentifier[@type = 'metanorma-ordinal']")) ||
99
+ ref.at(ns("./docidentifier[@type = 'metanorma']")) ||
100
+ ref.at(ns("./docidentifier[@scope = 'biblio-tag']"))
101
+ citeas = citeas.text
102
+ else
103
+ citeas = semx["citeas"]
104
+ end
105
+ /^\[\d+\]$/.match?(citeas) or return
106
+ elem << <<~XML
107
+ <fmt-xref target='#{semx['bibitemid']}'><sup>#{citeas}</sup></fmt-xref>
108
+ XML
109
+ end
110
+
111
+ def remove_preceding_space(elem)
112
+ # Find the preceding text node that has actual content
113
+ prec = elem.at("./preceding-sibling::text()" \
114
+ "[normalize-space(.) != ''][1]") or return
115
+ prec.content.end_with?(" ") and prec.content = prec.content.rstrip
116
+ end
117
+ end
118
+ end
119
+ end
@@ -4,6 +4,7 @@ require_relative "presentation_xref"
4
4
  require_relative "presentation_bibdata"
5
5
  require_relative "presentation_section"
6
6
  require_relative "presentation_terms"
7
+ require_relative "presentation_origin"
7
8
  require_relative "../../relaton/render/general"
8
9
 
9
10
  module IsoDoc
@@ -147,77 +147,6 @@ module IsoDoc
147
147
  locality_span_wrap(super, @xrefs.anchor(node["target"], :subtype) ||
148
148
  @xrefs.anchor(node["target"], :type))
149
149
  end
150
-
151
- def origin(docxml)
152
- super
153
- bracketed_refs_processing(docxml)
154
- end
155
-
156
- # style [1] references as [Reference 1], eref or origin
157
- def bracketed_refs_processing(docxml)
158
- (docxml.xpath(ns("//semx[@element = 'eref']")) -
159
- docxml.xpath(ns("//semx[@element = 'erefstack']//semx[@element = 'eref']")))
160
- .each { |n| bracket_eref_style(n) }
161
- docxml.xpath(ns("//semx[@element = 'erefstack']")).each do |n|
162
- bracket_erefstack_style(n)
163
- end
164
- docxml.xpath(ns("//semx[@element = 'origin']")).each do |n|
165
- bracket_origin_style(n)
166
- end
167
- end
168
-
169
- def bracket_eref_style(elem)
170
- semx = bracket_eref_original(elem) or return
171
- if semx["style"] == "superscript"
172
- elem.children.wrap("<sup></sup>")
173
- remove_preceding_space(elem)
174
- else
175
- r = @i18n.reference
176
- elem.add_first_child l10n("#{r} ")
177
- end
178
- end
179
-
180
- # is the eref corresponding to this semx a simple [n] reference?
181
- def bracket_eref_original(elem)
182
- semx = elem.document.at("//*[@id = '#{elem['source']}']") or return
183
- non_locality_elems(semx).empty? or return
184
- /^\[\d+\]$/.match?(semx["citeas"]) or return
185
- semx
186
- end
187
-
188
- def bracket_erefstack_style(elem)
189
- semx, erefstack_orig = bracket_erefstack_style_prep(elem)
190
- semx.empty? and return
191
- if erefstack_orig && erefstack_orig["style"]
192
- elem.children.each do |e|
193
- e.name == "span" and e.remove
194
- e.text.strip.empty? and e.remove
195
- end
196
- elem.children.wrap("<sup></sup>")
197
- remove_preceding_space(elem)
198
- else
199
- r = @i18n.inflect(@i18n.reference, number: "pl")
200
- elem.add_first_child l10n("#{r} ")
201
- end
202
- end
203
-
204
- def bracket_erefstack_style_prep(elem)
205
- semx = elem.xpath(ns(".//semx[@element = 'eref']"))
206
- .map { |e| bracket_eref_original(e) }.compact
207
- erefstack_orig = elem.document.at("//*[@id = '#{elem['source']}']")
208
- [semx, erefstack_orig]
209
- end
210
-
211
- def bracket_origin_style(elem)
212
- bracket_eref_style(elem)
213
- end
214
-
215
- def remove_preceding_space(elem)
216
- # Find the preceding text node that has actual content
217
- prec = elem.at("./preceding-sibling::text()" \
218
- "[normalize-space(.) != ''][1]") or return
219
- prec.content.end_with?(" ") and prec.content = prec.content.rstrip
220
- end
221
150
  end
222
151
  end
223
152
  end
@@ -8,29 +8,6 @@ module IsoDoc
8
8
  class Xref < IsoDoc::Xref
9
9
  attr_accessor :anchors_previous, :anchors
10
10
 
11
- def clause_order_main(docxml)
12
- if @klass.amd?(docxml)
13
- [{ path: "//sections/clause", multi: true }]
14
- else
15
- [{ path: "//sections/clause[@type = 'scope']" },
16
- { path: @klass.norm_ref_xpath },
17
- { path:
18
- "#{@klass.middle_clause(docxml)} | //sections/terms | " \
19
- "//sections/clause[descendant::terms or descendant::definitions] | " \
20
- "//sections/definitions | //sections/clause[@type = 'section']", multi: true }]
21
- end
22
- end
23
-
24
- def clause_order_back(docxml)
25
- if @klass.amd?(docxml)
26
- [{ path: @klass.norm_ref_xpath },
27
- { path: @klass.bibliography_xpath },
28
- { path: "//indexsect", multi: true },
29
- { path: "//colophon/*", multi: true }]
30
- else super
31
- end
32
- end
33
-
34
11
  def initial_anchor_names(doc)
35
12
  super
36
13
  if @parse_settings.empty? || @parse_settings[:clauses]
@@ -1,6 +1,29 @@
1
1
  module IsoDoc
2
2
  module Iso
3
3
  class Xref < IsoDoc::Xref
4
+ def clause_order_main(docxml)
5
+ if @klass.amd?(docxml)
6
+ [{ path: "//sections/clause", multi: true }]
7
+ else
8
+ [{ path: "//sections/clause[@type = 'scope']" },
9
+ { path: @klass.norm_ref_xpath },
10
+ { path:
11
+ "#{@klass.middle_clause(docxml)} | //sections/terms | " \
12
+ "//sections/clause[descendant::terms or descendant::definitions] | " \
13
+ "//sections/definitions | //sections/clause[@type = 'section']", multi: true }]
14
+ end
15
+ end
16
+
17
+ def clause_order_back(docxml)
18
+ if @klass.amd?(docxml)
19
+ [{ path: @klass.norm_ref_xpath },
20
+ { path: @klass.bibliography_xpath },
21
+ { path: "//indexsect", multi: true },
22
+ { path: "//colophon/*", multi: true }]
23
+ else super
24
+ end
25
+ end
26
+
4
27
  # we can reference 0-number clauses in introduction
5
28
  def introduction_names(clause)
6
29
  clause.nil? and return
@@ -25,7 +48,8 @@ module IsoDoc
25
48
  elsif level > 1
26
49
  @anchors[clause["id"]] =
27
50
  { label: num, level: level, xref: num, subtype: "clause" }
28
- else super end
51
+ else super
52
+ end
29
53
  end
30
54
 
31
55
  def annex_name_anchors1(clause, num, level)
@@ -690,7 +690,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
690
690
  <define name="CitationType">
691
691
  <attribute name="bibitemid">
692
692
  <a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
693
- <data type="IDREF"/>
693
+ <ref name="IdRefType"/>
694
694
  </attribute>
695
695
  <choice>
696
696
  <zeroOrMore>
@@ -1296,17 +1296,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1296
1296
  </define>
1297
1297
  <define name="validityBegins">
1298
1298
  <element name="validityBegins">
1299
- <ref name="ISO8601Date"/>
1299
+ <ref name="ISO8601DateTime"/>
1300
1300
  </element>
1301
1301
  </define>
1302
1302
  <define name="validityEnds">
1303
1303
  <element name="validityEnds">
1304
- <ref name="ISO8601Date"/>
1304
+ <ref name="ISO8601DateTime"/>
1305
1305
  </element>
1306
1306
  </define>
1307
1307
  <define name="validityRevision">
1308
1308
  <element name="revision">
1309
- <ref name="ISO8601Date"/>
1309
+ <ref name="ISO8601DateTime"/>
1310
1310
  </element>
1311
1311
  </define>
1312
1312
  <define name="TypedTitleString">
@@ -16,12 +16,13 @@ module Metanorma
16
16
  end
17
17
 
18
18
  def metadata_ext_iso(node, xml)
19
- a = node.attr("horizontal") and xml.horizontal a
19
+ add_noko_elem(xml, "horizontal", node.attr("horizontal"))
20
20
  metadata_stage(node, xml)
21
- @amd && a = node.attr("updates-document-type") and
22
- xml.updates_document_type a
21
+ @amd and
22
+ add_noko_elem(xml, "updates_document_type",
23
+ node.attr("updates-document-type"))
23
24
  a = node.attr("fast-track") and xml.send "fast-track", a != "false"
24
- a = node.attr("price-code") and xml.price_code a
25
+ add_noko_elem(xml, "price_code", node.attr("price-code"))
25
26
  node.attr("iso-cen-parallel") and xml.iso_cen_parallel true
26
27
  end
27
28
 
@@ -58,9 +59,9 @@ module Metanorma
58
59
  substage = get_substage(node)
59
60
  abbrev = iso_id_default(iso_id_params(node)).stage&.abbr&.upcase
60
61
  xml.status do |s|
61
- s.stage stage, **attr_code(abbreviation: abbrev)
62
- s.substage substage
63
- i = node.attr("iteration") and s.iteration i
62
+ add_noko_elem(s, "stage", stage, **attr_code(abbreviation: abbrev))
63
+ add_noko_elem(s, "substage", substage)
64
+ add_noko_elem(s, "iteration", node.attr("iteration"))
64
65
  end
65
66
  rescue *STAGE_ERROR
66
67
  report_illegal_stage(stage, substage)
@@ -85,8 +85,8 @@ module Metanorma
85
85
 
86
86
  def contributors_committees_filter_empty?(committee)
87
87
  committee[:name].empty? &&
88
- (committee[:ident].nil? || %w(WG TC
89
- SC).include?(committee[:ident]))
88
+ (committee[:ident].nil? ||
89
+ %w(WG TC SC).include?(committee[:ident]))
90
90
  end
91
91
 
92
92
  def metadata_publisher(node, xml)
@@ -9,11 +9,11 @@ module Metanorma
9
9
  class Converter < Standoc::Converter
10
10
  def metadata_id(node, xml)
11
11
  if id = node.attr("docidentifier")
12
- xml.docidentifier id, **attr_code(type: "ISO", primary: "true")
12
+ add_noko_elem(xml, "docidentifier", id, type: "ISO", primary: "true")
13
13
  else iso_id(node, xml)
14
14
  end
15
15
  node.attr("tc-docnumber")&.split(/,\s*/)&.each do |n|
16
- xml.docidentifier(n, **attr_code(type: "iso-tc"))
16
+ add_noko_elem(xml, "docidentifier", n, type: "iso-tc")
17
17
  end
18
18
  end
19
19
 
@@ -164,25 +164,29 @@ module Metanorma
164
164
  end
165
165
 
166
166
  def cen_id_out(xml, params)
167
- xml.docidentifier iso_id_default(params).to_s,
168
- **attr_code(type: "CEN", primary: "true")
167
+ add_noko_elem(xml, "docidentifier",
168
+ iso_id_default(params).to_s,
169
+ **attr_code(type: "CEN", primary: "true"))
169
170
  end
170
171
 
171
172
  def iso_id_out_common(xml, params, with_prf)
172
- xml.docidentifier iso_id_default(params).to_s(with_prf:),
173
- **attr_code(type: "ISO", primary: "true")
174
- xml.docidentifier iso_id_reference(params)
175
- .to_s(format: :ref_num_short, with_prf:),
176
- **attr_code(type: "iso-reference")
177
- xml.docidentifier iso_id_reference(params).urn, **attr_code(type: "URN")
173
+ add_noko_elem(xml, "docidentifier",
174
+ iso_id_default(params).to_s(with_prf:),
175
+ **attr_code(type: "ISO", primary: "true"))
176
+ add_noko_elem(xml, "docidentifier", iso_id_reference(params)
177
+ .to_s(format: :ref_num_short, with_prf:),
178
+ **attr_code(type: "iso-reference"))
179
+ add_noko_elem(xml, "docidentifier", iso_id_reference(params).urn,
180
+ **attr_code(type: "URN"))
178
181
  end
179
182
 
180
183
  def iso_id_out_non_amd(xml, params, with_prf)
181
- xml.docidentifier iso_id_undated(params).to_s(with_prf:),
182
- **attr_code(type: "iso-undated")
183
- xml.docidentifier iso_id_with_lang(params)
184
- .to_s(format: :ref_num_long, with_prf:),
185
- **attr_code(type: "iso-with-lang")
184
+ add_noko_elem(xml, "docidentifier",
185
+ iso_id_undated(params).to_s(with_prf:),
186
+ **attr_code(type: "iso-undated"))
187
+ add_noko_elem(xml, "docidentifier",
188
+ iso_id_with_lang(params).to_s(format: :ref_num_long, with_prf:),
189
+ **attr_code(type: "iso-with-lang"))
186
190
  end
187
191
 
188
192
  def iso_id_default(params)
@@ -216,7 +220,7 @@ module Metanorma
216
220
  node.attr("docnumber") or return
217
221
  part, subpart = node.attr("partnumber")&.split("-")
218
222
  xml.structuredidentifier do |i|
219
- i.project_number(node.attr("docnumber"), **attr_code(
223
+ add_noko_elem(i, "project-number", node.attr("docnumber"), **attr_code(
220
224
  part:, subpart:,
221
225
  amendment: node.attr("amendment-number"),
222
226
  corrigendum: node.attr("corrigendum-number"),
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- VERSION v2.1.3 -->
3
+ <!-- VERSION v2.1.4 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -905,15 +905,32 @@ titlecase, or lowercase</a:documentation>
905
905
  </element>
906
906
  </define>
907
907
  <define name="image" combine="choice">
908
- <element name="svg">
909
- <a:documentation>Add svg mark up to image</a:documentation>
910
- <oneOrMore>
911
- <choice>
912
- <text/>
913
- <ref name="AnyElement"/>
914
- </choice>
915
- </oneOrMore>
916
- </element>
908
+ <choice>
909
+ <element name="image">
910
+ <ref name="RequiredId"/>
911
+ <ref name="ImageAttributes"/>
912
+ <optional>
913
+ <element name="svg">
914
+ <a:documentation>Allow svg in image/svg, for consistency</a:documentation>
915
+ <oneOrMore>
916
+ <choice>
917
+ <text/>
918
+ <ref name="AnyElement"/>
919
+ </choice>
920
+ </oneOrMore>
921
+ </element>
922
+ </optional>
923
+ </element>
924
+ <element name="svg">
925
+ <a:documentation>Add svg mark up to image</a:documentation>
926
+ <oneOrMore>
927
+ <choice>
928
+ <text/>
929
+ <ref name="AnyElement"/>
930
+ </choice>
931
+ </oneOrMore>
932
+ </element>
933
+ </choice>
917
934
  </define>
918
935
  <define name="ParagraphFnBody" combine="interleave">
919
936
  <ref name="BlockSource">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.2.0".freeze
3
+ VERSION = "3.2.1".freeze
4
4
  end
5
5
  end
@@ -16,6 +16,46 @@ nametemplate:
16
16
  # etal_count: 5
17
17
  seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|({{series_partnumber}}){%endif%}"
18
18
  journaltemplate: "<em>{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %}</em> ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
19
+
20
+ citetemplate:
21
+ short:
22
+ standard: "{% if home_standard %}<em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }}{% else %}{{ creatornames | selective_upcase }}$$$ <em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }} $$$ {{ labels['version'] | capitalize }}_{{ edition_raw }}$$$ {{labels['updated'] | capitalize }}_{{date_updated}}$$$ {{status | capitalize}}$$$ {{ authorizer }}{% endif %}"
23
+ website: "{{ creatornames | selective_upcase }}$$$ ({{ role }}) <em><span_class='stddocTitle'>{{ title }}</span></em> [{{ labels['website'] }}]$$$ {{ labels['version'] | capitalize }}_{{ edition_raw }}$$$ {{place}}: {{ publisher }}$$$ {{date}}"
24
+ book: "{{ creatornames | selective_upcase }}$$$ ({{role}}) <em>{{ title }}</em> $$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}:{%endif%} {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
25
+ booklet: book
26
+ manual: book
27
+ techreport: book
28
+ proceedings: book
29
+ inbook: "{{ creatornames | selective_upcase }}$$$ ({{role}}) {{ title }} $$$ <em>{{host_title}}</em> ({{host_role}} {{ host_creatornames | replace: '+++', ''}}) $$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}:{%endif%} {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
30
+ inproceedings: inbook
31
+ incollection: inbook
32
+ journal: "<em>{{ title}}</em> $$$ {{ edition | capitalize_first }}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
33
+ article: "{{ creatornames | selective_upcase }}$$$ ({{role}}) {{ title }}$$$ {{ series }} $$$ {{date}}, {{ extent }}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}"
34
+ software: "{{ creatornames | selective_upcase }}$$$ ({{ role}}) <em>{{ title }}</em> $$$ {{ labels['version'] | capitalize }}_{{ edition_raw }}$$$ {{medium | capitalize}}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
35
+ electronic resource: software
36
+ dataset: "{{ creatornames | selective_upcase }}$$$ ({{ role }}) <em>{{ title }}</em> $$$ {{ labels['version'] | capitalize }}_{{ edition_raw }}$$$ {{medium | capitalize }}$$$ {{ labels['in'] | capitalize }}:_{{series}}$$$ {{date}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ {{ authoritative_identifier | join '$$$ ' }}$$$ {{ other_identifier | join '$$$ ' }}"
37
+ webresource: website
38
+ unpublished: "{{ creatornames | selective_upcase }}$$$ ({{ role }}) <em>{{ title }}</em> $$$ {{ medium | capitalize }}$$$ {{ date }}$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}"
39
+ presentation: unpublished
40
+ thesis: "{{ creatornames | selective_upcase }}$$$ ({{ role }}) <em>{{ title }}</em> $$$ {{ medium | capitalize }}$$$ {{place}}: {{ publisher }}$$$ {{ date }}"
41
+ misc: "{{ creatornames | selective_upcase }}$$$ ({{ role }}) <em>{{ title }}</em> $$$ {{ date }}$$$"
42
+ # following are # unsupported types:
43
+ map: misc
44
+ audiovisual: misc
45
+ film: misc
46
+ video: misc
47
+ broadcast: misc
48
+ graphic_work: misc
49
+ music: misc
50
+ performance: misc
51
+ patent: misc
52
+ archival: misc
53
+ social_media: misc
54
+ alert: misc
55
+ message: misc
56
+ conversation: misc
57
+ internal: misc
58
+
19
59
  template:
20
60
  # skip standardidentifier, it is inserted in front of formattedref within metanorma
21
61
  standard: "{% if home_standard %}<em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }}{% else %}{{ creatornames | selective_upcase }}$$$ <em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }} $$$ {{ labels['version'] | capitalize }}_{{ edition_raw }}$$$ {{labels['updated'] | capitalize }}_{{date_updated}}$$$ {{status | capitalize}}$$$ {{ authorizer }}$$$ {{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$${% endif %}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-03 00:00:00.000000000 Z
11
+ date: 2025-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -352,6 +352,7 @@ files:
352
352
  - lib/isodoc/iso/metadata.rb
353
353
  - lib/isodoc/iso/pdf_convert.rb
354
354
  - lib/isodoc/iso/presentation_bibdata.rb
355
+ - lib/isodoc/iso/presentation_origin.rb
355
356
  - lib/isodoc/iso/presentation_section.rb
356
357
  - lib/isodoc/iso/presentation_terms.rb
357
358
  - lib/isodoc/iso/presentation_xml_convert.rb