hamlizer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hamlizer
2
2
 
3
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/lilibethdlc/hamlizer)
3
+ [![Code Climate](https://codeclimate.com/github/lilibethdlc/hamlizer.png)](https://codeclimate.com/github/lilibethdlc/hamlizer)
4
4
 
5
5
  HTML/ERB to HAML converter
6
6
 
@@ -1,38 +1,40 @@
1
- class AttributesHamlConverter
2
- def initialize(element)
3
- @element = element
4
- end
1
+ module Hamlizer
2
+ class AttributesHamlConverter
3
+ def initialize(element)
4
+ @element = element
5
+ end
5
6
 
6
- def haml
7
- element.has_attributes? ? (id_haml + class_haml + regular_attributes_haml) : ''
8
- end
7
+ def haml
8
+ element.has_attributes? ? (id_haml + class_haml + regular_attributes_haml) : ''
9
+ end
9
10
 
10
- private
11
+ private
11
12
 
12
- attr_reader :element
13
+ attr_reader :element
13
14
 
14
- def attribute_haml(name, value)
15
- if name.match(/^\w+$/)
16
- attribute_name = "#{name}:"
17
- else
18
- attribute_name = "'#{name}' =>"
15
+ def attribute_haml(name, value)
16
+ if name.match(/^\w+$/)
17
+ attribute_name = "#{name}:"
18
+ else
19
+ attribute_name = "'#{name}' =>"
20
+ end
21
+ "#{attribute_name} '#{value}'"
19
22
  end
20
- "#{attribute_name} '#{value}'"
21
- end
22
23
 
23
- def class_haml
24
- element.html_class ? ".#{element.html_class.gsub(/\s+/, '.')}" : ''
25
- end
24
+ def class_haml
25
+ element.html_class ? ".#{element.html_class.gsub(/\s+/, '.')}" : ''
26
+ end
26
27
 
27
- def id_haml
28
- element.id ? "##{element.id}" : ''
29
- end
28
+ def id_haml
29
+ element.id ? "##{element.id}" : ''
30
+ end
30
31
 
31
- def regular_attributes_haml
32
- attributes_haml = element.regular_attributes.map do |name, value|
33
- attribute_haml name, value
34
- end.compact.join(', ')
32
+ def regular_attributes_haml
33
+ attributes_haml = element.regular_attributes.map do |name, value|
34
+ attribute_haml name, value
35
+ end.compact.join(', ')
35
36
 
36
- attributes_haml.empty? ? '' : "{ #{attributes_haml} }"
37
+ attributes_haml.empty? ? '' : "{ #{attributes_haml} }"
38
+ end
37
39
  end
38
40
  end
@@ -0,0 +1,31 @@
1
+ module Hamlizer
2
+ class ContentPrinter
3
+ def initialize(element_converter)
4
+ @element_converter = element_converter
5
+ end
6
+
7
+ def content
8
+ "\n#{level_spacing}#{ElementHamlConverter.new(element_converter.element, element_converter.level + 1).haml}"
9
+ end
10
+
11
+ private
12
+ attr_reader :element_converter
13
+
14
+ def element_content
15
+ element_converter.element.content.gsub("\n", ' ').strip
16
+ end
17
+
18
+ def level_spacing
19
+ ' ' * element_converter.level
20
+ end
21
+
22
+ def content_haml(code = nil)
23
+ if element_converter.element.only_child?
24
+ "#{code} #{element_content}"
25
+ else
26
+ code += ' ' if code
27
+ "\n#{level_spacing}#{code}#{element_content}"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ module Hamlizer
2
+ class ContentPrinterFactory
3
+ def self.printer_for(element_converter)
4
+ case element_converter.element.name
5
+ when 'erb_print'
6
+ ErbContentPrinter.new(element_converter)
7
+ when 'erb_non_print'
8
+ NonErbContentPrinter.new(element_converter)
9
+ when 'text'
10
+ TextContentPrinter.new(element_converter)
11
+ else
12
+ ContentPrinter.new(element_converter)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,75 +1,42 @@
1
- class ElementHamlConverter
2
- def initialize(element, level = 1)
3
- @element = element
4
- @level = level
5
- end
1
+ module Hamlizer
2
+ class ElementHamlConverter
3
+ def initialize(element, level = 1)
4
+ @element = element
5
+ @level = level
6
+ end
6
7
 
7
- def haml
8
- element_name_haml + attributes_haml + element_content_haml
9
- end
8
+ def haml
9
+ element_name_haml + attributes_haml + element_content_haml
10
+ end
10
11
 
11
- private
12
+ attr_reader :element, :level
12
13
 
13
- attr_reader :element, :level
14
+ private
14
15
 
15
- def attributes_haml
16
- attributes_haml_converter.haml
17
- end
16
+ def attributes_haml
17
+ attributes_haml_converter.haml
18
+ end
18
19
 
19
- def attributes_haml_converter
20
- AttributesHamlConverter.new(element)
21
- end
20
+ def attributes_haml_converter
21
+ AttributesHamlConverter.new(element)
22
+ end
22
23
 
23
- def element_content_haml
24
- content_haml = element.children.map do |child|
25
- if child.name == 'erb_print'
26
- erb_print_haml(child)
27
- elsif child.name == 'erb_non_print'
28
- erb_non_print_haml(child)
29
- elsif child.name == 'text'
30
- text_haml(child)
24
+ def element_content_haml
25
+ if element.children.any?
26
+ element.children.map do |child|
27
+ ContentPrinterFactory.printer_for(ElementHamlConverter.new(child, level)).content
28
+ end.join
31
29
  else
32
- "\n#{level_spacing}#{ElementHamlConverter.new(child, level + 1).haml}"
30
+ element.content
33
31
  end
34
- end.join
35
-
36
- content_haml
37
- end
38
-
39
- def element_name_haml
40
- should_include_name_in_haml? ? "%#{element.name}" : ''
41
- end
42
-
43
- def child_content(child)
44
- child.content.gsub("\n", ' ').strip
45
- end
46
-
47
- def child_haml(child, code = nil)
48
- if child.only_child?
49
- "#{code} #{child_content(child)}"
50
- else
51
- code += ' ' if code
52
- "\n#{level_spacing}#{code}#{child_content(child)}"
53
32
  end
54
- end
55
-
56
- def erb_non_print_haml(element)
57
- child_haml(element, '-')
58
- end
59
-
60
- def erb_print_haml(element)
61
- child_haml(element, '=')
62
- end
63
-
64
- def level_spacing
65
- ' ' * level
66
- end
67
33
 
68
- def should_include_name_in_haml?
69
- (!element.div? || (element.has_id? && element.has_class?))
70
- end
34
+ def element_name_haml
35
+ exclude_name_from_haml? ? '' : "%#{element.name}"
36
+ end
71
37
 
72
- def text_haml(element)
73
- child_haml(element)
38
+ def exclude_name_from_haml?
39
+ element.text? || (element.div? && (element.has_id? || element.has_class?))
40
+ end
74
41
  end
75
42
  end
@@ -0,0 +1,7 @@
1
+ module Hamlizer
2
+ class ErbContentPrinter < ContentPrinter
3
+ def content
4
+ content_haml('=')
5
+ end
6
+ end
7
+ end
@@ -1,60 +1,65 @@
1
1
  require 'nokogiri'
2
2
 
3
- class HtmlElement
4
- def initialize(element)
5
- @element = element
6
- end
3
+ module Hamlizer
4
+ class HtmlElement
5
+ def initialize(element)
6
+ @element = element
7
+ end
7
8
 
8
- def children
9
- element.children.map { |child| HtmlElement.new child }
10
- end
9
+ def children
10
+ element.children.map { |child| HtmlElement.new child }
11
+ end
11
12
 
12
- def content
13
- element.content
14
- end
13
+ def content
14
+ element.content
15
+ end
15
16
 
16
- def div?
17
- element.name == 'div'
18
- end
17
+ def div?
18
+ element.name == 'div'
19
+ end
19
20
 
20
- def has_attributes?
21
- element.attributes.any?
22
- end
21
+ def has_attributes?
22
+ element.attributes.any?
23
+ end
23
24
 
24
- def has_class?
25
- html_class.nil?
26
- end
25
+ def has_class?
26
+ !html_class.nil?
27
+ end
27
28
 
28
- def has_content?
29
- content && !content.empty?
30
- end
29
+ def has_content?
30
+ content && !content.empty?
31
+ end
31
32
 
32
- def has_id?
33
- id.nil?
34
- end
33
+ def has_id?
34
+ !id.nil?
35
+ end
35
36
 
36
- def only_child?
37
- element.parent.children.count == 1
38
- end
37
+ def only_child?
38
+ element.parent.children.count == 1
39
+ end
39
40
 
40
- def html_class
41
- @class ||= element['class']
42
- end
41
+ def html_class
42
+ @class ||= element['class']
43
+ end
43
44
 
44
- def id
45
- @id ||= element['id']
46
- end
45
+ def id
46
+ @id ||= element['id']
47
+ end
47
48
 
48
- def name
49
- element.name
50
- end
49
+ def name
50
+ element.name
51
+ end
51
52
 
52
- def regular_attributes
53
- Hash[element.attributes.select { |name, _| !%w(id class).include? name }]
54
- end
53
+ def regular_attributes
54
+ Hash[element.attributes.select { |name, _| !%w(id class).include? name }]
55
+ end
55
56
 
56
- private
57
+ def text?
58
+ element.name == 'text'
59
+ end
57
60
 
58
- attr_reader :element, :parent
59
- end
61
+ private
60
62
 
63
+ attr_reader :element, :parent
64
+ end
65
+ end
@@ -0,0 +1,7 @@
1
+ module Hamlizer
2
+ class NonErbContentPrinter < ContentPrinter
3
+ def content
4
+ content_haml('-')
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Hamlizer
2
+ class TextContentPrinter < ContentPrinter
3
+ def content
4
+ content_haml
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Hamlizer
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/hamlizer.rb CHANGED
@@ -2,10 +2,16 @@ require 'hamlizer/version'
2
2
  require 'hamlizer/html_element'
3
3
  require 'hamlizer/element_haml_converter'
4
4
  require 'hamlizer/attributes_haml_converter'
5
+ require 'hamlizer/content_printer'
6
+ require 'hamlizer/content_printer_factory'
7
+ require 'hamlizer/erb_content_printer'
8
+ require 'hamlizer/non_erb_content_printer'
9
+ require 'hamlizer/text_content_printer'
5
10
  require 'nokogiri'
6
11
 
7
12
  module Hamlizer
8
13
  def self.hamlize(html)
14
+ html.strip!
9
15
  convert_erb_to_parseable_xml!(html)
10
16
 
11
17
  if html.start_with?('<html>')
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ module Hamlizer
4
+ describe HtmlElement do
5
+ let(:element) { {} }
6
+ subject { HtmlElement.new element }
7
+
8
+ describe '#has_id?' do
9
+ context 'when the source element has an id' do
10
+ let(:element) { { 'id' => 'identificador' } }
11
+
12
+ it 'returns true' do
13
+ expect(subject).to have_id
14
+ end
15
+ end
16
+
17
+ context 'when the source element does not have an id' do
18
+ it 'returns false' do
19
+ expect(subject).to_not have_id
20
+ end
21
+ end
22
+ end
23
+
24
+ describe '#has_class?' do
25
+ context 'when the source element has a class' do
26
+ let(:element) { { 'class' => 'clase' } }
27
+
28
+ it 'returns true' do
29
+ expect(subject).to have_class
30
+ end
31
+ end
32
+
33
+ context 'when the source element does not have a class' do
34
+ it 'returns false' do
35
+ expect(subject).to_not have_class
36
+ end
37
+ end
38
+ end
39
+
40
+ describe '#text?' do
41
+ context 'when the source element\'s name is "text"' do
42
+ let(:element) { double('element', name: 'text') }
43
+
44
+ it 'returns true' do
45
+ expect(subject).to be_text
46
+ end
47
+ end
48
+
49
+ context 'when the source element\'s name is something other than "text"' do
50
+ let(:element) { double('element', name: 'hello') }
51
+
52
+ it 'returns true' do
53
+ expect(subject).to_not be_text
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,113 +1,138 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Hamlizer do
4
- describe '.hamlize' do
5
-
6
- it 'leaves an empty string alone' do
7
- expect(hamlize('')).to eq ''
8
- end
9
-
10
- it 'returns empty string for whitespace' do
11
- expect(hamlize(' ')).to eq ''
12
- expect(hamlize("\n\n\n\n")).to eq ''
13
- end
14
-
15
- it 'converts an empty tag correctly' do
16
- expect(hamlize('<br/>')).to eq '%br'
17
- expect(hamlize('<br>')).to eq '%br'
18
- end
19
-
20
- it 'converts html standard layout tags correctly' do
21
- expect(hamlize('<html></html>')).to eq '%html'
22
- expect(hamlize('<html><body></body></html>')).to eq "%html\n %body"
23
- end
24
-
25
- it 'converts a tag with no content' do
26
- expect(hamlize('<span></span>')).to eq '%span'
27
- end
28
-
29
- it 'converts a tag with text content' do
30
- text = 'abc'
31
- expect(hamlize("<span>#{text}</span>")).to eq "%span #{text}"
32
- expect(hamlize("<span>#{text}\n#{text}</span>")).to eq "%span #{text} #{text}"
33
- end
34
-
35
- it 'converts multiple tags on the same level' do
36
- expect(hamlize('<br/><br/><br/>')).to eq "%br\n%br\n%br"
37
- text = 'hello'
38
- expect(hamlize("<span>#{text}</span><span/>")).to eq "%span #{text}\n%span"
39
- end
40
-
41
- it 'converts nested tags' do
42
- expect(hamlize('<div><span></span></div>')).to eq "%div\n %span"
43
- expect(hamlize('<div><p><span></span></p></div>')).to eq "%div\n %p\n %span"
44
- end
45
-
46
- it 'converts nested tags with content' do
47
- expect(hamlize('<div>abc<span>abc</span></div>')).to eq "%div\n abc\n %span abc"
48
- expect(hamlize('<div>abc<p>hello<span>abc</span></p></div>')).to eq "%div\n abc\n %p\n hello\n %span abc"
49
- end
50
-
51
- it 'converts a tag with attributes' do
52
- title = 'El Titulo'
53
- source = 'La Fuente'
54
-
55
- expect(hamlize("<span title='#{title}'></span>")).to eq "%span{ title: '#{title}' }"
56
- expect(hamlize("<span title='#{title}' source='#{source}'></span>")).to eq "%span{ title: '#{title}', source: '#{source}' }"
57
- expect(hamlize("<span title='#{title}' data-source='#{source}'></span>")).to eq "%span{ title: '#{title}', 'data-source' => '#{source}' }"
3
+ module Hamlizer
4
+ describe Hamlizer do
5
+ describe '.hamlize' do
6
+
7
+ it 'leaves an empty string alone' do
8
+ expect(hamlize('')).to eq ''
9
+ end
10
+
11
+ it 'leaves a non html text alone' do
12
+ expect(hamlize('hello')).to eq 'hello'
13
+ end
14
+
15
+ it 'returns empty string for whitespace' do
16
+ expect(hamlize(' ')).to eq ''
17
+ expect(hamlize("\n\n\n\n")).to eq ''
18
+ end
19
+
20
+ it 'converts an empty tag correctly' do
21
+ expect(hamlize('<br/>')).to eq '%br'
22
+ expect(hamlize('<br>')).to eq '%br'
23
+ end
24
+
25
+ it 'converts html standard layout tags correctly' do
26
+ expect(hamlize('<html></html>')).to eq '%html'
27
+ expect(hamlize('<html><body></body></html>')).to eq "%html\n %body"
28
+ end
29
+
30
+ it 'converts a tag with no content' do
31
+ expect(hamlize('<span></span>')).to eq '%span'
32
+ end
33
+
34
+ it 'converts a tag with text content' do
35
+ text = 'abc'
36
+ expect(hamlize("<span>#{text}</span>")).to eq "%span #{text}"
37
+ expect(hamlize("<span>#{text}\n#{text}</span>")).to eq "%span #{text} #{text}"
38
+ end
39
+
40
+ it 'converts multiple tags on the same level' do
41
+ expect(hamlize('<br/><br/><br/>')).to eq "%br\n%br\n%br"
42
+ text = 'hello'
43
+ expect(hamlize("<span>#{text}</span><span/>")).to eq "%span #{text}\n%span"
44
+ end
45
+
46
+ it 'converts nested tags' do
47
+ expect(hamlize('<div><span></span></div>')).to eq "%div\n %span"
48
+ expect(hamlize('<div><p><span></span></p></div>')).to eq "%div\n %p\n %span"
49
+ end
50
+
51
+ it 'converts nested tags with content' do
52
+ expect(hamlize('<div>abc<span>def</span></div>')).to eq "%div\n abc\n %span def"
53
+ expect(hamlize('<div>abc<p>hello<span>abc</span></p></div>')).to eq "%div\n abc\n %p\n hello\n %span abc"
54
+ end
55
+
56
+ it 'converts a tag with attributes' do
57
+ title = 'El Titulo'
58
+ source = 'La Fuente'
59
+
60
+ expect(hamlize("<span title='#{title}'></span>")).to eq "%span{ title: '#{title}' }"
61
+ expect(hamlize("<span title='#{title}' source='#{source}'></span>")).to eq "%span{ title: '#{title}', source: '#{source}' }"
62
+ expect(hamlize("<span title='#{title}' data-source='#{source}'></span>")).to eq "%span{ title: '#{title}', 'data-source' => '#{source}' }"
63
+ end
64
+
65
+ it 'uses the "#id" syntax for the id attribute' do
66
+ id = 'el_identificador'
67
+ title = 'El Titulo'
68
+
69
+ expect(hamlize("<span id='#{id}'></span>")).to eq "%span##{id}"
70
+ expect(hamlize("<span id='#{id}' title='#{title}'></span>")).to eq "%span##{id}{ title: '#{title}' }"
71
+ end
72
+
73
+ it 'uses the ".class" syntax for the class attribute' do
74
+ html_class = 'la_clase'
75
+ title = 'El Titulo'
76
+
77
+ expect(hamlize("<span class='#{html_class}'></span>")).to eq "%span.#{html_class}"
78
+ expect(hamlize("<span class='#{html_class}' title='#{title}'></span>")).to eq "%span.#{html_class}{ title: '#{title}' }"
79
+
80
+ html_classes = %w(una_clase otra_clase)
81
+ expect(hamlize("<span class='#{html_classes.join(' ')}' title='#{title}'></span>")).to eq "%span.#{html_classes.join('.')}{ title: '#{title}' }"
82
+ expect(hamlize("<span class='#{html_classes.join(' ')}' title='#{title}'></span>")).to eq "%span.#{html_classes.join('.')}{ title: '#{title}' }"
83
+ end
84
+
85
+ context 'when hamlizing the div tag' do
86
+ let(:title) { 'El Titulo' }
87
+ let(:html_class) { 'la_clase' }
88
+ let(:id) { 'el_identificador' }
89
+
90
+ it 'includes %div when the tag does not have any attributes' do
91
+ expect(hamlize('<div></div>')).to eq '%div'
92
+ end
93
+
94
+ it 'includes %div when the attributes are not id or class' do
95
+ expect(hamlize("<div title='#{title}'></div>")).to eq "%div{ title: '#{title}' }"
96
+ end
97
+
98
+ it 'uses "#" when the div has an id attribute' do
99
+ expect(hamlize("<div id='#{id}'></div>")).to eq "##{id}"
100
+ end
101
+
102
+ it 'uses "." when the div has just one class in the class attribute' do
103
+ expect(hamlize("<div class='#{html_class}'></div>")).to eq ".#{html_class}"
104
+ end
105
+
106
+ it 'uses "..." when the div has more than one class in the class attribute' do
107
+ expect(hamlize("<div class='hola tu'></div>")).to eq '.hola.tu'
108
+ end
109
+
110
+ it 'uses "#." when the div has both id and class attributes' do
111
+ expect(hamlize("<div class='#{html_class}' id='#{id}'></div>")).to eq "##{id}.#{html_class}"
112
+ end
113
+ end
114
+
115
+ it 'parses erb printing code' do
116
+ expect(hamlize('<strong><%= item.title %></strong>')).to eq '%strong= item.title'
117
+ expect(hamlize('<p><%= hello %><strong><%= item.title %></strong></p>')).to eq "%p\n = hello\n %strong= item.title"
118
+ expect(hamlize('<p><% hello %><strong><%= item.title %></strong></p>')).to eq "%p\n - hello\n %strong= item.title"
119
+ end
120
+
121
+ it 'parses erb non-printing code' do
122
+ expect(hamlize('<div><% a = 2 + 2 %></div>')).to eq '%div- a = 2 + 2'
123
+ end
124
+ end
125
+
126
+ def hamlize(html)
127
+ haml = Hamlizer.hamlize(html)
128
+
129
+ begin
130
+ Haml::Engine.new(haml).to_html
131
+ rescue Exception => e
132
+ raise e.class, "#{e.message}\nIn:\n#{haml}" unless [NameError, NoMethodError].include? e.class
133
+ end
134
+
135
+ haml
58
136
  end
59
-
60
- it 'uses the "#id" syntax for the id attribute' do
61
- id = 'el_identificador'
62
- title = 'El Titulo'
63
-
64
- expect(hamlize("<span id='#{id}'></span>")).to eq "%span##{id}"
65
- expect(hamlize("<span id='#{id}' title='#{title}'></span>")).to eq "%span##{id}{ title: '#{title}' }"
66
- end
67
-
68
- it 'uses the ".class" syntax for the class attribute' do
69
- html_class = 'la_clase'
70
- title = 'El Titulo'
71
-
72
- expect(hamlize("<span class='#{html_class}'></span>")).to eq "%span.#{html_class}"
73
- expect(hamlize("<span class='#{html_class}' title='#{title}'></span>")).to eq "%span.#{html_class}{ title: '#{title}' }"
74
-
75
- html_classes = %w(una_clase otra_clase)
76
- expect(hamlize("<span class='#{html_classes.join(' ')}' title='#{title}'></span>")).to eq "%span.#{html_classes.join('.')}{ title: '#{title}' }"
77
- expect(hamlize("<span class='#{html_classes.join(' ')}' title='#{title}'></span>")).to eq "%span.#{html_classes.join('.')}{ title: '#{title}' }"
78
- end
79
-
80
- it 'does not use %div for divs that have an id or a class' do
81
- id = 'el_identificador'
82
- html_class = 'la_clase'
83
- title = 'El Titulo'
84
-
85
- expect(hamlize('<div></div>')).to eq '%div'
86
- expect(hamlize("<div title='#{title}'></div>")).to eq "%div{ title: '#{title}' }"
87
- expect(hamlize("<div id='#{id}'></div>")).to eq "##{id}"
88
- expect(hamlize("<div class='#{html_class}'></div>")).to eq ".#{html_class}"
89
- end
90
-
91
- it 'parses erb printing code', :focus do
92
- expect(hamlize('<strong><%= item.title %></strong>')).to eq '%strong= item.title'
93
- expect(hamlize('<p><%= hello %><strong><%= item.title %></strong></p>')).to eq "%p\n = hello\n %strong= item.title"
94
- expect(hamlize('<p><% hello %><strong><%= item.title %></strong></p>')).to eq "%p\n - hello\n %strong= item.title"
95
- end
96
-
97
- it 'parses erb non-printing code' do
98
- expect(hamlize('<div><% a = 2 + 2 %></div>')).to eq '%div- a = 2 + 2'
99
- end
100
- end
101
-
102
- def hamlize(html)
103
- haml = Hamlizer.hamlize(html)
104
-
105
- begin
106
- Haml::Engine.new(haml).to_html
107
- rescue Exception => e
108
- raise e.class, "#{e.message}\nIn: #{haml}" unless [NameError, NoMethodError].include? e.class
109
- end
110
-
111
- haml
112
137
  end
113
138
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-23 00:00:00.000000000 Z
13
+ date: 2013-03-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -77,9 +77,15 @@ files:
77
77
  - hamlizer.gemspec
78
78
  - lib/hamlizer.rb
79
79
  - lib/hamlizer/attributes_haml_converter.rb
80
+ - lib/hamlizer/content_printer.rb
81
+ - lib/hamlizer/content_printer_factory.rb
80
82
  - lib/hamlizer/element_haml_converter.rb
83
+ - lib/hamlizer/erb_content_printer.rb
81
84
  - lib/hamlizer/html_element.rb
85
+ - lib/hamlizer/non_erb_content_printer.rb
86
+ - lib/hamlizer/text_content_printer.rb
82
87
  - lib/hamlizer/version.rb
88
+ - spec/lib/hamlizer/html_element_spec.rb
83
89
  - spec/lib/hamlizer_spec.rb
84
90
  - spec/spec_helper.rb
85
91
  homepage: ''
@@ -102,10 +108,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
108
  version: '0'
103
109
  requirements: []
104
110
  rubyforge_project:
105
- rubygems_version: 1.8.24
111
+ rubygems_version: 1.8.25
106
112
  signing_key:
107
113
  specification_version: 3
108
114
  summary: HTML/ERB to HAML converter
109
115
  test_files:
116
+ - spec/lib/hamlizer/html_element_spec.rb
110
117
  - spec/lib/hamlizer_spec.rb
111
118
  - spec/spec_helper.rb