metanorma-iso 3.5.25 → 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: 768bb7c02360bd80725d6a9ce3e175e92766867e032cc5fea7bdec0190eaeb63
4
- data.tar.gz: 42684cefc453fc51bd23809fa8a942319a471633fd19265dd002e1861d9e52ff
3
+ metadata.gz: 1b3fff2827ffea8248e4712c9ff01398139e268b55f847c65d4c55088764fd44
4
+ data.tar.gz: 4ed1b2ba688840969db10fff67c13ae62084dc0bb2d5ac9e35c29828c1e264f6
5
5
  SHA512:
6
- metadata.gz: e008a160695feec182265d2d0d6b3207de9d17d6a5506de4f66c944a0043c8b77d86fd658c8ad03e3269a817a8fcca587d577c92f5244209826ab1b243288463
7
- data.tar.gz: 1194f4662e705e1069682108c013961130853fc3598aa9f1499897b76db418fb4fca66d1b2dae2a0c92561237e6cdf87c77555a27a1a581891c84e8325e2d83b
6
+ metadata.gz: 539f60b81306bf215d4ca42be91d3c83df5588b9c259a3c8912e415c4bda079defa2e48d54dee1c30e236604e68cbc4089e8fc036a346e5d7d806f52672a0837
7
+ data.tar.gz: '0855bafc8499b2836926e9cac7e520d32374ccb319291b6aa54de84dca0437b12993273ba67d0c4b61eff95cfb553bababc09880324e88d736e5375a0bff7ffd'
@@ -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.25".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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.25
4
+ version: 3.5.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -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