html2haml 1.0.0.beta.1 → 1.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,7 +15,7 @@ And then execute:
15
15
 
16
16
  Or install it yourself as:
17
17
 
18
- $ gem install html2haml
18
+ $ gem install html2haml --pre
19
19
 
20
20
  ## Usage
21
21
 
data/html2haml.gemspec CHANGED
@@ -15,11 +15,11 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Html2haml::VERSION
17
17
 
18
- gem.add_dependency 'hpricot'
18
+ gem.add_dependency 'hpricot', '~> 0.8.6'
19
+ gem.add_dependency 'erubis', '~> 2.7.0'
20
+ gem.add_dependency 'ruby_parser', '~> 3.1.1'
19
21
  gem.add_dependency 'haml', '>= 3.2.0.beta.1'
20
- gem.add_development_dependency 'erubis'
21
- gem.add_development_dependency 'ruby_parser'
22
- gem.add_development_dependency 'simplecov'
22
+ gem.add_development_dependency 'simplecov', '~> 0.7.1'
23
+ gem.add_development_dependency 'minitest', '~> 4.4.0'
23
24
  gem.add_development_dependency 'rake'
24
- gem.add_development_dependency 'minitest'
25
25
  end
data/lib/html2haml.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "html2haml/version"
1
+ require File.expand_path("../html2haml/version", __FILE__)
2
2
  require "haml/util"
3
3
  require "haml/parser"
4
4
  require "haml/error"
@@ -319,7 +319,7 @@ module Haml
319
319
  if child.is_a?(::Hpricot::Text)
320
320
  if !child.to_s.include?("\n")
321
321
  text = child.to_haml(tabs + 1, options)
322
- return output + " " + text.lstrip.gsub(/^\\/, '') unless text.chomp.include?("\n")
322
+ return output + " " + text.lstrip.gsub(/^\\/, '') unless text.chomp.include?("\n") || text.empty?
323
323
  return output + "\n" + text
324
324
  elsif ["pre", "textarea"].include?(name) ||
325
325
  (name == "code" && parent.is_a?(::Hpricot::Elem) && parent.name == "pre")
@@ -1,3 +1,3 @@
1
1
  module Html2haml
2
- VERSION = "1.0.0.beta.1"
2
+ VERSION = "1.0.0.beta.2"
3
3
  end
@@ -290,6 +290,12 @@ HAML
290
290
  HTML
291
291
  end
292
292
 
293
+ def test_haml_tags_should_be_on_new_line_after_tag_with_blank_content
294
+ xml = "<weight> </weight>\n<pages>102</pages>"
295
+ haml = "%weight\n%pages 102"
296
+ assert_equal haml, render(xml)
297
+ end
298
+
293
299
  # Encodings
294
300
 
295
301
  unless RUBY_VERSION < "1.9"
metadata CHANGED
@@ -1,136 +1,146 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: html2haml
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 309340781
5
5
  prerelease: 6
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ - beta
11
+ - 2
12
+ version: 1.0.0.beta.2
6
13
  platform: ruby
7
- authors:
14
+ authors:
8
15
  - Norman Clarke
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
- date: 2012-06-27 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: hpricot
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
19
+
20
+ date: 2013-01-14 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: haml
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 3.2.0.beta.1
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 51
30
+ segments:
31
+ - 0
32
+ - 8
33
+ - 6
34
+ version: 0.8.6
38
35
  type: :runtime
36
+ name: hpricot
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
39
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 3.2.0.beta.1
46
- - !ruby/object:Gem::Dependency
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 2
48
+ - 7
49
+ - 0
50
+ version: 2.7.0
51
+ type: :runtime
47
52
  name: erubis
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
55
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 1
62
+ segments:
63
+ - 3
64
+ - 1
65
+ - 1
66
+ version: 3.1.1
67
+ type: :runtime
63
68
  name: ruby_parser
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
71
71
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
73
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: simplecov
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 309340683
78
+ segments:
79
+ - 3
80
+ - 2
81
+ - 0
82
+ - beta
83
+ - 1
84
+ version: 3.2.0.beta.1
85
+ type: :runtime
86
+ name: haml
87
+ version_requirements: *id004
88
+ - !ruby/object:Gem::Dependency
87
89
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: rake
96
- requirement: !ruby/object:Gem::Requirement
90
+ requirement: &id005 !ruby/object:Gem::Requirement
97
91
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ hash: 1
96
+ segments:
97
+ - 0
98
+ - 7
99
+ - 1
100
+ version: 0.7.1
102
101
  type: :development
102
+ name: simplecov
103
+ version_requirements: *id005
104
+ - !ruby/object:Gem::Dependency
103
105
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: minitest
112
- requirement: !ruby/object:Gem::Requirement
106
+ requirement: &id006 !ruby/object:Gem::Requirement
113
107
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ hash: 47
112
+ segments:
113
+ - 4
114
+ - 4
115
+ - 0
116
+ version: 4.4.0
118
117
  type: :development
118
+ name: minitest
119
+ version_requirements: *id006
120
+ - !ruby/object:Gem::Dependency
119
121
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
122
+ requirement: &id007 !ruby/object:Gem::Requirement
121
123
  none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ type: :development
132
+ name: rake
133
+ version_requirements: *id007
126
134
  description: Converts HTML into Haml
127
- email:
135
+ email:
128
136
  - norman@njclarke.com
129
- executables:
137
+ executables:
130
138
  - html2haml
131
139
  extensions: []
140
+
132
141
  extra_rdoc_files: []
133
- files:
142
+
143
+ files:
134
144
  - .gitignore
135
145
  - .travis.yml
136
146
  - Gemfile
@@ -149,32 +159,40 @@ files:
149
159
  - test/test_helper.rb
150
160
  homepage: http://haml.info
151
161
  licenses: []
162
+
152
163
  post_install_message:
153
164
  rdoc_options: []
154
- require_paths:
165
+
166
+ require_paths:
155
167
  - lib
156
- required_ruby_version: !ruby/object:Gem::Requirement
168
+ required_ruby_version: !ruby/object:Gem::Requirement
157
169
  none: false
158
- requirements:
159
- - - ! '>='
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- segments:
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ hash: 3
174
+ segments:
163
175
  - 0
164
- hash: 3443034388567895554
165
- required_rubygems_version: !ruby/object:Gem::Requirement
176
+ version: "0"
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
178
  none: false
167
- requirements:
168
- - - ! '>'
169
- - !ruby/object:Gem::Version
179
+ requirements:
180
+ - - ">"
181
+ - !ruby/object:Gem::Version
182
+ hash: 25
183
+ segments:
184
+ - 1
185
+ - 3
186
+ - 1
170
187
  version: 1.3.1
171
188
  requirements: []
189
+
172
190
  rubyforge_project:
173
191
  rubygems_version: 1.8.24
174
192
  signing_key:
175
193
  specification_version: 3
176
194
  summary: Converts HTML into Haml
177
- test_files:
195
+ test_files:
178
196
  - test/erb_test.rb
179
197
  - test/html2haml_test.rb
180
198
  - test/test_helper.rb