ahc 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -0
- data/lib/ahc.rb +1 -1
- data/lib/ahcx_template_handler.rb +4 -2
- metadata +1 -1
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
POpen4 (0.1.4)
|
5
|
+
Platform (>= 0.4.0)
|
6
|
+
open4
|
7
|
+
Platform (0.4.0)
|
4
8
|
diff-lcs (1.1.3)
|
5
9
|
erubis (2.7.0)
|
6
10
|
git (1.2.5)
|
11
|
+
htmlcompressor (0.0.5)
|
12
|
+
yui-compressor (~> 0.9.6)
|
7
13
|
jeweler (1.8.4)
|
8
14
|
bundler (~> 1.0)
|
9
15
|
git (>= 1.2.5)
|
@@ -11,6 +17,7 @@ GEM
|
|
11
17
|
rdoc
|
12
18
|
json (1.7.6)
|
13
19
|
nokogiri (1.5.6)
|
20
|
+
open4 (1.3.0)
|
14
21
|
rake (10.0.3)
|
15
22
|
rdoc (3.12)
|
16
23
|
json (~> 1.4)
|
@@ -22,6 +29,8 @@ GEM
|
|
22
29
|
rspec-expectations (2.8.0)
|
23
30
|
diff-lcs (~> 1.1.2)
|
24
31
|
rspec-mocks (2.8.0)
|
32
|
+
yui-compressor (0.9.6)
|
33
|
+
POpen4 (>= 0.1.4)
|
25
34
|
|
26
35
|
PLATFORMS
|
27
36
|
ruby
|
@@ -29,6 +38,7 @@ PLATFORMS
|
|
29
38
|
DEPENDENCIES
|
30
39
|
bundler
|
31
40
|
erubis
|
41
|
+
htmlcompressor
|
32
42
|
jeweler (~> 1.8.4)
|
33
43
|
nokogiri
|
34
44
|
rdoc (~> 3.12)
|
data/lib/ahc.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
+
require 'htmlcompressor'
|
2
3
|
|
3
4
|
class AhcxTemplateHandler
|
4
5
|
|
@@ -18,7 +19,7 @@ class AhcxTemplateHandler
|
|
18
19
|
child_node_tag, child_node_attr = child_node.name.split(':')
|
19
20
|
raw = child_node.attributes['raw']
|
20
21
|
if raw || (child_node.children.length == 1 && child_node.children.first.name == 'text')
|
21
|
-
params[child_node_attr] = child_node.children.
|
22
|
+
params[child_node_attr] = child_node.children.to_html(:encoding => 'utf-8')
|
22
23
|
else
|
23
24
|
attr_value = ''
|
24
25
|
child_node.children.each do |inside_node|
|
@@ -37,7 +38,8 @@ class AhcxTemplateHandler
|
|
37
38
|
ahcx.children.first.children.each do |node|
|
38
39
|
content += node_content(node)
|
39
40
|
end
|
40
|
-
|
41
|
+
compressor = HtmlCompressor::Compressor.new(:remove_intertag_spaces => true)
|
42
|
+
compressor.compress(content)
|
41
43
|
end
|
42
44
|
|
43
45
|
end
|