html_press 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +0 -1
- data/html_press.gemspec +1 -0
- data/lib/html_press.rb +1 -0
- data/lib/html_press/html.rb +7 -0
- data/lib/html_press/html_entities.rb +12 -0
- data/lib/html_press/version.rb +1 -1
- data/spec/html_press_spec.rb +5 -4
- metadata +22 -10
data/Readme.md
CHANGED
data/html_press.gemspec
CHANGED
data/lib/html_press.rb
CHANGED
data/lib/html_press/html.rb
CHANGED
@@ -59,6 +59,13 @@ module HtmlPress
|
|
59
59
|
''
|
60
60
|
end
|
61
61
|
|
62
|
+
# replace entities
|
63
|
+
out.gsub! /<|<|>|>|&|&/ do |m|
|
64
|
+
reserve m
|
65
|
+
end
|
66
|
+
|
67
|
+
out = HtmlPress.entities_compressor out
|
68
|
+
|
62
69
|
# replace PREs with placeholders
|
63
70
|
out.gsub! /\s*(<pre\b[^>]*?>[\s\S]*?<\/pre>)\s*/i do |m|
|
64
71
|
pre = m.gsub(/\s*<pre\b[^>]*?>([\s\S]*?)<\/pre>\s*/i, "\\1")
|
data/lib/html_press/version.rb
CHANGED
data/spec/html_press_spec.rb
CHANGED
@@ -172,6 +172,11 @@ describe HtmlPress do
|
|
172
172
|
# input value "" ?
|
173
173
|
end
|
174
174
|
|
175
|
+
it "should convert html entities to utf-8 symbols" do
|
176
|
+
HtmlPress.compress("< < > > & &").should eql "< < > > & &"
|
177
|
+
HtmlPress.compress("élan").should eql "élan"
|
178
|
+
end
|
179
|
+
|
175
180
|
# it "should compress javascript in event attributes" do
|
176
181
|
# # javascript: - remove
|
177
182
|
# # onfocus
|
@@ -192,9 +197,5 @@ describe HtmlPress do
|
|
192
197
|
#
|
193
198
|
# it "should remove unnecessary quotes for attributes values" do
|
194
199
|
# end
|
195
|
-
#
|
196
|
-
# it "should convert html entities to utf-8 symbols" do
|
197
|
-
# # except <>&
|
198
|
-
# end
|
199
200
|
|
200
201
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_press
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &25710912 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *25710912
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &25710636 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *25710636
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rainpress
|
38
|
-
requirement: &
|
38
|
+
requirement: &25710348 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *25710348
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: uglifier
|
49
|
-
requirement: &
|
49
|
+
requirement: &25710036 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,18 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *25710036
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: htmlentities
|
60
|
+
requirement: &25709748 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *25709748
|
58
69
|
description: Ruby gem for compressing html
|
59
70
|
email:
|
60
71
|
- stereobooster@gmail.com
|
@@ -69,6 +80,7 @@ files:
|
|
69
80
|
- html_press.gemspec
|
70
81
|
- lib/html_press.rb
|
71
82
|
- lib/html_press/html.rb
|
83
|
+
- lib/html_press/html_entities.rb
|
72
84
|
- lib/html_press/rainpress.rb
|
73
85
|
- lib/html_press/uglifier.rb
|
74
86
|
- lib/html_press/version.rb
|