metanorma-iso 3.5.24 → 3.5.26

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: cea49df0b954050b576b5fa40bf4dd85cc93fd5327156656b600de0b3c093a66
4
- data.tar.gz: fec01b933a9129ec8bb942330ef76f1c30dd7a761fa40e81685f6a11cef9291a
3
+ metadata.gz: 1b3fff2827ffea8248e4712c9ff01398139e268b55f847c65d4c55088764fd44
4
+ data.tar.gz: 4ed1b2ba688840969db10fff67c13ae62084dc0bb2d5ac9e35c29828c1e264f6
5
5
  SHA512:
6
- metadata.gz: 879b813d0278e54ba6001cb4da7fc6940933570f61b8cb93d79669a20bbc08b577f2ece5ef171f1c06ea289bf772497d5a4fb43f160fa529a612a8994a14a699
7
- data.tar.gz: fa31285ceccfd3c044ada39a5cc371403dd7185ec0b6361b37aeabbeae3a55372f1420284d165c4b8e5a966266acbafdaf763cf42377b3f9de56f91ffe7b2270
6
+ metadata.gz: 539f60b81306bf215d4ca42be91d3c83df5588b9c259a3c8912e415c4bda079defa2e48d54dee1c30e236604e68cbc4089e8fc036a346e5d7d806f52672a0837
7
+ data.tar.gz: '0855bafc8499b2836926e9cac7e520d32374ccb319291b6aa54de84dca0437b12993273ba67d0c4b61eff95cfb553bababc09880324e88d736e5375a0bff7ffd'
@@ -566,9 +566,23 @@ module IsoDoc
566
566
  is_normative = refs_sect.normative.to_s == "true"
567
567
  @context.with_normative(is_normative) do
568
568
  walk_mixed_content(refs_sect, doc)
569
+ render_section_admonitions(refs_sect, doc)
569
570
  end
570
571
  end
571
572
 
573
+ # Admonition children of the references section (e.g. an `[EDITOR]`
574
+ # editorial note following the reference list) render after the
575
+ # walked content — 1.17.0 carried them ("EDITORIAL NOTE — …").
576
+ # The section model is unordered, so the fallback walk cannot place
577
+ # them by document order; they are dispatched explicitly here once
578
+ # the model carries them (StandardReferencesSection admonition
579
+ # mapping, metanorma-iso#1764).
580
+ def render_section_admonitions(refs_sect, doc)
581
+ return unless refs_sect.class.attributes.key?(:admonition)
582
+
583
+ Array(refs_sect.admonition).each { |admonition| dispatch(admonition, doc) }
584
+ end
585
+
572
586
  # ── Block visitors (central dispatch) ──────────────────────────
573
587
  #
574
588
  # Class-keyed dispatch via the Renderers::Registry. Each content
@@ -341,7 +341,20 @@ module IsoDoc
341
341
  text = stem_math_text(element)
342
342
  return text if text && !text.empty?
343
343
 
344
- collect_text(element)
344
+ text = collect_text(element)
345
+ return text if text && !text.empty?
346
+
347
+ # Presentation bare-number stems carry no MathML at all:
348
+ # mnconvert emits the digit as plain text inside the semx
349
+ # wrapper ("0<latexmath>0</latexmath>"), so the text only
350
+ # reachable through the semx child is the stem's content
351
+ # (isodoc#898: stem:[0]/stem:[1] vanished from table cells).
352
+ Array(attribute_value(element, :semx)).each do |child|
353
+ text = collect_text(child)
354
+ return text if text && !text.empty?
355
+ end
356
+
357
+ ""
345
358
  end
346
359
 
347
360
  # AsciiMath is the plain-text form of an inline symbol. The
@@ -16,6 +16,7 @@ module IsoDoc
16
16
  include Base
17
17
 
18
18
  def render(element, para)
19
+ return if render_number_as_text(element, para)
19
20
  return if render_as_omml(element, para)
20
21
 
21
22
  render_as_text(element, para)
@@ -23,6 +24,18 @@ module IsoDoc
23
24
 
24
25
  private
25
26
 
27
+ # 1.17.0 parity: a stem consisting of a bare number renders as
28
+ # a plain text run — an OMML object for a bare digit reads as
29
+ # math styling inside prose and table cells (metanorma-iso#1764).
30
+ # Returns true when the paragraph received the number.
31
+ def render_number_as_text(element, para)
32
+ digits = parent.number_only_stem_text(element)
33
+ return false unless digits
34
+
35
+ parent.add_text(para, digits)
36
+ true
37
+ end
38
+
26
39
  # Append the stem's MathML as inline OMML equation models.
27
40
  # Returns true when the paragraph received the equation.
28
41
  def render_as_omml(element, para)
@@ -67,6 +67,28 @@ module IsoDoc
67
67
  nil
68
68
  end
69
69
 
