htmlentities 4.2.0 → 4.2.1
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.
- data/History.txt +4 -0
- data/lib/htmlentities/encoder.rb +3 -1
- data/lib/htmlentities/version.rb +1 -1
- data/test/entities_test.rb +12 -0
- metadata +12 -12
data/History.txt
CHANGED
data/lib/htmlentities/encoder.rb
CHANGED
@@ -33,13 +33,15 @@ class HTMLEntities
|
|
33
33
|
|
34
34
|
def extended_entity_regexp
|
35
35
|
@extended_entity_regexp ||= (
|
36
|
+
regexp_options = [nil]
|
36
37
|
if encoding_aware?
|
37
38
|
regexp = '[^\u{20}-\u{7E}]'
|
38
39
|
else
|
39
40
|
regexp = '[^\x20-\x7E]'
|
41
|
+
regexp_options << "U"
|
40
42
|
end
|
41
43
|
regexp += "|'" if @flavor == 'html4'
|
42
|
-
Regexp.new(regexp)
|
44
|
+
Regexp.new(regexp, *regexp_options)
|
43
45
|
)
|
44
46
|
end
|
45
47
|
|
data/lib/htmlentities/version.rb
CHANGED
data/test/entities_test.rb
CHANGED
@@ -182,6 +182,18 @@ class HTMLEntities::EntitiesTest < Test::Unit::TestCase
|
|
182
182
|
assert_decode([948].pack('U'), 'δ')
|
183
183
|
end
|
184
184
|
|
185
|
+
if RUBY_VERSION =~ /^1\.8\./
|
186
|
+
# Reported by Benoit Larroque
|
187
|
+
def test_should_encode_without_error_when_KCODE_is_not_UTF_8
|
188
|
+
kcode = $KCODE
|
189
|
+
$KCODE = "n"
|
190
|
+
coder = HTMLEntities.new;
|
191
|
+
text = [8212].pack('U')
|
192
|
+
assert_equal "—", coder.encode(text, :decimal)
|
193
|
+
$KCODE = kcode
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
185
197
|
def test_should_ducktype_parameter_to_string_before_encoding
|
186
198
|
pseudo_string = PseudoString.new('foo')
|
187
199
|
assert_decode('foo', pseudo_string)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmlentities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Battley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-04-06 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,25 +24,25 @@ extra_rdoc_files:
|
|
24
24
|
- History.txt
|
25
25
|
- COPYING.txt
|
26
26
|
files:
|
27
|
-
- lib/htmlentities/
|
27
|
+
- lib/htmlentities/version.rb
|
28
|
+
- lib/htmlentities/flavors.rb
|
29
|
+
- lib/htmlentities/encoder.rb
|
30
|
+
- lib/htmlentities/legacy.rb
|
28
31
|
- lib/htmlentities/mappings/html4.rb
|
29
32
|
- lib/htmlentities/mappings/expanded.rb
|
30
33
|
- lib/htmlentities/mappings/xhtml1.rb
|
31
|
-
- lib/htmlentities/
|
32
|
-
- lib/htmlentities/flavors.rb
|
33
|
-
- lib/htmlentities/legacy.rb
|
34
|
-
- lib/htmlentities/version.rb
|
34
|
+
- lib/htmlentities/decoder.rb
|
35
35
|
- lib/htmlentities.rb
|
36
|
-
- test/
|
37
|
-
- test/test_all.rb
|
36
|
+
- test/entities_test.rb
|
38
37
|
- test/xhtml1_test.rb
|
39
38
|
- test/roundtrip_test.rb
|
40
|
-
- test/expanded_test.rb
|
41
39
|
- test/legacy_test.rb
|
42
|
-
- test/
|
40
|
+
- test/expanded_test.rb
|
41
|
+
- test/test_all.rb
|
42
|
+
- test/html4_test.rb
|
43
|
+
- perf/profile.rb
|
43
44
|
- perf/benchmark.rb
|
44
45
|
- perf/performance.rb
|
45
|
-
- perf/profile.rb
|
46
46
|
- setup.rb
|
47
47
|
- README.txt
|
48
48
|
- History.txt
|