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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f00540677aae6f53c0c517b376529ce6eb5094c6cebd1d1a9b31ce20e346266
4
- data.tar.gz: 69dd44b3aedc560540c5de52f05f0ae11b1332edccb4565817845648f23a9631
3
+ metadata.gz: db66af34abba937daa72bbef574be08220618ca75b104c5b1e6275736494e781
4
+ data.tar.gz: b94275b875363991d526ea1a83ec3be97bdc93dcd0db16681cee8ba0197a8577
5
5
  SHA512:
6
- metadata.gz: 8b3a53fe9058b2cba6f929938e61147adcb6eaa0782705ca2097cf448f63a76500abbe4b4d3513b9d0cfca04456547d8127e278ef7a521ec3b1cff6de8302f58
7
- data.tar.gz: 24ff8195e4172769e91fc4f879fe6835b4f24170041e16198ab3a405625f07ed56bce3a702604b5cb25102b4d6f21ce87d5d92889122cd524a4694549ba8d0c8
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::HTML::DocumentFragment.parse(text)
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>", "").gsub(/<\?[^>]+>/, "")
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::HTML::DocumentFragment.parse(text)
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.encode(c.decode(a[0]), :hexadecimal)
175
+ a[0] = c.decode(a[0])
175
176
  a
176
177
  end.join
177
178
  else
178
- c.encode(c.decode(text), :hexadecimal)
179
+ c.decode(text)
179
180
  end
180
181
  end
181
182
 
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
2
  class I18n
3
- VERSION = "1.1.1".freeze
3
+ VERSION = "1.1.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.