hamlizer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/bin/hamlize +17 -0
- data/hamlizer.gemspec +3 -3
- data/lib/hamlizer/content_printer.rb +2 -2
- data/lib/hamlizer/element_haml_converter.rb +14 -7
- data/lib/hamlizer/element_name_printer.rb +25 -0
- data/lib/hamlizer/html_element.rb +37 -5
- data/lib/hamlizer/version.rb +1 -1
- data/lib/hamlizer.rb +15 -1
- data/spec/lib/hamlizer/html_element_spec.rb +207 -0
- data/spec/lib/hamlizer_spec.rb +26 -3
- data/spec/test_files/erb_1.html.erb +1 -0
- data/spec/test_files/erb_1.html.haml +3 -0
- data/spec/test_files/erb_on_root.html.erb +4 -0
- data/spec/test_files/erb_on_root.html.haml +4 -0
- data/spec/test_files/if_else.html.erb +7 -0
- data/spec/test_files/if_else.html.haml +6 -0
- data/spec/test_files/spaces.html.erb +1 -0
- data/spec/test_files/spaces.html.haml +1 -0
- data/spec/test_files/with_extra_line_breaks.haml +2 -0
- data/spec/test_files/with_extra_line_breaks.html +6 -0
- data/spec/test_files/with_extra_line_breaks.html.haml +4 -0
- metadata +47 -29
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 367d4b71fe6adf5eca2d1fb6714040b30fef3a74
|
4
|
+
data.tar.gz: 04d83a5b169f332dc8fb613eaff0111b2b50352b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 07590ba8387e8cc60a8cd8ed49a994dc66db78d2d4890f696320a07c1b2892e5f8080c63fd58ce716431a59a27ec9ae3166e8d017d65fe903bdc2133e783ada7
|
7
|
+
data.tar.gz: 2c9119ae7731393537a73e06e12457f98bb6f1aa18761deeba6269e80a71ca97cda0dc397a690a18f8f6881b392d0b1d92933fd6afd466b58039a67c8e2deda2
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
hamlizer
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
data/bin/hamlize
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'hamlizer'
|
4
|
+
|
5
|
+
input = ARGV.last.dup
|
6
|
+
from_file = File.exist?(input)
|
7
|
+
|
8
|
+
if input
|
9
|
+
html = from_file ? File.read(input) : input
|
10
|
+
output = Hamlizer.hamlize(html)
|
11
|
+
|
12
|
+
if from_file && ARGV.include?('-f')
|
13
|
+
File.open("#{input}.haml", 'w') { |file| file.write(output) }
|
14
|
+
else
|
15
|
+
puts output
|
16
|
+
end
|
17
|
+
end
|
data/hamlizer.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.add_dependency 'nokogiri'
|
20
|
+
gem.add_dependency 'nokogiri', '~> 1.5.9'
|
21
21
|
|
22
|
-
gem.add_development_dependency 'rspec'
|
23
|
-
gem.add_development_dependency 'haml'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 2.13.0'
|
23
|
+
gem.add_development_dependency 'haml', '~> 4.0.3'
|
24
24
|
end
|
@@ -5,7 +5,7 @@ module Hamlizer
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def content
|
8
|
-
"\n#{
|
8
|
+
"\n#{ElementHamlConverter.new(element_converter.element).haml}"
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -16,7 +16,7 @@ module Hamlizer
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def level_spacing
|
19
|
-
' ' *
|
19
|
+
' ' * Hamlizer.current_level
|
20
20
|
end
|
21
21
|
|
22
22
|
def content_haml(code = nil)
|
@@ -1,15 +1,17 @@
|
|
1
1
|
module Hamlizer
|
2
2
|
class ElementHamlConverter
|
3
|
-
def initialize
|
3
|
+
def initialize element
|
4
4
|
@element = element
|
5
|
-
@level = level
|
6
5
|
end
|
7
6
|
|
8
7
|
def haml
|
9
|
-
|
8
|
+
Hamlizer.current_level -= 1 if element.else?
|
9
|
+
complete_haml = element_name_haml + attributes_haml + element_content_haml
|
10
|
+
Hamlizer.current_level += 1 if element.if? || element.else?
|
11
|
+
element.end? ? nil : complete_haml
|
10
12
|
end
|
11
13
|
|
12
|
-
attr_reader :element
|
14
|
+
attr_reader :element
|
13
15
|
|
14
16
|
private
|
15
17
|
|
@@ -23,16 +25,21 @@ module Hamlizer
|
|
23
25
|
|
24
26
|
def element_content_haml
|
25
27
|
if element.children.any?
|
26
|
-
|
27
|
-
|
28
|
+
Hamlizer.current_level += 1
|
29
|
+
|
30
|
+
children_haml = element.children.map do |child|
|
31
|
+
ContentPrinterFactory.printer_for(ElementHamlConverter.new(child)).content
|
28
32
|
end.join
|
33
|
+
|
34
|
+
Hamlizer.current_level -= 1
|
35
|
+
children_haml
|
29
36
|
else
|
30
37
|
element.content
|
31
38
|
end
|
32
39
|
end
|
33
40
|
|
34
41
|
def element_name_haml
|
35
|
-
exclude_name_from_haml? ? '' :
|
42
|
+
exclude_name_from_haml? ? '' : ElementNamePrinter.new(element).name
|
36
43
|
end
|
37
44
|
|
38
45
|
def exclude_name_from_haml?
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Hamlizer
|
2
|
+
class ElementNamePrinter
|
3
|
+
def initialize element
|
4
|
+
@element = element
|
5
|
+
end
|
6
|
+
|
7
|
+
def name
|
8
|
+
case element.name
|
9
|
+
when 'erb_print'
|
10
|
+
"#{level_spacing}="
|
11
|
+
when 'erb_non_print'
|
12
|
+
"#{level_spacing}-"
|
13
|
+
else
|
14
|
+
"#{level_spacing}%#{element.name}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def level_spacing
|
19
|
+
' ' * Hamlizer.current_level
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
attr_reader :element
|
24
|
+
end
|
25
|
+
end
|
@@ -7,17 +7,41 @@ module Hamlizer
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def children
|
10
|
-
element.children.map { |child| HtmlElement.new child }
|
10
|
+
element.children.map { |child| HtmlElement.new child }.select(&:has_content?)
|
11
11
|
end
|
12
12
|
|
13
13
|
def content
|
14
|
-
element.content
|
14
|
+
element.content.strip
|
15
15
|
end
|
16
16
|
|
17
17
|
def div?
|
18
18
|
element.name == 'div'
|
19
19
|
end
|
20
20
|
|
21
|
+
def else?
|
22
|
+
(parent.erb? && text? && content.start_with?('els')) || (erb? && children.all?(&:else?))
|
23
|
+
end
|
24
|
+
|
25
|
+
def empty?
|
26
|
+
text? && (!content || content.empty?)
|
27
|
+
end
|
28
|
+
|
29
|
+
def end?
|
30
|
+
parent.erb? && text? && content.start_with?('end') || (erb? && children.all?(&:end?))
|
31
|
+
end
|
32
|
+
|
33
|
+
def erb?
|
34
|
+
erb_print? || erb_non_print?
|
35
|
+
end
|
36
|
+
|
37
|
+
def erb_print?
|
38
|
+
name == 'erb_print'
|
39
|
+
end
|
40
|
+
|
41
|
+
def erb_non_print?
|
42
|
+
name == 'erb_non_print'
|
43
|
+
end
|
44
|
+
|
21
45
|
def has_attributes?
|
22
46
|
element.attributes.any?
|
23
47
|
end
|
@@ -27,7 +51,7 @@ module Hamlizer
|
|
27
51
|
end
|
28
52
|
|
29
53
|
def has_content?
|
30
|
-
|
54
|
+
!empty?
|
31
55
|
end
|
32
56
|
|
33
57
|
def has_id?
|
@@ -35,7 +59,11 @@ module Hamlizer
|
|
35
59
|
end
|
36
60
|
|
37
61
|
def only_child?
|
38
|
-
|
62
|
+
parent.children.count == 1
|
63
|
+
end
|
64
|
+
|
65
|
+
def parent
|
66
|
+
HtmlElement.new element.parent
|
39
67
|
end
|
40
68
|
|
41
69
|
def html_class
|
@@ -46,6 +74,10 @@ module Hamlizer
|
|
46
74
|
@id ||= element['id']
|
47
75
|
end
|
48
76
|
|
77
|
+
def if?
|
78
|
+
parent.erb? && text? && content.start_with?('if') || (erb? && children.all?(&:if?))
|
79
|
+
end
|
80
|
+
|
49
81
|
def name
|
50
82
|
element.name
|
51
83
|
end
|
@@ -60,6 +92,6 @@ module Hamlizer
|
|
60
92
|
|
61
93
|
private
|
62
94
|
|
63
|
-
attr_reader :element
|
95
|
+
attr_reader :element
|
64
96
|
end
|
65
97
|
end
|
data/lib/hamlizer/version.rb
CHANGED
data/lib/hamlizer.rb
CHANGED
@@ -7,11 +7,14 @@ require 'hamlizer/content_printer_factory'
|
|
7
7
|
require 'hamlizer/erb_content_printer'
|
8
8
|
require 'hamlizer/non_erb_content_printer'
|
9
9
|
require 'hamlizer/text_content_printer'
|
10
|
+
require 'hamlizer/element_name_printer'
|
10
11
|
require 'nokogiri'
|
11
12
|
|
12
13
|
module Hamlizer
|
13
14
|
def self.hamlize(html)
|
15
|
+
self.current_level = 0
|
14
16
|
html.strip!
|
17
|
+
html.squeeze! ' '
|
15
18
|
convert_erb_to_parseable_xml!(html)
|
16
19
|
|
17
20
|
if html.start_with?('<html>')
|
@@ -22,7 +25,10 @@ module Hamlizer
|
|
22
25
|
|
23
26
|
return '' if root.nil?
|
24
27
|
|
25
|
-
children_haml = root.children.map
|
28
|
+
children_haml = root.children.map do |element|
|
29
|
+
haml = ElementHamlConverter.new(HtmlElement.new(element)).haml
|
30
|
+
haml && !haml.empty? ? haml : nil
|
31
|
+
end.compact.join("\n")
|
26
32
|
|
27
33
|
if html.start_with?('<html>')
|
28
34
|
haml = "%html"
|
@@ -45,4 +51,12 @@ module Hamlizer
|
|
45
51
|
def self.remove_erb_printing_code!(html)
|
46
52
|
html.gsub!(/<%=(.+?)%>/, '<erb:erb_print>\1</erb:erb_print>')
|
47
53
|
end
|
54
|
+
|
55
|
+
def self.current_level
|
56
|
+
@@current_level
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.current_level= level
|
60
|
+
@@current_level = level
|
61
|
+
end
|
48
62
|
end
|
@@ -54,5 +54,212 @@ module Hamlizer
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
describe 'erb_non_print?' do
|
59
|
+
context 'when the element is an erb_non_print' do
|
60
|
+
let(:element) { double(:element, name: 'erb_non_print') }
|
61
|
+
it 'returns true' do
|
62
|
+
expect(subject).to be_erb_non_print
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when the element is not an erb_non_print' do
|
67
|
+
let(:element) { double(:element, name: 'text') }
|
68
|
+
it 'returns false' do
|
69
|
+
expect(subject).to_not be_erb_non_print
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'erb_print?' do
|
75
|
+
context 'when the element is an erb_print' do
|
76
|
+
let(:element) { double(:element, name: 'erb_print') }
|
77
|
+
it 'returns true' do
|
78
|
+
expect(subject).to be_erb_print
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'when the element is not an erb_print' do
|
83
|
+
let(:element) { double(:element, name: 'text') }
|
84
|
+
it 'returns false' do
|
85
|
+
expect(subject).to_not be_erb_print
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'erb?' do
|
91
|
+
context 'when the element is an erb_print' do
|
92
|
+
before { subject.stub(erb_print?: true, erb_non_print?: false) }
|
93
|
+
|
94
|
+
it 'returns true' do
|
95
|
+
expect(subject).to be_erb
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when the element is an erb_non_print' do
|
100
|
+
before { subject.stub(erb_print?: false, erb_non_print?: true) }
|
101
|
+
|
102
|
+
it 'returns true' do
|
103
|
+
expect(subject).to be_erb
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'when the element is not an erb element' do
|
108
|
+
before { subject.stub(erb_print?: false, erb_non_print?: false) }
|
109
|
+
|
110
|
+
it 'returns true' do
|
111
|
+
expect(subject).to_not be_erb
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe 'if?' do
|
117
|
+
context 'when the element is an if' do
|
118
|
+
let(:parent) { double(:parent, name: 'erb_non_print', erb?: true) }
|
119
|
+
let(:element) { double(:element, name: 'text', content: 'if true', parent: parent) }
|
120
|
+
|
121
|
+
it 'returns true' do
|
122
|
+
expect(subject).to be_if
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'when the element is not an if' do
|
127
|
+
let(:parent) { double(:parent, name: 'text', erb?: false) }
|
128
|
+
let(:element) { double(:element, name: 'text', content: 'if true', parent: parent) }
|
129
|
+
|
130
|
+
it 'returns false' do
|
131
|
+
expect(subject).to_not be_if
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe 'else?' do
|
137
|
+
context 'when the element is an else' do
|
138
|
+
let(:parent) { double(:parent, name: 'erb_non_print', erb?: true) }
|
139
|
+
let(:element) { double(:element, name: 'text', content: 'else', parent: parent) }
|
140
|
+
|
141
|
+
it 'returns true' do
|
142
|
+
expect(subject).to be_else
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'when the element is an else' do
|
147
|
+
let(:parent) { double(:parent, name: 'erb_non_print', erb?: true) }
|
148
|
+
let(:element) { double(:element, name: 'text', content: 'elsif', parent: parent) }
|
149
|
+
|
150
|
+
it 'returns true' do
|
151
|
+
expect(subject).to be_else
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'when the element is not an else' do
|
156
|
+
let(:parent) { double(:parent, name: 'text', erb?: false) }
|
157
|
+
let(:element) { double(:element, name: 'text', content: 'not true', parent: parent) }
|
158
|
+
|
159
|
+
it 'returns false' do
|
160
|
+
expect(subject).to_not be_else
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe 'end?' do
|
166
|
+
context 'when the element is an end' do
|
167
|
+
let(:parent) { double(:parent, name: 'erb_non_print', erb?: true) }
|
168
|
+
let(:element) { double(:element, name: 'text', content: 'end', parent: parent) }
|
169
|
+
|
170
|
+
it 'returns true' do
|
171
|
+
expect(subject).to be_end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'when the element is not an end' do
|
176
|
+
let(:parent) { double(:parent, name: 'text', erb?: true) }
|
177
|
+
let(:element) { double(:element, name: 'text', content: 'if true', parent: parent) }
|
178
|
+
|
179
|
+
it 'returns false' do
|
180
|
+
expect(subject).to_not be_end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context 'when the element is not an end' do
|
185
|
+
let(:parent) { double(:parent, name: 'text', erb?: false) }
|
186
|
+
let(:element) { double(:element, name: 'text', content: 'if true', parent: parent) }
|
187
|
+
|
188
|
+
it 'returns false' do
|
189
|
+
expect(subject).to_not be_end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe '#only_child?' do
|
195
|
+
let(:parent) { double(:parent, children: children) }
|
196
|
+
|
197
|
+
before do
|
198
|
+
subject.stub(parent: parent)
|
199
|
+
end
|
200
|
+
|
201
|
+
context 'when the element is an only child' do
|
202
|
+
let(:children) { [element] }
|
203
|
+
let(:element) { double(:element) }
|
204
|
+
|
205
|
+
it 'returns true' do
|
206
|
+
expect(subject).to be_only_child
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context 'when the element is not an only child' do
|
211
|
+
let(:element) { double(:element) }
|
212
|
+
|
213
|
+
let(:child1) { double(:child1) }
|
214
|
+
let(:child2) { double(:child1) }
|
215
|
+
let(:children) { [element, child1, child2] }
|
216
|
+
|
217
|
+
it 'returns false' do
|
218
|
+
expect(subject).to_not be_only_child
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
describe '#empty?' do
|
224
|
+
context 'when the element is of type text and' do
|
225
|
+
before { subject.stub(text?: true) }
|
226
|
+
|
227
|
+
context 'it has content' do
|
228
|
+
let(:element) { double(:element, content: 'hello') }
|
229
|
+
|
230
|
+
it 'returns false' do
|
231
|
+
expect(subject).to_not be_empty
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'it does not have any content' do
|
236
|
+
let(:element) { double(:element, content: '') }
|
237
|
+
|
238
|
+
it 'returns true' do
|
239
|
+
expect(subject).to be_empty
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
context 'when the element is not of type text and' do
|
245
|
+
before { subject.stub(text?: false) }
|
246
|
+
|
247
|
+
context 'it has content' do
|
248
|
+
let(:element) { double(:element, content: 'hello') }
|
249
|
+
|
250
|
+
it 'returns false' do
|
251
|
+
expect(subject).to_not be_empty
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
context 'it does not have any content' do
|
256
|
+
let(:element) { double(:element, content: '') }
|
257
|
+
|
258
|
+
it 'returns true' do
|
259
|
+
expect(subject).to_not be_empty
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
57
264
|
end
|
58
265
|
end
|
data/spec/lib/hamlizer_spec.rb
CHANGED
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Hamlizer
|
4
4
|
describe Hamlizer do
|
5
5
|
describe '.hamlize' do
|
6
|
-
|
7
6
|
it 'leaves an empty string alone' do
|
8
7
|
expect(hamlize('')).to eq ''
|
9
8
|
end
|
@@ -17,6 +16,14 @@ module Hamlizer
|
|
17
16
|
expect(hamlize("\n\n\n\n")).to eq ''
|
18
17
|
end
|
19
18
|
|
19
|
+
it 'does not return unnecesary whitespace' do
|
20
|
+
expect(hamlize(content_from('with_extra_line_breaks.html')))
|
21
|
+
.to eq content_from('with_extra_line_breaks.haml')
|
22
|
+
|
23
|
+
expect(hamlize((" <p>Hello</p> <p>There</p> ")))
|
24
|
+
.to eq content_from('with_extra_line_breaks.haml')
|
25
|
+
end
|
26
|
+
|
20
27
|
it 'converts an empty tag correctly' do
|
21
28
|
expect(hamlize('<br/>')).to eq '%br'
|
22
29
|
expect(hamlize('<br>')).to eq '%br'
|
@@ -114,16 +121,28 @@ module Hamlizer
|
|
114
121
|
|
115
122
|
it 'parses erb printing code' do
|
116
123
|
expect(hamlize('<strong><%= item.title %></strong>')).to eq '%strong= item.title'
|
117
|
-
expect(hamlize('
|
124
|
+
expect(hamlize(content_from('erb_1.html.erb'))).to eq content_from('erb_1.html.haml')
|
118
125
|
expect(hamlize('<p><% hello %><strong><%= item.title %></strong></p>')).to eq "%p\n - hello\n %strong= item.title"
|
119
126
|
end
|
120
127
|
|
121
128
|
it 'parses erb non-printing code' do
|
122
129
|
expect(hamlize('<div><% a = 2 + 2 %></div>')).to eq '%div- a = 2 + 2'
|
123
130
|
end
|
131
|
+
|
132
|
+
it 'parses erb code at the root level' do
|
133
|
+
expect(hamlize(content_from('erb_on_root.html.erb'))).to eq content_from('erb_on_root.html.haml')
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'parses erb code for if-else' do
|
137
|
+
expect(hamlize(content_from('if_else.html.erb'))).to eq content_from('if_else.html.haml')
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'ignores extra spaces' do
|
141
|
+
expect(hamlize(content_from('spaces.html.erb'))).to eq content_from('spaces.html.haml')
|
142
|
+
end
|
124
143
|
end
|
125
144
|
|
126
|
-
def hamlize
|
145
|
+
def hamlize html
|
127
146
|
haml = Hamlizer.hamlize(html)
|
128
147
|
|
129
148
|
begin
|
@@ -134,5 +153,9 @@ module Hamlizer
|
|
134
153
|
|
135
154
|
haml
|
136
155
|
end
|
156
|
+
|
157
|
+
def content_from test_file_name
|
158
|
+
File.read("spec/test_files/#{test_file_name}").chomp
|
159
|
+
end
|
137
160
|
end
|
138
161
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<p><%= hello %><strong><%= item.title %></strong></p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p> <%= a %> </p>
|
@@ -0,0 +1 @@
|
|
1
|
+
%p= a
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lilibeth De La Cruz
|
@@ -10,76 +9,74 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-08-24 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: nokogiri
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
version: 1.5.9
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
27
|
+
version: 1.5.9
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: rspec
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
34
|
+
version: 2.13.0
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
41
|
+
version: 2.13.0
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: haml
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
48
|
+
version: 4.0.3
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
55
|
+
version: 4.0.3
|
63
56
|
description: Convert your views from HTML/ERB to HAML
|
64
57
|
email:
|
65
58
|
- lilibethdlc@gmail.com
|
66
59
|
- edggonzalezg@gmail.com
|
67
|
-
executables:
|
60
|
+
executables:
|
61
|
+
- hamlize
|
68
62
|
extensions: []
|
69
63
|
extra_rdoc_files: []
|
70
64
|
files:
|
71
65
|
- .gitignore
|
72
|
-
- .
|
66
|
+
- .ruby-gemset
|
67
|
+
- .ruby-version
|
73
68
|
- Gemfile
|
74
69
|
- LICENSE.txt
|
75
70
|
- README.md
|
76
71
|
- Rakefile
|
72
|
+
- bin/hamlize
|
77
73
|
- hamlizer.gemspec
|
78
74
|
- lib/hamlizer.rb
|
79
75
|
- lib/hamlizer/attributes_haml_converter.rb
|
80
76
|
- lib/hamlizer/content_printer.rb
|
81
77
|
- lib/hamlizer/content_printer_factory.rb
|
82
78
|
- lib/hamlizer/element_haml_converter.rb
|
79
|
+
- lib/hamlizer/element_name_printer.rb
|
83
80
|
- lib/hamlizer/erb_content_printer.rb
|
84
81
|
- lib/hamlizer/html_element.rb
|
85
82
|
- lib/hamlizer/non_erb_content_printer.rb
|
@@ -88,31 +85,52 @@ files:
|
|
88
85
|
- spec/lib/hamlizer/html_element_spec.rb
|
89
86
|
- spec/lib/hamlizer_spec.rb
|
90
87
|
- spec/spec_helper.rb
|
88
|
+
- spec/test_files/erb_1.html.erb
|
89
|
+
- spec/test_files/erb_1.html.haml
|
90
|
+
- spec/test_files/erb_on_root.html.erb
|
91
|
+
- spec/test_files/erb_on_root.html.haml
|
92
|
+
- spec/test_files/if_else.html.erb
|
93
|
+
- spec/test_files/if_else.html.haml
|
94
|
+
- spec/test_files/spaces.html.erb
|
95
|
+
- spec/test_files/spaces.html.haml
|
96
|
+
- spec/test_files/with_extra_line_breaks.haml
|
97
|
+
- spec/test_files/with_extra_line_breaks.html
|
98
|
+
- spec/test_files/with_extra_line_breaks.html.haml
|
91
99
|
homepage: ''
|
92
100
|
licenses: []
|
101
|
+
metadata: {}
|
93
102
|
post_install_message:
|
94
103
|
rdoc_options: []
|
95
104
|
require_paths:
|
96
105
|
- lib
|
97
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
107
|
requirements:
|
100
|
-
- -
|
108
|
+
- - '>='
|
101
109
|
- !ruby/object:Gem::Version
|
102
110
|
version: '0'
|
103
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
-
none: false
|
105
112
|
requirements:
|
106
|
-
- -
|
113
|
+
- - '>='
|
107
114
|
- !ruby/object:Gem::Version
|
108
115
|
version: '0'
|
109
116
|
requirements: []
|
110
117
|
rubyforge_project:
|
111
|
-
rubygems_version:
|
118
|
+
rubygems_version: 2.0.3
|
112
119
|
signing_key:
|
113
|
-
specification_version:
|
120
|
+
specification_version: 4
|
114
121
|
summary: HTML/ERB to HAML converter
|
115
122
|
test_files:
|
116
123
|
- spec/lib/hamlizer/html_element_spec.rb
|
117
124
|
- spec/lib/hamlizer_spec.rb
|
118
125
|
- spec/spec_helper.rb
|
126
|
+
- spec/test_files/erb_1.html.erb
|
127
|
+
- spec/test_files/erb_1.html.haml
|
128
|
+
- spec/test_files/erb_on_root.html.erb
|
129
|
+
- spec/test_files/erb_on_root.html.haml
|
130
|
+
- spec/test_files/if_else.html.erb
|
131
|
+
- spec/test_files/if_else.html.haml
|
132
|
+
- spec/test_files/spaces.html.erb
|
133
|
+
- spec/test_files/spaces.html.haml
|
134
|
+
- spec/test_files/with_extra_line_breaks.haml
|
135
|
+
- spec/test_files/with_extra_line_breaks.html
|
136
|
+
- spec/test_files/with_extra_line_breaks.html.haml
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create 1.9.3@hamlizer
|