metanorma-standoc 3.5.31 → 3.5.32

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: c2d7915082c5cae65f0681e72ac3815bbcfd88df1102fc1079f28decbd894821
4
- data.tar.gz: 521849313742749ba454b7cb28405a7515b0c22206a26f6785dc1b36c7e02d12
3
+ metadata.gz: '036370981e7443661c8562d25ce5f82ddeebda8475db456ac69865e48de95e0c'
4
+ data.tar.gz: 0b862e9aa1360debf9a5dce02094a1c045126f6004b0fbdc32ae834b6089099e
5
5
  SHA512:
6
- metadata.gz: 8d6074cadae2db8fd2c0100dbc810f8ba5e6e6fa6d9cc7c82bb80f875d8dc37b83e67ae6405b155721489e53f2cb07c475041059356c96167e5454fa5c7a2df9
7
- data.tar.gz: cbf8d42004aacef8246c7f82940e6a433cc84a95ca5e1a6a800cbfe67821d0ae56c073b99afcceab4e9efc90a9830319ad2a83b0346e3a6efc5a80549a10fea6
6
+ metadata.gz: 0fb574fd098a998360dfd31a2004b376dbffe9869c9e46b4ae81c93ec83476abfb91b01ae13ae841f4aea145ee4486879b7a140f52d763b925f624545f0f7f0d
7
+ data.tar.gz: 4bd4b82c9566e4470b76cec9ef54fc26c8836d328ff095e81eaa9f1a1b3d5b1294f19132273ff04191776d024438956170a68854d1fb97cecb807d6ea1fb7f22
@@ -155,7 +155,8 @@ module Metanorma
155
155
  @fn_number ||= 0
156
156
  noko do |xml|
157
157
  @fn_number += 1
158
- xml.fn **attr_code(id_attr(nil).merge(reference: @fn_number)) do |fn|
158
+ xml.fn **attr_code(id_attr(nil, seed: "footnote-#{@fn_number}")
159
+ .merge(reference: @fn_number)) do |fn|
159
160
  fn.p { |p| p << node.text }
160
161
  end
161
162
  end
@@ -6,15 +6,45 @@ require_relative "blocks_image"
6
6
  module Metanorma
7
7
  module Standoc
8
8
  module Blocks
9
- def id_attr(node = nil)
9
+ def id_attr(node = nil, seed: nil)
10
10
  anchor = node&.id
11
- { id: "_#{Metanorma::Utils.random_uuid}",
11
+ { id: "_#{stable_block_id(node, seed: seed)}",
12
12
  anchor: anchor && !anchor.empty? ? anchor : nil,
13
13
  tag: node&.attr("tag"), columns: node&.attr("columns"),
14
14
  "multilingual-rendering": node&.attr("multilingual-rendering") }
15
15
  .compact
16
16
  end
17
17
 
18
+ # Deterministic ids for anchor-less elements (isodoc#861): the
19
+ # document identity, the element's text (or an explicit seed),
20
+ # and the occurrence ordinal of that text mint a stable UUIDv5 -
21
+ # a recompile produces the same ids, where the random mint made
22
+ # every compile's HTML carry different heading and term ids and
23
+ # the TOC links moved with them. Elements carrying nothing
24
+ # seedable keep the random mint.
25
+ def stable_block_id(node, seed: nil)
26
+ text = seed || stable_seed_text(node)
27
+ return Metanorma::Utils.random_uuid if text.empty?
28
+
29
+ key = [document_seed(node), text]
30
+ @stable_id_counts ||= Hash.new(0)
31
+ Metanorma::Utils.stable_uuid(*key, @stable_id_counts[key] += 1)
32
+ end
33
+
34
+ # Sections carry a title, blocks a text; either seeds the mint.
35
+ def stable_seed_text(node)
36
+ t = node.respond_to?(:title) ? node.title.to_s.strip : ""
37
+ t = node.text.to_s.strip if t.empty? && node.respond_to?(:text)
38
+ t.strip
39
+ end
40
+
41
+ # The basename only: the same source compiled in another
42
+ # directory must produce the same ids, so the seed stays free of
43
+ # the build machine's paths.
44
+ def document_seed(node)
45
+ File.basename(node&.document&.attributes&.[]("docfile").to_s)
46
+ end
47
+
18
48
  def id_unnum_attrs(node)
19
49
  attr_code(id_attr(node).merge(
20
50
  unnumbered: node.option?("unnumbered") ? "true" : nil,
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.5.31".freeze
22
+ VERSION = "3.5.32".freeze
23
23
  end
24
24
  end
@@ -40,7 +40,9 @@ Gem::Specification.new do |spec|
40
40
  # LutamlJsonschemaPreprocessor shipped in 0.7.74
41
41
  spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7", ">= 0.7.74"
42
42
  spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
43
- spec.add_dependency "metanorma-utils", "~> 2.0.12"
43
+ # >= 2.0.13: Metanorma::Utils.stable_uuid - the deterministic
44
+ # anchor-less element id mint (isodoc#861).
45
+ spec.add_dependency "metanorma-utils", "~> 2.0.13"
44
46
  # moxml 0.6.0 removed the Opal surface (lutaml/moxml#516); owner
45
47
  # call to update all to the latest moxml line.
46
48
  spec.add_dependency "moxml", "~> 0.6.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.31
4
+ version: 3.5.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-25 00:00:00.000000000 Z
11
+ date: 2026-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -162,14 +162,14 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 2.0.12
165
+ version: 2.0.13
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 2.0.12
172
+ version: 2.0.13
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: moxml
175
175
  requirement: !ruby/object:Gem::Requirement