metanorma-iso 3.5.1.pre.alpha.4 → 3.5.2

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: 743661292939ee8527d318189cc5078605b168f5320358d7648b10c9c730fda4
4
- data.tar.gz: 648a0397c58c6106979298e2cb7e19b23314ec5bab76b36ece1ba6b8cc5e5649
3
+ metadata.gz: 41f2468c77bd949ee94e2f8cbfa5f60c01b5a5633db5d1ee05b248a977966f6f
4
+ data.tar.gz: 2413d3b2af2054253b248a3661929282e2eb43d26f4660304805bd86abc7b19d
5
5
  SHA512:
6
- metadata.gz: 8ef7060608d4b3459fb57d6cca90612de8fb5f045372aee9c4d1a104f12fab29567c5604f3d0b46c2364814fe6301a1ce9bb0bcf20728c02960c79f650732a53
7
- data.tar.gz: 87032d0839ea375fef716993c732db6aa15e26716f05de2a739859b1a6425009e6d0dc858502398b3504f86c78305f3d51fdee77ee4e9a1b53c47ca96f1237ea
6
+ metadata.gz: 0536b71c11b64054b8f8efc51e4eabe7430759d5c3f70189a53770b6425fdd585a141bee630c2adc63a07fa8d4da9b87cce4112b1a0e8651824191823b3903a9
7
+ data.tar.gz: ae3d8b25bf269f9efe7b71ff210599f30f3af7f2a222b10663714394dda19402467102774f849ee2f0c7f702d471f21426038f6c477438c98d052afa813a5f5f
@@ -476,12 +476,6 @@
476
476
  </xsl:variable>
477
477
  <xsl:variable name="variables" select="xalan:nodeset($variables_)"/>
478
478
 
479
- <xsl:template name="getVariable">
480
- <xsl:param name="variable"/>
481
- <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
482
- <xsl:value-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]"/>
483
- </xsl:template>
484
-
485
479
  <xsl:variable name="COLUMN_GAP">8.5mm</xsl:variable>
486
480
 
487
481
  <xsl:variable name="PROOF_TEXT">PROOF/ÉPREUVE</xsl:variable>
@@ -22530,6 +22524,23 @@
22530
22524
  </xsl:choose>
22531
22525
  </xsl:template>
22532
22526
 
22527
+ <xsl:template name="getVariable">
22528
+ <xsl:param name="variable"/>
22529
+ <!-- Note: need insert <xsl:variable name="setVariable" select="java:org.metanorma.fop.global.Variables.setVariable('num', $num)"/> before
22530
+ in the iteration <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma"> -->
22531
+ <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
22532
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]"/>
22533
+ </xsl:template>
22534
+
22535
+ <!-- get variable value with the internal elements(nodes), e.g. formatting -->
22536
+ <xsl:template name="getVariableCopyOf">
22537
+ <xsl:param name="variable"/>
22538
+ <!-- Note: need insert <xsl:variable name="setVariable" select="java:org.metanorma.fop.global.Variables.setVariable('num', $num)"/> before
22539
+ in the iteration <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma"> -->
22540
+ <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
22541
+ <xsl:copy-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]/node()"/>
22542
+ </xsl:template>
22543
+
22533
22544
  <!-- ============================================= -->
22534
22545
  <!-- mode="print_as_xml", for debug purposes -->
22535
22546
  <!-- ============================================= -->
@@ -476,12 +476,6 @@
476
476
  </xsl:variable>
477
477
  <xsl:variable name="variables" select="xalan:nodeset($variables_)"/>
478
478
 
479
- <xsl:template name="getVariable">
480
- <xsl:param name="variable"/>
481
- <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
482
- <xsl:value-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]"/>
483
- </xsl:template>
484
-
485
479
  <xsl:variable name="COLUMN_GAP">8.5mm</xsl:variable>
486
480
 
487
481
  <xsl:variable name="PROOF_TEXT">PROOF/ÉPREUVE</xsl:variable>
@@ -22530,6 +22524,23 @@
22530
22524
  </xsl:choose>
22531
22525
  </xsl:template>
22532
22526
 
22527
+ <xsl:template name="getVariable">
22528
+ <xsl:param name="variable"/>
22529
+ <!-- Note: need insert <xsl:variable name="setVariable" select="java:org.metanorma.fop.global.Variables.setVariable('num', $num)"/> before
22530
+ in the iteration <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma"> -->
22531
+ <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
22532
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]"/>
22533
+ </xsl:template>
22534
+
22535
+ <!-- get variable value with the internal elements(nodes), e.g. formatting -->
22536
+ <xsl:template name="getVariableCopyOf">
22537
+ <xsl:param name="variable"/>
22538
+ <!-- Note: need insert <xsl:variable name="setVariable" select="java:org.metanorma.fop.global.Variables.setVariable('num', $num)"/> before
22539
+ in the iteration <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma"> -->
22540
+ <xsl:variable name="num" select="number(java:org.metanorma.fop.global.Variables.getVariable('num'))"/>
22541
+ <xsl:copy-of select="$variables/mnx:doc[@num = $num]/*[local-name() = $variable]/node()"/>
22542
+ </xsl:template>
22543
+
22533
22544
  <!-- ============================================= -->
22534
22545
  <!-- mode="print_as_xml", for debug purposes -->
22535
22546
  <!-- ============================================= -->
@@ -24,6 +24,8 @@ module IsoDoc
24
24
 
25
25
  # style [1] references as [Reference 1], eref or origin
26
26
  def bracketed_refs_processing(docxml)
27
+ @elem_id_lookup = docxml.xpath("//*[@id]")
28
+ .each_with_object({}) { |e, h| h[e["id"]] ||= e }
27
29
  (docxml.xpath(ns("//semx[@element = 'eref']")) -
28
30
  docxml.xpath(ns("//semx[@element = 'erefstack']//semx[@element = 'eref']")))
29
31
  .each { |n| bracket_eref_style(n) }
@@ -46,9 +48,16 @@ module IsoDoc
46
48
  end
47
49
  end
48
50
 
51
+ # Reference sources resolve through a one-pass id index: a
52
+ # per-reference //*[@id = '...'] document scan is quadratic on
53
+ # large vocabulary documents.
54
+ def source_semx(elem)
55
+ @elem_id_lookup[elem["source"]]
56
+ end
57
+
49
58
  # is the eref corresponding to this semx a simple [n] reference?
50
59
  def bracket_eref_original(elem)
51
- semx = elem.document.at("//*[@id = '#{elem['source']}']") or return
60
+ semx = source_semx(elem) or return
52
61
  dup = elem.at(ns(".//fmt-eref | .//fmt-xref | .//fmt-origin"))
53
62
  non_locality_elems(semx).empty? or return
54
63
  /^\[\d+\]$/.match?(semx["citeas"]) or return
@@ -75,7 +84,7 @@ module IsoDoc
75
84
  def bracket_erefstack_style_prep(elem)
76
85
  semx = elem.xpath(ns(".//semx[@element = 'eref']"))
77
86
  .filter_map { |e| bracket_eref_original(e) }
78
- erefstack_orig = elem.document.at("//*[@id = '#{elem['source']}']")
87
+ erefstack_orig = source_semx(elem)
79
88
  [semx, erefstack_orig]
80
89
  end
81
90
 
@@ -85,7 +94,7 @@ module IsoDoc
85
94
  end
86
95
 
87
96
  def insert_biblio_callout(elem)
88
- semx = elem.document.at("//*[@id = '#{elem['source']}']") or return
97
+ semx = source_semx(elem) or return
89
98
  if ref = @bibitem_lookup[semx["bibitemid"]]
90
99
  Metanorma::Iso::PublisherIdentity
91
100
  .iso_iec_publisher?(ref, ns: method(:ns)) and return
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.5.1.pre.alpha.4".freeze
3
+ VERSION = "3.5.2".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.5.1.pre.alpha.4
4
+ version: 3.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-28 00:00:00.000000000 Z
11
+ date: 2026-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-document