isodoc-i18n 1.5.2 → 1.5.3
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 +4 -4
- data/.rubocop.yml +2 -2
- data/lib/isodoc/i18n/version.rb +1 -1
- data/lib/isodoc/l10n.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6501239186bf5665f96df990867a1a6ba68e4bb86dcd50d16bb76f263553c152
|
|
4
|
+
data.tar.gz: db50bbd890fd8032fed107b91a893dd3ae11719c5e95fef8c7b419bcf57fb568
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52af766969ed595f51030752c9e941be16e7866319db076906f6c8bfdc49c796fa8a3edc938a2cd2720e8d018dda4288656c8d1c4ac0d28c3755ca25a170daab
|
|
7
|
+
data.tar.gz: 12dc30aef9c2c407b0fcd95d58caf2f5799e4db19e7b760dbf0ffbcbc9a350c153a356003088a57e6d5f1d8d73005f8f9d87f2699dddf8f01a952e98cbecfc25
|
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
inherit_from:
|
|
4
|
-
- https://raw.githubusercontent.com/riboseinc/oss-guides/
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
5
|
|
|
6
6
|
# local repo-specific modifications
|
|
7
7
|
# ...
|
|
8
8
|
|
|
9
9
|
AllCops:
|
|
10
|
-
TargetRubyVersion:
|
|
10
|
+
TargetRubyVersion: 3.4
|
data/lib/isodoc/i18n/version.rb
CHANGED
data/lib/isodoc/l10n.rb
CHANGED
|
@@ -41,6 +41,7 @@ module IsoDoc
|
|
|
41
41
|
|
|
42
42
|
def l10n_prep(text, options)
|
|
43
43
|
xml = Nokogiri::XML::DocumentFragment.parse(text)
|
|
44
|
+
wrap_tt_children_in_esc(xml)
|
|
44
45
|
t = xml.xpath(".//text()").reject { |node| node.text.empty? }
|
|
45
46
|
text_cache = build_text_cache(t, options[:prev], options[:foll])
|
|
46
47
|
|
|
@@ -51,6 +52,19 @@ module IsoDoc
|
|
|
51
52
|
[t, text_cache, xml, options[:prev], options[:foll], esc_indices]
|
|
52
53
|
end
|
|
53
54
|
|
|
55
|
+
# <tt> is an inline code element whose content is by definition Latin /
|
|
56
|
+
# literal — it must not undergo punctuation localisation. Wrap its
|
|
57
|
+
# children in <esc> so build_esc_indices skips them; the trailing
|
|
58
|
+
# <esc>-strip in l10n removes the wrapper afterwards.
|
|
59
|
+
def wrap_tt_children_in_esc(xml)
|
|
60
|
+
xml.xpath(".//tt | .//*[local-name()='tt']").each do |tt|
|
|
61
|
+
next if tt.children.empty?
|
|
62
|
+
next if tt.children.all? { |c| c.element? && c.name == "esc" }
|
|
63
|
+
|
|
64
|
+
tt.inner_html = "<esc>#{tt.inner_html}</esc>"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
54
68
|
# Build set of indices for text nodes within <esc> tags
|
|
55
69
|
# Handles both namespaced and non-namespaced <esc> elements
|
|
56
70
|
def build_esc_indices(xml, text_nodes)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: isodoc-i18n
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.3
|
|
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-05-
|
|
11
|
+
date: 2026-05-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|