metanorma 2.0.9 → 2.0.10

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: 8023ee9f3e35c8192af2ef0cd4231b635b5efc6e5529fe85acb42a641032b3b0
4
- data.tar.gz: 2875b07c0f94091745d83cea071d96bcffe1a77b5f493eda45970bc7ff3c580b
3
+ metadata.gz: 1e681e7a6dd2a2a79b02bbd1e49d7d1761708caed6dab61f6288153a939468b4
4
+ data.tar.gz: 10bfbb27b1851e2b44fe916e46e673b2cf2155d7b8298f21ca65a54e29ef075b
5
5
  SHA512:
6
- metadata.gz: fae6f061d8fb94d44671e372d802190d205058073a389534241f7958aafe0a0c49e87e75e46cd205d4c9ea227e5c4610f9f4ca430849c084a2493eacdca8419f
7
- data.tar.gz: a7fa6dcb6a2b379bbc3e6b8de6b4d3f300c0b5e01f40dc79fa784a535f6041d29913b4c904adc3a98e7c8d90ba88ff008e4700549b6c5d397242b33a85040092
6
+ metadata.gz: 10ec3b71b64829a8e536f97ad7b93a8ee3d3a9d86d2ad984bfc2dce6a1cfd4f1220681171dbca2d76889aed5de475d61b70640d1fd33affb1a970afe63982a83
7
+ data.tar.gz: f477977ce41ff242b590f3a1a9a01a768bf8882de35f18077bd92467989da37af60760536d7e7f37cfe09ae3c3444b26200b2e028abd8787e9fd298fc2959545
@@ -106,11 +106,20 @@ module Metanorma
106
106
  end
107
107
  end
108
108
 
109
+ def select_citation_uri(bib, lang)
110
+ bib or return
111
+ url = bib.at(ns("./uri[@type = 'citation']" \
112
+ "[@language = '#{lang}']")) ||
113
+ bib.at(ns("./uri[@type = 'citation']"))
114
+ url&.text
115
+ end
116
+
109
117
  def eref_to_internal_eref(section, xml, key)
110
- bibitems, indirect, bibids = eref_to_internal_eref_prep(section, xml)
118
+ bibitems, indirect, bibids, lang =
119
+ eref_to_internal_eref_prep(section, xml)
111
120
  eref_to_internal_eref_select(section, xml, bibitems)
112
121
  .each_with_object([]) do |x, m|
113
- url = bibitems[x]&.at(ns("./uri[@type = 'citation']"))&.text
122
+ url = select_citation_uri(bibitems[x], lang)
114
123
  bibids[x]&.each do |e|
115
124
  e.at(ns("./localityStack | ./locality")) and next
116
125
  id = eref_to_internal_eref1(e, key, url, indirect) and m << id
@@ -124,7 +133,8 @@ module Metanorma
124
133
  indirect = ::Metanorma::Collection::Util::gather_bibitems(xml)
125
134
  .select { |_, v| indirect_bib?(v) }
126
135
  bibitemids = ::Metanorma::Collection::Util::gather_bibitemids(section)
127
- [bibitems, indirect, bibitemids]
136
+ lang = xml.at(ns("//bibdata/language"))&.text || "en"
137
+ [bibitems, indirect, bibitemids, lang]
128
138
  end
129
139
 
130
140
  def eref_to_internal_eref1(elem, key, url, indirect)
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "2.0.9".freeze
2
+ VERSION = "2.0.10".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-09 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor