metanorma-iso 3.0.6 → 3.0.7

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: fd0358f94bbae1d6d9701a3fc7e65a4e13023aa367d7b790816361544c44f4a4
4
- data.tar.gz: f79b87d35cdebb5111e9d97b8ca8af7e4d7334c1aaaa3b13813f2b3813c373c3
3
+ metadata.gz: 0c7bab3dbfa462338c0831dc29e08bd0ea7c167a47821c35e95b4cfe5c7bda66
4
+ data.tar.gz: 37021d7613f8c97e75d5b5e47f915c5854d0cd89d789ab5e86b41418887afe8c
5
5
  SHA512:
6
- metadata.gz: b8c623bbbf2c8238d3cf712a21d8f7941968464cfa979947db054331d54b9185db422154f318efb3b339e7cabdc37824de0e2b1014a3b97267663b791fd2559c
7
- data.tar.gz: d98155a8922bafdac24a604144b3f6436dc426aea949a4142425fc1df2e699aae57a58f29228af36a2699f72fb003e5640c2732508a352a103b42418119354a2
6
+ metadata.gz: 8e36f66e9ed5341fc0a32aa16898faae89c5e195a86175d8b626a2ed3c8912ada63f20e161fd21bd42f792f5fe84078cc903abf1ae289cb8981a6e2ea0eb84af
7
+ data.tar.gz: cf388a36ab160cc3e4b5ece2d6e10d25a7508167f7f101a1ffebf0537d0d5b0747106db346625ce13f17554baf6ec8f1e362ae289320e3bd889c6b841da822f8
@@ -117,7 +117,7 @@ module IsoDoc
117
117
  num = num + 1
118
118
  clause_name(clause, clause&.at(ns("./fmt-title")), div, nil)
119
119
  clause.elements.each do |e|
120
- parse(e, div) unless %w{fmt-title source}.include? e.name
120
+ parse(e, div) unless %w{fmt-title fmt-source}.include? e.name
121
121
  end
122
122
  end
123
123
  end
@@ -139,7 +139,7 @@ module IsoDoc
139
139
 
140
140
  def table_parse_tail(node, out)
141
141
  (dl = node.at(ns("./dl"))) && parse(dl, out)
142
- node.xpath(ns("./source")).each { |n| parse(n, out) }
142
+ node.xpath(ns("./fmt-source")).each { |n| parse(n, out) }
143
143
  node.xpath(ns("./note[not(@type = 'units')]")).each do |n|
144
144
  parse(n, out)
145
145
  end
@@ -3497,61 +3497,69 @@
3497
3497
  <xsl:template match="iso:bibdata/iso:title[@type = 'title-part']">
3498
3498
  <xsl:param name="curr_lang" select="$lang"/>
3499
3499
  <xsl:param name="isMainLang">false</xsl:param>
3500
- <xsl:if test="$part != ''">
3501
- <!-- <xsl:text> </xsl:text> -->
3502
- <xsl:choose>
3503
- <xsl:when test="$layoutVersion = '1951'"/>
3504
- <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3505
- </xsl:choose>
3506
- <xsl:variable name="part-word">
3500
+ <xsl:choose>
3501
+ <xsl:when test="$part != ''">
3502
+ <!-- <xsl:text> — </xsl:text> -->
3507
3503
  <xsl:choose>
3508
- <xsl:when test="$isMainLang = 'true'">
3509
- <xsl:value-of select="concat($i18n_locality_part, ' ', $part, ':')"/>
3510
- </xsl:when>
3511
- <xsl:otherwise>
3512
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part)"/>
3513
- </xsl:otherwise>
3504
+ <xsl:when test="$layoutVersion = '1951'"/>
3505
+ <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3514
3506
  </xsl:choose>
3515
- </xsl:variable>
3516
- <xsl:choose>
3517
- <xsl:when test="$isMainLang = 'true'">
3507
+ <xsl:variable name="part-word">
3518
3508
  <xsl:choose>
3519
- <xsl:when test="$layoutVersion = '1951'">
3520
- <xsl:value-of select="$part-word"/>
3521
- <xsl:apply-templates/>
3509
+ <xsl:when test="$isMainLang = 'true'">
3510
+ <xsl:value-of select="concat($i18n_locality_part, ' ', $part, ':')"/>
3522
3511
  </xsl:when>
3523
- <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'">
3524
- <fo:block font-weight="bold" role="SKIP">
3512
+ <xsl:otherwise>
3513
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part)"/>
3514
+ </xsl:otherwise>
3515
+ </xsl:choose>
3516
+ </xsl:variable>
3517
+ <xsl:choose>
3518
+ <xsl:when test="$isMainLang = 'true'">
3519
+ <xsl:choose>
3520
+ <xsl:when test="$layoutVersion = '1951'">
3525
3521
  <xsl:value-of select="$part-word"/>
3526
- <xsl:text> </xsl:text>
3527
3522
  <xsl:apply-templates/>
3528
- </fo:block>
3529
- </xsl:when>
3530
- <xsl:when test="$layoutVersion = '1987'">
3531
- <fo:block font-weight="bold" margin-top="12pt" role="SKIP">
3523
+ </xsl:when>
3524
+ <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'">
3525
+ <fo:block font-weight="bold" role="SKIP">
3526
+ <xsl:value-of select="$part-word"/>
3527
+ <xsl:text> </xsl:text>
3528
+ <xsl:apply-templates/>
3529
+ </fo:block>
3530
+ </xsl:when>
3531
+ <xsl:when test="$layoutVersion = '1987'">
3532
+ <fo:block font-weight="bold" margin-top="12pt" role="SKIP">
3533
+ <xsl:value-of select="$part-word"/>
3534
+ </fo:block>
3535
+ </xsl:when>
3536
+ <xsl:otherwise>
3537
+ <fo:block font-weight="normal" margin-top="6pt" role="SKIP">
3532
3538
  <xsl:value-of select="$part-word"/>
3533
3539
  </fo:block>
3534
- </xsl:when>
3535
- <xsl:otherwise>
3536
- <fo:block font-weight="normal" margin-top="6pt" role="SKIP">
3537
- <xsl:value-of select="$part-word"/>
3538
- </fo:block>
3539
- </xsl:otherwise>
3540
- </xsl:choose>
3541
- </xsl:when>
3542
- <xsl:otherwise>
3543
- <!-- <xsl:value-of select="$linebreak"/> -->
3544
- <xsl:choose>
3545
- <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'"/>
3546
- <xsl:otherwise>
3547
- <fo:block font-size="1pt" margin-top="5pt" role="SKIP"> </fo:block>
3548
- </xsl:otherwise>
3549
- </xsl:choose>
3550
- <xsl:value-of select="$part-word"/>
3551
- <xsl:text> </xsl:text>
3552
- </xsl:otherwise>
3553
- </xsl:choose>
3554
- </xsl:if>
3540
+ </xsl:otherwise>
3541
+ </xsl:choose>
3542
+ </xsl:when>
3543
+ <xsl:otherwise>
3544
+ <!-- <xsl:value-of select="$linebreak"/> -->
3545
+ <xsl:choose>
3546
+ <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'"/>
3547
+ <xsl:otherwise>
3548
+ <fo:block font-size="1pt" margin-top="5pt" role="SKIP"> </fo:block>
3549
+ </xsl:otherwise>
3550
+ </xsl:choose>
3551
+ <xsl:value-of select="$part-word"/>
3552
+ <xsl:text> </xsl:text>
3553
+ </xsl:otherwise>
3554
+ </xsl:choose>
3555
+ </xsl:when>
3556
+ <xsl:otherwise> <!-- $part = '' -->
3557
+ <xsl:choose>
3558
+ <xsl:when test="$layoutVersion = '1951'"/>
3559
+ <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3560
+ </xsl:choose>
3561
+ </xsl:otherwise>
3562
+ </xsl:choose>
3555
3563
  <xsl:choose>
3556
3564
  <xsl:when test="$layoutVersion = '1951'"><fo:inline font-weight="normal"><xsl:apply-templates/></fo:inline></xsl:when>
3557
3565
  <xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'true'"/>
@@ -14502,11 +14510,11 @@
14502
14510
  </xsl:template>
14503
14511
 
14504
14512
  <!-- figure/fn -->
14505
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
14513
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'fn']" priority="2"/>
14506
14514
  <!-- figure/note -->
14507
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14515
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'note']" priority="2"/>
14508
14516
  <!-- figure/example -->
14509
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
14517
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'example']" priority="2"/>
14510
14518
 
14511
14519
  <!-- figure/note[@type = 'units'] -->
14512
14520
  <!-- image/note[@type = 'units'] -->
@@ -18077,6 +18085,9 @@
18077
18085
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_pres"/>
18078
18086
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_step1"/>
18079
18087
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_pres"/>
18088
+ <!-- https://github.com/metanorma/isodoc/issues/687 -->
18089
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_step1"/>
18090
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_pres"/>
18080
18091
 
18081
18092
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
18082
18093
  <xsl:copy>
@@ -18394,6 +18405,20 @@
18394
18405
  </xsl:element>
18395
18406
  </xsl:template>
18396
18407
 
18408
+ <xsl:template match="*[local-name() = 'fmt-source']"/>
18409
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_step1">
18410
+ <xsl:element name="source" namespace="{$namespace_full}">
18411
+ <xsl:copy-of select="@*"/>
18412
+ <xsl:apply-templates mode="update_xml_step1"/>
18413
+ </xsl:element>
18414
+ </xsl:template>
18415
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_pres">
18416
+ <xsl:element name="source" namespace="{$namespace_full}">
18417
+ <xsl:copy-of select="@*"/>
18418
+ <xsl:apply-templates mode="update_xml_pres"/>
18419
+ </xsl:element>
18420
+ </xsl:template>
18421
+
18397
18422
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
18398
18423
  <xsl:apply-templates mode="update_xml_step1"/>
18399
18424
  </xsl:template>
@@ -3497,61 +3497,69 @@
3497
3497
  <xsl:template match="iso:bibdata/iso:title[@type = 'title-part']">
3498
3498
  <xsl:param name="curr_lang" select="$lang"/>
3499
3499
  <xsl:param name="isMainLang">false</xsl:param>
3500
- <xsl:if test="$part != ''">
3501
- <!-- <xsl:text> </xsl:text> -->
3502
- <xsl:choose>
3503
- <xsl:when test="$layoutVersion = '1951'"/>
3504
- <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3505
- </xsl:choose>
3506
- <xsl:variable name="part-word">
3500
+ <xsl:choose>
3501
+ <xsl:when test="$part != ''">
3502
+ <!-- <xsl:text> — </xsl:text> -->
3507
3503
  <xsl:choose>
3508
- <xsl:when test="$isMainLang = 'true'">
3509
- <xsl:value-of select="concat($i18n_locality_part, ' ', $part, ':')"/>
3510
- </xsl:when>
3511
- <xsl:otherwise>
3512
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part)"/>
3513
- </xsl:otherwise>
3504
+ <xsl:when test="$layoutVersion = '1951'"/>
3505
+ <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3514
3506
  </xsl:choose>
3515
- </xsl:variable>
3516
- <xsl:choose>
3517
- <xsl:when test="$isMainLang = 'true'">
3507
+ <xsl:variable name="part-word">
3518
3508
  <xsl:choose>
3519
- <xsl:when test="$layoutVersion = '1951'">
3520
- <xsl:value-of select="$part-word"/>
3521
- <xsl:apply-templates/>
3509
+ <xsl:when test="$isMainLang = 'true'">
3510
+ <xsl:value-of select="concat($i18n_locality_part, ' ', $part, ':')"/>
3522
3511
  </xsl:when>
3523
- <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'">
3524
- <fo:block font-weight="bold" role="SKIP">
3512
+ <xsl:otherwise>
3513
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part)"/>
3514
+ </xsl:otherwise>
3515
+ </xsl:choose>
3516
+ </xsl:variable>
3517
+ <xsl:choose>
3518
+ <xsl:when test="$isMainLang = 'true'">
3519
+ <xsl:choose>
3520
+ <xsl:when test="$layoutVersion = '1951'">
3525
3521
  <xsl:value-of select="$part-word"/>
3526
- <xsl:text> </xsl:text>
3527
3522
  <xsl:apply-templates/>
3528
- </fo:block>
3529
- </xsl:when>
3530
- <xsl:when test="$layoutVersion = '1987'">
3531
- <fo:block font-weight="bold" margin-top="12pt" role="SKIP">
3523
+ </xsl:when>
3524
+ <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'">
3525
+ <fo:block font-weight="bold" role="SKIP">
3526
+ <xsl:value-of select="$part-word"/>
3527
+ <xsl:text> </xsl:text>
3528
+ <xsl:apply-templates/>
3529
+ </fo:block>
3530
+ </xsl:when>
3531
+ <xsl:when test="$layoutVersion = '1987'">
3532
+ <fo:block font-weight="bold" margin-top="12pt" role="SKIP">
3533
+ <xsl:value-of select="$part-word"/>
3534
+ </fo:block>
3535
+ </xsl:when>
3536
+ <xsl:otherwise>
3537
+ <fo:block font-weight="normal" margin-top="6pt" role="SKIP">
3532
3538
  <xsl:value-of select="$part-word"/>
3533
3539
  </fo:block>
3534
- </xsl:when>
3535
- <xsl:otherwise>
3536
- <fo:block font-weight="normal" margin-top="6pt" role="SKIP">
3537
- <xsl:value-of select="$part-word"/>
3538
- </fo:block>
3539
- </xsl:otherwise>
3540
- </xsl:choose>
3541
- </xsl:when>
3542
- <xsl:otherwise>
3543
- <!-- <xsl:value-of select="$linebreak"/> -->
3544
- <xsl:choose>
3545
- <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'"/>
3546
- <xsl:otherwise>
3547
- <fo:block font-size="1pt" margin-top="5pt" role="SKIP"> </fo:block>
3548
- </xsl:otherwise>
3549
- </xsl:choose>
3550
- <xsl:value-of select="$part-word"/>
3551
- <xsl:text> </xsl:text>
3552
- </xsl:otherwise>
3553
- </xsl:choose>
3554
- </xsl:if>
3540
+ </xsl:otherwise>
3541
+ </xsl:choose>
3542
+ </xsl:when>
3543
+ <xsl:otherwise>
3544
+ <!-- <xsl:value-of select="$linebreak"/> -->
3545
+ <xsl:choose>
3546
+ <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'"/>
3547
+ <xsl:otherwise>
3548
+ <fo:block font-size="1pt" margin-top="5pt" role="SKIP"> </fo:block>
3549
+ </xsl:otherwise>
3550
+ </xsl:choose>
3551
+ <xsl:value-of select="$part-word"/>
3552
+ <xsl:text> </xsl:text>
3553
+ </xsl:otherwise>
3554
+ </xsl:choose>
3555
+ </xsl:when>
3556
+ <xsl:otherwise> <!-- $part = '' -->
3557
+ <xsl:choose>
3558
+ <xsl:when test="$layoutVersion = '1951'"/>
3559
+ <xsl:otherwise><xsl:text> — </xsl:text></xsl:otherwise>
3560
+ </xsl:choose>
3561
+ </xsl:otherwise>
3562
+ </xsl:choose>
3555
3563
  <xsl:choose>
3556
3564
  <xsl:when test="$layoutVersion = '1951'"><fo:inline font-weight="normal"><xsl:apply-templates/></fo:inline></xsl:when>
3557
3565
  <xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'true'"/>
@@ -14502,11 +14510,11 @@
14502
14510
  </xsl:template>
14503
14511
 
14504
14512
  <!-- figure/fn -->
14505
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
14513
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'fn']" priority="2"/>
14506
14514
  <!-- figure/note -->
14507
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14515
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'note']" priority="2"/>
14508
14516
  <!-- figure/example -->
14509
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
14517
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'example']" priority="2"/>
14510
14518
 
14511
14519
  <!-- figure/note[@type = 'units'] -->
14512
14520
  <!-- image/note[@type = 'units'] -->
@@ -18077,6 +18085,9 @@
18077
18085
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_pres"/>
18078
18086
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_step1"/>
18079
18087
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_pres"/>
18088
+ <!-- https://github.com/metanorma/isodoc/issues/687 -->
18089
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_step1"/>
18090
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_pres"/>
18080
18091
 
18081
18092
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
18082
18093
  <xsl:copy>
@@ -18394,6 +18405,20 @@
18394
18405
  </xsl:element>
18395
18406
  </xsl:template>
18396
18407
 
18408
+ <xsl:template match="*[local-name() = 'fmt-source']"/>
18409
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_step1">
18410
+ <xsl:element name="source" namespace="{$namespace_full}">
18411
+ <xsl:copy-of select="@*"/>
18412
+ <xsl:apply-templates mode="update_xml_step1"/>
18413
+ </xsl:element>
18414
+ </xsl:template>
18415
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_pres">
18416
+ <xsl:element name="source" namespace="{$namespace_full}">
18417
+ <xsl:copy-of select="@*"/>
18418
+ <xsl:apply-templates mode="update_xml_pres"/>
18419
+ </xsl:element>
18420
+ </xsl:template>
18421
+
18397
18422
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
18398
18423
  <xsl:apply-templates mode="update_xml_step1"/>
18399
18424
  </xsl:template>
@@ -11,7 +11,7 @@ module IsoDoc
11
11
  concept_term(docxml)
12
12
  (docxml.xpath(ns("//concept")) - docxml.xpath(ns("//term//concept")))
13
13
  .each do |node|
14
- node.ancestors("definition, termsource, related").empty? and
14
+ node.ancestors("definition, source, related").empty? and
15
15
  concept_render(node, ital: "false", ref: "false",
16
16
  linkref: "true", linkmention: "false")
17
17
  end
@@ -22,7 +22,7 @@ module IsoDoc
22
22
  m = {}
23
23
  (f.xpath(ns(".//concept")) - f.xpath(ns(".//term//concept")))
24
24
  .each do |c|
25
- c.ancestors("definition, termsource, related").empty? and
25
+ c.ancestors("definition, source, related").empty? and
26
26
  concept_term1(c, m)
27
27
  end
28
28
  end
@@ -236,7 +236,7 @@ module IsoDoc
236
236
 
237
237
  def table_parse_tail(node, out)
238
238
  (dl = node.at(ns("./dl"))) && parse(dl, out)
239
- node.xpath(ns("./source")).each { |n| parse(n, out) }
239
+ node.xpath(ns("./fmt-source")).each { |n| parse(n, out) }
240
240
  node.xpath(ns("./note[not(@type = 'units')]"))
241
241
  .each { |n| parse(n, out) }
242
242
  node.xpath(ns("./fmt-footnote-container/fmt-fn-body"))
@@ -65,9 +65,8 @@ module Metanorma
65
65
  end
66
66
 
67
67
  def ol_attrs(node)
