isodoc-i18n 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/i18n.rb +7 -6
- data/lib/isodoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db66af34abba937daa72bbef574be08220618ca75b104c5b1e6275736494e781
|
4
|
+
data.tar.gz: b94275b875363991d526ea1a83ec3be97bdc93dcd0db16681cee8ba0197a8577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e56e238e36071225875002eeb86959c23ddcf2ae874fa7db18e6893978e4d7105b88964867f8cd331718c975bdea5175845533e6ad045b621b035bff34a3c7
|
7
|
+
data.tar.gz: 87da9b7308403c25d52f8008177cb0ef62da042df0d58d8f26864678de53b84a925465dd36b9b40e1a106ca8a8406411d515567f1316903d54643cbbc89dc339
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -98,23 +98,24 @@ module IsoDoc
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def l10n_zh(text)
|
101
|
-
xml = Nokogiri::
|
101
|
+
xml = Nokogiri::XML::DocumentFragment.parse(text)
|
102
102
|
xml.traverse do |n|
|
103
103
|
next unless n.text?
|
104
104
|
|
105
105
|
n.replace(cleanup_entities(l10_zh1(n.text), is_xml: false))
|
106
106
|
end
|
107
|
-
xml.to_xml.gsub(/<b>/, "").gsub("</b>", "")
|
107
|
+
xml.to_xml(encoding: "UTF-8").gsub(/<b>/, "").gsub("</b>", "")
|
108
|
+
.gsub(/<\?[^>]+>/, "")
|
108
109
|
end
|
109
110
|
|
110
111
|
def l10n_fr(text, locale)
|
111
|
-
xml = Nokogiri::
|
112
|
+
xml = Nokogiri::XML::DocumentFragment.parse(text)
|
112
113
|
xml.traverse do |n|
|
113
114
|
next unless n.text?
|
114
115
|
|
115
116
|
n.replace(cleanup_entities(l10n_fr1(n.text, locale), is_xml: false))
|
116
117
|
end
|
117
|
-
xml.to_xml
|
118
|
+
xml.to_xml(encoding: "UTF-8")
|
118
119
|
end
|
119
120
|
|
120
121
|
ZH_CHAR = "\\p{Han}|\\p{In CJK Symbols And Punctuation}|"\
|
@@ -171,11 +172,11 @@ module IsoDoc
|
|
171
172
|
c = HTMLEntities.new
|
172
173
|
if is_xml
|
173
174
|
text.split(/([<>])/).each_slice(4).map do |a|
|
174
|
-
a[0] = c.
|
175
|
+
a[0] = c.decode(a[0])
|
175
176
|
a
|
176
177
|
end.join
|
177
178
|
else
|
178
|
-
c.
|
179
|
+
c.decode(text)
|
179
180
|
end
|
180
181
|
end
|
181
182
|
|
data/lib/isodoc/version.rb
CHANGED