70
+ # 1.17.0 parity: a stem whose MathML is a bare number renders as
71
+ # plain text, not as an equation object. Returns the digits when
72
+ # the MathML carries exactly one <mn> with a digits-only payload
73
+ # and no other MathML elements beyond the math/semantics/mrow
74
+ # wrappers, nil otherwise.
75
+ def number_only_stem_text(stem)
76
+ mathml = stem_mathml(stem)
77
+ return nil unless mathml.to_s.include?("<mn")
78
+
79
+ digits = mathml.scan(%r{<mn[^>]*>([^<]*)</mn>}).flatten.join.strip
80
+ return nil unless digits.match?(/\A\d+\z/)
81
+ return nil unless mathml.scan(/<mn[\s>]/).length == 1
82
+
83
+ wrappers = mathml.gsub(%r{<mn[^>]*>[^<]*</mn>}, "")
84
+ .scan(/<([a-zA-Z]+)[\s>]/).flatten
85
+ return nil unless wrappers.all? { |tag| %w[math semantics mrow].include?(tag) }
86
+
87
+ digits
88
+ rescue StandardError
89
+ nil
90
+ end
91
+
70
92
  private
71
93
 
72
94
  # Direct :math attribute (semantic stem), then <semx>-wrapped
@@ -24,6 +24,7 @@ module IsoDoc
24
24
  render_heading(section, doc)
25
25
  render_intro(section, doc)
26
26
  render_bibitems(section, doc)
27
+ render_admonitions(section, doc)
27
28
  end
28
29
  end
29
30
  end
@@ -65,6 +66,19 @@ module IsoDoc
65
66
  @walker.dispatch(bib, doc)
66
67
  end
67
68
  end
69
+
70
+ # Admonition children of the references section (e.g. an
71
+ # `[EDITOR]` editorial note following the reference list) render
72
+ # after the entries — 1.17.0 carried them ("EDITORIAL NOTE — …");
73
+ # the model dropped them at ingest until the section gained the
74
+ # admonition mapping (metanorma-iso#1764).
75
+ def render_admonitions(section, doc)
76
+ return unless section.class.attributes.key?(:admonition)
77
+
78
+ Array(section.admonition).each do |admonition|
79
+ @walker.dispatch(admonition, doc)
80
+ end
81
+ end
68
82
  end
69
83
  end
70
84
  end
@@ -482,9 +482,15 @@ module Metanorma
482
482
  def caption(node) = render_element("figcaption", render_children(node))
483
483
 
484
484
  def graphic(node)
485
+ # NISO STS carries a graphic's accessibility text as the
486
+ # <alt-text> child element (access.class); the element has
487
+ # no @alttext attribute (metanorma-iso#1793).
488
+ alt = Array(node.alt_text)
489
+ .flat_map { |a| Array(a.content) }
490
+ .compact.join(" ")
485
491
  render_liquid("_img.html.liquid", {
486
492
  "src" => node.href.to_s,
487
- "alt" => node.alttext.to_s,
493
+ "alt" => alt,
488
494
  })
489
495
  end
490
496
 
@@ -694,7 +700,11 @@ module Metanorma
694
700
 
695
701
  mapping = @mapping_cache[node.class][:elements]
696
702
  indices = Hash.new(0)
697
- node.element_order.filter_map do |entry|
703
+ # Parsed models of non-mixed elements carry no element_order
704
+ # (lutaml-model fills it only under mixed_content); fall back
705
+ # to the mapped elements in declaration order.
706
+ entries = node.element_order || declared_element_order(node, mapping)
707
+ entries.filter_map do |entry|
698
708
  case entry.node_type
699
709
  when :text
700
710
  escape(entry.text_content.to_s)
@@ -1016,7 +1026,8 @@ module Metanorma
1016
1026
  def ordered_content_parts(node)
1017
1027
  mapping = @mapping_cache[node.class][:elements]
1018
1028
  indices = Hash.new(0)
1019
- node.element_order.filter_map do |entry|
1029
+ entries = node.element_order || declared_element_order(node, mapping)
1030
+ entries.filter_map do |entry|
1020
1031
  if entry.node_type == :text
1021
1032
  entry.text_content.to_s
1022
1033
  else
@@ -1028,6 +1039,16 @@ module Metanorma
1028
1039
  end
1029
1040
  end
1030
1041
 
1042
+ # Declaration-order entries for models whose parse produced no
1043
+ # element_order: one entry per mapped element name.
1044
+ DeclaredEntry = Struct.new(:node_type, :name, :text_content)
1045
+
1046
+ def declared_element_order(node, mapping)
1047
+ return [] if node.nil?
1048
+
1049
+ mapping.keys.map { |name| DeclaredEntry.new(:element, name, nil) }
1050
+ end
1051
+
1031
1052
  def inline_or_content(node)
1032
1053
  rendered = render_inline(node)
1033
1054
  rendered.empty? ? node.content.to_s : rendered
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.5.24".freeze
3
+ VERSION = "3.5.26".freeze
4
4
  end
5
5
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "metanorma-standoc", ">= 3.4.2" # relaxed until standoc#1232 releases
37
37
  spec.add_dependency "mnconvert", "~> 1.14"
38
38
  spec.add_dependency "pubid", "~> 2.0.3"
39
- spec.add_dependency "sts", "~> 0.6.13"
39
+ spec.add_dependency "sts", "~> 0.6.14"
40
40
  spec.add_dependency "tokenizer", "~> 0.3.0"
41
41
  spec.add_dependency "unitsdb", "~> 2.2.14"
42
42
  spec.add_dependency "uniword", "~> 1.7.6"
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.24
4
+ version: 3.5.26
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-11-17 00:00:00.000000000 Z
11
+ date: 2026-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-document
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.6.13
75
+ version: 0.6.14
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.6.13
82
+ version: 0.6.14
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: tokenizer
85
85
  requirement: !ruby/object:Gem::Requirement