68
- attr_code(keep_attrs(node)
69
- .merge(id: ::Metanorma::Utils::anchor_or_uuid(node),
70
- "explicit-type": olist_style(node.attributes[1]),
68
+ attr_code(keep_attrs(node).merge(id_attr(node))
69
+ .merge("explicit-type": olist_style(node.attributes[1]),
71
70
  start: node.attr("start")))
72
71
  end
73
72
 
@@ -267,6 +267,10 @@ in a document (e.g. sourcecode annotations)</a:documentation>
267
267
  <value>justified</value>
268
268
  </choice>
269
269
  </define>
270
+ <define name="IdRefType">
271
+ <a:documentation>Type of cross-references to elements. In BasicDoc, these always point to id { xsd:ID } </a:documentation>
272
+ <data type="IDREF"/>
273
+ </define>
270
274
  <define name="RequiredId">
271
275
  <a:documentation>Mandatory anchor of element, to be used for cross-references within the document</a:documentation>
272
276
  <attribute name="id">
@@ -409,13 +413,13 @@ in a document (e.g. sourcecode annotations)</a:documentation>
409
413
  <attribute name="from">
410
414
  <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
411
415
  If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
412
- <data type="IDREF"/>
416
+ <ref name="IdRefType"/>
413
417
  </attribute>
414
418
  </optional>
415
419
  <optional>
416
420
  <attribute name="to">
417
421
  <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
418
- <data type="IDREF"/>
422
+ <ref name="IdRefType"/>
419
423
  </attribute>
420
424
  </optional>
421
425
  </define>
@@ -1504,7 +1508,7 @@ Restricted recursively to contain only other such inline elements with no identi
1504
1508
  <attribute name="to">
1505
1509
  <a:documentation>A reference to an anchor element (typically a bookmark),
1506
1510
  to indicate that the index range covers a range of locations between the current index element and the `to` anchor</a:documentation>
1507
- <data type="IDREF"/>
1511
+ <ref name="IdRefType"/>
1508
1512
  </attribute>
1509
1513
  </optional>
1510
1514
  <ref name="index-primary">
@@ -1662,7 +1666,7 @@ which can be bookmarks as well as block or section references</a:documentation>
1662
1666
  <define name="XrefAttributes">
1663
1667
  <attribute name="target">
1664
1668
  <a:documentation>The identifier of a section, block or inlined element being referenced</a:documentation>
1665
- <data type="IDREF"/>
1669
+ <ref name="IdRefType"/>
1666
1670
  </attribute>
1667
1671
  <optional>
1668
1672
  <attribute name="type">
@@ -1723,7 +1727,7 @@ The target of a footnote is the location it is embedded in within the text</a:do
1723
1727
  <attribute name="target">
1724
1728
  <a:documentation>The target of the callout is understood to be the location of the callout within the source code;
1725
1729
  the extent of the target is not expressed overtly</a:documentation>
1726
- <data type="IDREF"/>
1730
+ <ref name="IdRefType"/>
1727
1731
  </attribute>
1728
1732
  <text>
1729
1733
  <a:documentation>The label of the callout, used to identify its target within the source code</a:documentation>
@@ -69,7 +69,7 @@ module Metanorma
69
69
 
70
70
  def unpub_footnotes(xmldoc)
71
71
  xmldoc.xpath("//bibitem/note[@type = 'Unpublished-Status']").each do |n|
72
- e = xmldoc.at("//eref[@bibitemid = '#{n.parent['id']}']") or next
72
+ e = xmldoc.at("//eref[@bibitemid = '#{n.parent['anchor']}']") or next
73
73
  fn = n.children.to_xml
74
74
  n.elements&.first&.name == "p" or fn = "<p>#{fn}</p>"
75
75
  e.next = "<fn>#{fn}</fn>"
@@ -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.0.4 -->
3
+ <!-- VERSION v2.0.5 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -36,6 +36,12 @@
36
36
  </zeroOrMore>
37
37
  </element>
38
38
  </define>
39
+ <define name="IdRefType">
40
+ <a:documentation>Cross-references are not normalised to xsd:IDREF in Semantic XML: that is deferred to Presentation XML.
41
+ All IdRefType instances point not to `@id` in Semantic XML, which is the Content GUID for an element,
42
+ but to `@anchor`, the user-supplied cross-reference</a:documentation>
43
+ <text/>
44
+ </define>
39
45
  <define name="index-primary">
40
46
  <element name="primary">
41
47
  <oneOrMore>
@@ -238,7 +244,7 @@
238
244
  <a:documentation>Notes specific to this block</a:documentation>
239
245
  </ref>
240
246
  </zeroOrMore>
241
- <ref name="TermSource">
247
+ <ref name="BlockSource">
242
248
  <a:documentation>A source for the table</a:documentation>
243
249
  </ref>
244
250
  </define>
@@ -262,10 +268,112 @@ and is intended to be referenced by a callout within the source code</a:document
262
268
  <a:documentation>Notes whose scope is the current block</a:documentation>
263
269
  </ref>
264
270
  </zeroOrMore>
265
- <ref name="TermSource">
271
+ <ref name="BlockSource">
272
+ <a:documentation>A source for the block</a:documentation>
273
+ </ref>
274
+ </define>
275
+ <define name="FigureBody">
276
+ <optional>
277
+ <ref name="tname">
278
+ <a:documentation>The caption of the block</a:documentation>
279
+ </ref>
280
+ </optional>
281
+ <choice>
282
+ <a:documentation>Content of the figure</a:documentation>
283
+ <ref name="image"/>
284
+ <ref name="video"/>
285
+ <ref name="audio"/>
286
+ <ref name="pre"/>
287
+ <oneOrMore>
288
+ <ref name="paragraph-with-footnote"/>
289
+ </oneOrMore>
290
+ <zeroOrMore>
291
+ <ref name="figure"/>
292
+ </zeroOrMore>
293
+ </choice>
294
+ <zeroOrMore>
295
+ <ref name="fn">
296
+ <a:documentation>Footnotes specific to the figure</a:documentation>
297
+ </ref>
298
+ </zeroOrMore>
299
+ <optional>
300
+ <ref name="dl">
301
+ <a:documentation>An optional definitions list defining any symbols used in the figure</a:documentation>
302
+ </ref>
303
+ </optional>
304
+ <zeroOrMore>
305
+ <ref name="note">
306
+ <a:documentation>Notes whose scope is the current block</a:documentation>
307
+ </ref>
308
+ </zeroOrMore>
309
+ <ref name="BlockSource">
266
310
  <a:documentation>A source for the block</a:documentation>
267
311
  </ref>
268
312
  </define>
313
+ <define name="FigureNoIdBody">
314
+ <optional>
315
+ <ref name="source">
316
+ <a:documentation>A URI or other reference intended to link to an externally hosted image (or equivalent)</a:documentation>
317
+ </ref>
318
+ </optional>
319
+ <optional>
320
+ <ref name="tname">
321
+ <a:documentation>The caption of the block</a:documentation>
322
+ </ref>
323
+ </optional>
324
+ <choice>
325
+ <a:documentation>Content of the figure</a:documentation>
326
+ <ref name="image-no-id"/>
327
+ <ref name="video-no-id"/>
328
+ <ref name="audio-no-id"/>
329
+ <ref name="pre-no-id"/>
330
+ <oneOrMore>
331
+ <ref name="paragraph-with-footnote-no-id"/>
332
+ </oneOrMore>
333
+ <zeroOrMore>
334
+ <ref name="figure-no-id"/>
335
+ </zeroOrMore>
336
+ </choice>
337
+ <zeroOrMore>
338
+ <ref name="fn">
339
+ <a:documentation>Footnotes specific to the figure</a:documentation>
340
+ </ref>
341
+ </zeroOrMore>
342
+ <optional>
343
+ <ref name="dl-no-id">
344
+ <a:documentation>An optional definitions list defining any symbols used in the figure</a:documentation>
345
+ </ref>
346
+ </optional>
347
+ <zeroOrMore>
348
+ <ref name="note-no-id">
349
+ <a:documentation>Notes whose scope is the current block</a:documentation>
350
+ </ref>
351
+ </zeroOrMore>
352
+ <ref name="BlockSource">
353
+ <a:documentation>A source for the block</a:documentation>
354
+ </ref>
355
+ </define>
356
+ <define name="source">
357
+ <element name="source">
358
+ <attribute name="status">
359
+ <a:documentation>The status of the term as it is used in this document, relative to its definition in the original document</a:documentation>
360
+ <ref name="SourceStatusType"/>
361
+ </attribute>
362
+ <attribute name="type">
363
+ <a:documentation>The type of the managed term in the present context</a:documentation>
364
+ <ref name="SourceTypeType"/>
365
+ </attribute>
366
+ <ref name="origin">
367
+ <a:documentation>The original document and location where the term definition has been obtained from</a:documentation>
368
+ </ref>
369
+ <optional>
370
+ <ref name="modification">
371
+ <a:documentation>Any changes that the definition of the term has undergone relative to the original document,
372
+ in order to be applicable in this standardisation document</a:documentation>
373
+ </ref>
374
+ </optional>
375
+ </element>
376
+ </define>
269
377
  <define name="sourcecodebody">
270
378
  <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
271
379
  (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
@@ -687,6 +795,20 @@ titlecase, or lowercase</a:documentation>
687
795
  </attribute>
688
796
  </optional>
689
797
  </define>
798
+ <define name="RequiredId" combine="interleave">
799
+ <optional>
800
+ <attribute name="anchor">
801
+ <a:documentation>User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
802
+ </attribute>
803
+ </optional>
804
+ </define>
805
+ <define name="OptionalId" combine="interleave">
806
+ <optional>
807
+ <attribute name="anchor">
808
+ <a:documentation> User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
809
+ </attribute>
810
+ </optional>
811
+ </define>
690
812
  <define name="ObligationType">
691
813
  <a:documentation>The force of a clause in a standard document: whether it has normative or informative effect</a:documentation>
692
814
  <choice>
@@ -1081,7 +1203,7 @@ That concept may be defined as a term within the current document, or it may be
1081
1203
  <element name="label">
1082
1204
  <!-- Identifier of form input element that this element is a label of -->
1083
1205
  <attribute name="for">
1084
- <data type="IDREF"/>
1206
+ <ref name="IdRefType"/>
1085
1207
  </attribute>
1086
1208
  <zeroOrMore>
1087
1209
  <ref name="PureTextElement"/>
@@ -2121,7 +2243,7 @@ used in document amendments</a:documentation>
2121
2243
  </define>
2122
2244
  <define name="termsource">
2123
2245
  <a:documentation>The bibliographic source where a term is defined in the sense applicable in this standardisation document</a:documentation>
2124
- <element name="termsource">
2246
+ <element name="source">
2125
2247
  <attribute name="status">
2126
2248
  <a:documentation>The status of the term as it is used in this document, relative to its definition in the original document</a:documentation>
2127
2249
  <ref name="SourceStatusType"/>
@@ -2503,6 +2625,11 @@ Normative References contents contain normative references, but as a clause in t
2503
2625
  <ref name="termsource"/>
2504
2626
  </zeroOrMore>
2505
2627
  </define>
2628
+ <define name="BlockSource">
2629
+ <zeroOrMore>
2630
+ <ref name="source"/>
2631
+ </zeroOrMore>
2632
+ </define>
2506
2633
  <start>
2507
2634
  <ref name="standard-document"/>
2508
2635
  </start>
@@ -25,16 +25,15 @@ module Metanorma
25
25
  end
26
26
  end
27
27
 
28
- # ISO/IEC DIR 2, 15.5.3, 20.2
29
- # does not deal with preceding text marked up
30
- def see_xrefs_validate(root)
28
+ # KILL
29
+ def see_xrefs_validatex(root)
31
30
  @lang == "en" or return
32
31
  root.xpath("//xref").each do |t|
33
32
  preceding = t.at("./preceding-sibling::text()[last()]")
34
- next unless !preceding.nil? &&
35
- /\b(see| refer to)\p{Zs}*\Z/mi.match(preceding)
33
+ !preceding.nil? &&
34
+ /\b(see| refer to)\p{Zs}*\Z/mi.match(preceding) or next
36
35
 
37
- (target = root.at("//*[@id = '#{t['target']}']")) || next
36
+ (target = root.at("//*[@anchor = '#{t['target']}']")) || next
38
37
  target.at("./ancestor-or-self::*[@obligation = 'normative']") &&
39
38
  !target.at("./ancestor::sections") and
40
39
  @log.add("Style", t,
@@ -42,23 +41,65 @@ module Metanorma
42
41
  end
43
42
  end
44
43
 
44
+ # ISO/IEC DIR 2, 15.5.3, 20.2
45
+ # does not deal with preceding text marked up
46
+ def see_xrefs_validate(root)
47
+ @lang == "en" or return
48
+ anchors = extract_anchor_norm(root)
49
+ root.xpath("//xref").each do |t|
50
+ preceding = t.at("./preceding-sibling::text()[last()]")
51
+ !preceding.nil? &&
52
+ /\b(see| refer to)\p{Zs}*\Z/mi.match(preceding) or next
53
+ anchors[t["target"]] and
54
+ @log.add("Style", t,
55
+ "'see #{t['target']}' is pointing to a normative section")
56
+ end
57
+ end
58
+
59
+ def extract_anchor_norm(root)
60
+ nodes = root.xpath("//annex[@obligation = 'normative'] | " \
61
+ "//references[@obligation = 'normative']")
62
+ ret = nodes.each_with_object({}) do |n, m|
63
+ n["anchor"] and m[n["anchor"]] = true
64
+ end
65
+ nodes.each do |n|
66
+ n.xpath(".//*[@anchor]").each { |n1| ret[n1["anchor"]] = true }
67
+ end
68
+ ret
69
+ end
70
+
45
71
  # ISO/IEC DIR 2, 15.5.3
46
72
  def see_erefs_validate(root)
47
73
  @lang == "en" or return
74
+ bibitemids = extract_bibitem_anchors(root)
48
75
  root.xpath("//eref").each do |t|
49
76
  prec = t.at("./preceding-sibling::text()[last()]")
50
77
  !prec.nil? && /\b(see|refer to)\p{Zs}*\Z/mi.match(prec) or next
51
- unless target = root.at("//*[@id = '#{t['bibitemid']}']")
78
+ unless target = bibitemids[t["bibitemid"]]
79
+ #unless target = root.at("//bibitem[@anchor = '#{t['bibitemid']}']")
52
80
  @log.add("Bibliography", t,
53
81
  "'#{t} is not pointing to a real reference")
54
82
  next
55
83
  end
56
- target.at("./ancestor::references[@normative = 'true']") and
84
+ #target.at("./ancestor::references[@normative = 'true']") and
85
+ target[:norm] and
57
86
  @log.add("Style", t,
58
87
  "'see #{t}' is pointing to a normative reference")
59
88
  end
60
89
  end
61
90
 
91
+ def extract_bibitem_anchors(root)
92
+ ret = root.xpath("//references[@normative = 'true']//bibitem")
93
+ .each_with_object({}) do |b, m|
94
+ m[b["anchor"]] = { bib: b, norm: true }
95
+ end
96
+ root.xpath("//references[not(@normative = 'true')]//bibitem")
97
+ .each do |b|
98
+ ret[b["anchor"]] = { bib: b, norm: false }
99
+ end
100
+ ret
101
+ end
102
+
62
103
  # ISO/IEC DIR 2, 10.4
63
104
  def locality_erefs_validate(root)
64
105
  root.xpath("//eref[descendant::locality]").each do |t|
@@ -80,8 +121,8 @@ module Metanorma
80
121
  termids = xmldoc
81
122
  .xpath("//sections/terms | //sections/clause[.//terms] | " \
82
123
  "//annex[.//terms]").each_with_object({}) do |t, m|
83
- t.xpath(".//*/@id").each { |a| m[a.text] = true }
84
- t.name == "terms" and m[t["id"]] = true
124
+ t.xpath(".//*/@anchor").each { |a| m[a.text] = true }
125
+ t.name == "terms" and m[t["anchor"]] = true
85
126
  end
86
127
  xmldoc.xpath(".//xref").each do |x|
87
128
  term_xrefs_validate1(x, termids)
@@ -89,12 +130,12 @@ module Metanorma
89
130
  end
90
131
 
91
132
  def term_xrefs_validate1(xref, termids)
92
- closest_id = xref.xpath("./ancestor::*[@id]")&.last or return
93
- termids[xref["target"]] && !termids[closest_id["id"]] and
133
+ closest_id = xref.xpath("./ancestor::*[@anchor]")&.last or return
134
+ termids[xref["target"]] && !termids[closest_id["anchor"]] and
94
135
  @log.add("Style", xref,
95
136
  "only terms clauses can cross-reference terms clause " \
96
137
  "(#{xref['target']})")
97
- !termids[xref["target"]] && termids[closest_id["id"]] and
138
+ !termids[xref["target"]] && termids[closest_id["anchor"]] and
98
139
  @log.add("Style", xref,
99
140
  "non-terms clauses cannot cross-reference terms clause " \
100
141
  "(#{xref['target']})")
@@ -114,8 +155,8 @@ module Metanorma
114
155
  .join(" | ")
115
156
  (xmldoc.xpath(xpath) - xmldoc.xpath(exc)).each do |x|
116
157
  x["unnumbered"] == "true" and next
117
- @doc_xrefs[x["id"]] or
118
- @log.add("Style", x, "#{name} #{x['id']} has not been " \
158
+ @doc_xrefs[x["anchor"]] or
159
+ @log.add("Style", x, "#{name} #{x['anchor']} has not been " \
119
160
  "cross-referenced within document",
120
161
  severity: xpath == "//formula" ? 2 : 1)
121
162
  end
@@ -186,7 +227,7 @@ module Metanorma
186
227
  xmldoc.xpath("//bibitem[date/on = '–']").each do |b|
187
228
  b.at("./note[@type = 'Unpublished-Status']") or
188
229
  @log.add("Style", b,
189
- "Reference #{b&.at('./@id')&.text} does not have an " \
230
+ "Reference does not have an " \
190
231
  "associated footnote indicating unpublished status")
191
232
  end
192
233
  end
@@ -216,12 +216,8 @@ module Metanorma
216
216
  # ISO/IEC DIR 2, 22.3.2
217
217
  def onlychild_clause_validate(root)
218
218
  root.xpath(Standoc::Utils::SUBCLAUSE_XPATH).each do |c|
219
- next unless c.xpath("../clause").size == 1
220
-
221
- title = c.at("./title")
222
- location = c["id"] || "#{c.text[0..60]}..."
223
- location += ":#{title.text}" if c["id"] && !title.nil?
224
- @log.add("Style", nil, "#{location}: subclause is only child")
219
+ c.xpath("../clause").size == 1 or next
220
+ @log.add("Style", c, "subclause is only child")
225
221
  end
226
222
  end
227
223
 
@@ -218,7 +218,7 @@ module Metanorma
218
218
  end
219
219
 
220
220
  ASSETS_TO_STYLE =
221
- "//termsource | //formula | //termnote | " \
221
+ "//term//source | //formula | //termnote | " \
222
222
  "//p[not(ancestor::boilerplate)] | //li[not(p)] | //dt | " \
223
223
  "//dd[not(p)] | //td[not(p)] | //th[not(p)]".freeze
224
224
 
@@ -82,7 +82,7 @@ module Metanorma
82
82
  withtitle = false
83
83
  xpath.each do |s|
84
84
  title_all_siblings(s.xpath("./clause | ./terms | ./references"),
85
- s&.at("./title")&.text || s["id"])
85
+ s&.at("./title")&.text || s["anchor"])
86
86
  subtitle = s.at("./title")
87
87
  notitle = notitle || (!subtitle || subtitle.text.empty?)
88
88
  withtitle = withtitle || (subtitle && !subtitle.text.empty?)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.0.6".freeze
3
+ VERSION = "3.0.7".freeze
4
4
  end
5
5
  end
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.0.6
4
+ version: 3.0.7
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-04-29 00:00:00.000000000 Z
11
+ date: 2025-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc