ahc 0.2.2 → 0.2.4

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/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
  gem 'erubis'
6
6
  gem 'nokogiri'
7
+ gem 'htmlcompressor'
7
8
 
8
9
  # Add dependencies to develop your gem here.
9
10
  # Include everything needed to run rake, tests, features, etc.
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
@@ -3,7 +3,7 @@ require 'ahcx_template_handler'
3
3
 
4
4
  class Ahc
5
5
 
6
- def self.render(template_name, params, css_map = {})
6
+ def self.render(template_name, params)
7
7
  if @@templates[template_name]
8
8
  css = lambda {|css_class|
9
9
  @@css_map[css_class] || css_class
@@ -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.to_s
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
- content
41
+ compressor = HtmlCompressor::Compressor.new(:remove_intertag_spaces => true)
42
+ compressor.compress(content)
41
43
  end
42
44
 
43
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: