html2haml 1.0.1 → 2.0.0.beta.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8e73acdd5aa2e60c2475d9fd27bfd5745b77518
4
+ data.tar.gz: 368387da16cf45f3bd9149e5cd9f8a5b9fe9e1ec
5
+ SHA512:
6
+ metadata.gz: 92c049a3f1c46df05f913af77bd2d6e9a2439e2c3d32ab28db9d351a4c22b95da168d5ad1ce29bf7b1333bd0c3d5e044266d78dbf9a950f7b3a45637e33b2724
7
+ data.tar.gz: c5314e4c81f28df2be455ab26b4c58ca1de9ed88c8e7ff4e2eeee0a3b8210160db86df8c5ed6ff6adad4257b54366a4bcc6fb3e72527f900af2ff8106de6cf08
@@ -1,8 +1,7 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.3
4
- - jruby-18mode
5
- - rbx-18mode
3
+ - 2.0.0
4
+ - rbx-19mode
6
5
 
7
6
  gemfile:
8
7
  - Gemfile
@@ -0,0 +1 @@
1
+ --markup markdown
@@ -1,5 +1,25 @@
1
1
  # HTML2Haml Changelog
2
2
 
3
+ ## 2.0.0
4
+
5
+ * Switch to Nokogiri for XML parsing.
6
+ (thanks to [Stefan Natchev](https://github.com/snatchev) and [Norman
7
+ Clarke](https://github.com/norman))
8
+
9
+ * Add Ruby 2.0 support.
10
+ (thanks to [Yasuharu Ozaki](https://github.com/yasuoza))
11
+
12
+ * Add option to use Ruby 1.9-style attributes when possible.
13
+ (thanks to [Yoshinori Kawasaki](https://github.com/luvtechno) and
14
+ [Alexander Egorov](https://github.com/qatsi))
15
+
16
+ * Updated dependency versions.
17
+
18
+ * Removed some deprecated configuration flags.
19
+
20
+ * Move the internal HTML class from the Haml namespace into the Html2haml
21
+ namespace.
22
+
3
23
  ## 1.0.1
4
24
 
5
25
  Rescue from `RubyParser::SyntaxError` in check for valid ruby.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Html2haml
2
2
 
3
- Converts HTML to Haml.
3
+ [![Build Status](https://travis-ci.org/haml/html2haml.png?branch=master)](https://travis-ci.org/haml/html2haml)
4
+
5
+ Html2haml, not surprisingly, converts HTML to Haml. It works on HTML with
6
+ embedded ERB tags as well as plain old HTML.
4
7
 
5
8
  ## Installation
6
9
 
@@ -18,6 +21,33 @@ Or install it yourself as:
18
21
 
19
22
  ## Usage
20
23
 
24
+
25
+ ### To convert a project from .erb to .haml
26
+
27
+ If your system has `sed` and `xargs` available and none of your .erb file names
28
+ have whitespace in them, you can convert all your templates like so:
29
+
30
+ find . -name \*.erb -print | sed 'p;s/.erb$/.haml/' | xargs -n2 html2haml
31
+
32
+ If some of your file names have whitespace or you need finer-grained control
33
+ over the process, you can convert your files using `gsed` or multi-line script
34
+ techniques discussed [here](http://stackoverflow.com/questions/17576814/).
35
+
36
+
37
+ ### Documentation
38
+
39
+ #### About version 2.0
40
+
41
+ Html2haml 2.0 differs from 1.x primarily in that it uses Nokgiri as its HTML
42
+ parser rather than Hpricot. At the current time however, there are some
43
+ problems running Html2haml 2.0 on JRuby due to differences in the way the Java
44
+ version of Nokogiri parses HTML. If you are using JRuby you may wish to run
45
+ HTML2Haml on MRI or use a 1.x version until these problems have been resolved.
46
+
47
+ #### Options
48
+
49
+ Here are the options currently available to Html2haml:
50
+
21
51
  See `html2haml --help`:
22
52
 
23
53
  Usage: html2haml [options] [INPUT] [OUTPUT]
@@ -27,10 +57,8 @@ See `html2haml --help`:
27
57
  Options:
28
58
  -e, --erb Parse ERb tags.
29
59
  --no-erb Don't parse ERb tags.
30
- -r, --rhtml Deprecated; same as --erb.
31
- --no-rhtml Deprecated; same as --no-erb.
32
- -x, --xhtml Parse the input using the more strict XHTML parser.
33
60
  --html-attributes Use HTML style attributes instead of Ruby hash style.
61
+ --ruby19-attributes Use Ruby 1.9-style attributes when possible.
34
62
  -E ex[:in] Specify the default external and internal character encodings.
35
63
  -s, --stdin Read input from standard input instead of an input file
36
64
  --trace Show a full traceback on error
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ task :set_coverage_env do
16
16
  ENV["COVERAGE"] = "true"
17
17
  end
18
18
 
19
- desc "Run Simplecov (only works on 1.9)"
19
+ desc "Run Simplecov"
20
20
  task :coverage => [:set_coverage_env, :test]
21
21
 
22
22
  gemspec = File.expand_path("../html2haml.gemspec", __FILE__)
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/html2haml/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Norman Clarke"]
6
- gem.email = ["norman@njclarke.com"]
5
+ gem.authors = ["Norman Clarke", "Stefan Natchev"]
6
+ gem.email = ["norman@njclarke.com", "stefan.natchev@gmail.com"]
7
7
  gem.description = %q{Converts HTML into Haml}
8
8
  gem.summary = %q{Converts HTML into Haml}
9
9
  gem.homepage = "http://haml.info"
@@ -15,10 +15,12 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Html2haml::VERSION
17
17
 
18
- gem.add_dependency 'hpricot', '~> 0.8.6'
18
+ gem.required_ruby_version = '>= 1.9.2'
19
+
20
+ gem.add_dependency 'nokogiri', '~> 1.6.0'
19
21
  gem.add_dependency 'erubis', '~> 2.7.0'
20
- gem.add_dependency 'ruby_parser', '~> 3.1.1'
21
- gem.add_dependency 'haml', '>= 4.0.0.rc.1'
22
+ gem.add_dependency 'ruby_parser', '~> 3.2.1'
23
+ gem.add_dependency 'haml', '~> 4.0.0'
22
24
  gem.add_development_dependency 'simplecov', '~> 0.7.1'
23
25
  gem.add_development_dependency 'minitest', '~> 4.4.0'
24
26
  gem.add_development_dependency 'rake'
@@ -3,9 +3,12 @@ require 'fileutils'
3
3
  require 'rbconfig'
4
4
 
5
5
  module Html2haml
6
- # This module handles the various Haml executables (`haml` and `haml-convert`).
6
+ # This module handles the Html2haml executable.
7
7
  module Exec
8
- # An abstract class that encapsulates the executable code for all three executables.
8
+ # An abstract class that encapsulates the executable code for the Html2haml executable.
9
+ # It's split into a base class and a subclass for historic reasons: this previously
10
+ # was used by all the executables in the Haml project, before Html2haml was moved
11
+ # into its own gem.
9
12
  class Generic
10
13
  # @param args [Array<String>] The command-line arguments
11
14
  def initialize(args)
@@ -208,28 +211,18 @@ END
208
211
  @options[:no_erb] = true
209
212
  end
210
213
 
211
- opts.on('-r', '--rhtml', 'Deprecated; same as --erb.') do
212
- @module_opts[:erb] = true
213
- end
214
-
215
- opts.on('--no-rhtml', "Deprecated; same as --no-erb.") do
216
- @options[:no_erb] = true
217
- end
218
-
219
- opts.on('-x', '--xhtml', 'Parse the input using the more strict XHTML parser.') do
220
- @module_opts[:xhtml] = true
221
- end
222
-
223
214
  opts.on("--html-attributes", "Use HTML style attributes instead of Ruby hash style.") do
224
215
  @module_opts[:html_style_attributes] = true
225
216
  end
226
217
 
227
- unless RUBY_VERSION < "1.9"
228
- opts.on('-E ex[:in]', 'Specify the default external and internal character encodings.') do |encoding|
229
- external, internal = encoding.split(':')
230
- Encoding.default_external = external if external && !external.empty?
231
- Encoding.default_internal = internal if internal && !internal.empty?
232
- end
218
+ opts.on("--ruby19-attributes", "Use Ruby 1.9-style attributes when possible.") do
219
+ @module_opts[:ruby19_style_attributes] = true
220
+ end
221
+
222
+ opts.on('-E ex[:in]', 'Specify the default external and internal character encodings.') do |encoding|
223
+ external, internal = encoding.split(':')
224
+ Encoding.default_external = external if external && !external.empty?
225
+ Encoding.default_internal = internal if internal && !internal.empty?
233
226
  end
234
227
 
235
228
  super
@@ -248,7 +241,7 @@ END
248
241
  @module_opts[:erb] ||= input.respond_to?(:path) && input.path =~ /\.(rhtml|erb)$/
249
242
  @module_opts[:erb] &&= @options[:no_erb] != false
250
243
 
251
- output.write(::Haml::HTML.new(input, @module_opts).render)
244
+ output.write(HTML.new(input, @module_opts).render)
252
245
  rescue ::Haml::Error => e
253
246
  raise "#{e.is_a?(::Haml::SyntaxError) ? "Syntax error" : "Error"} on line " +
254
247
  "#{get_line e}: #{e.message}"
@@ -1,116 +1,119 @@
1
1
  require 'cgi'
2
- require 'hpricot'
2
+ require 'nokogiri'
3
3
  require 'html2haml/html/erb'
4
4
 
5
- # Haml monkeypatches various Hpricot classes
5
+ # Haml monkeypatches various Nokogiri classes
6
6
  # to add methods for conversion to Haml.
7
7
  # @private
8
- module Hpricot
9
- # @see Hpricot
10
- module Node
11
- # Whether this node has already been converted to Haml.
12
- # Only used for text nodes and elements.
13
- #
14
- # @return [Boolean]
15
- attr_accessor :converted_to_haml
16
-
17
- # Returns the Haml representation of the given node.
18
- #
19
- # @param tabs [Fixnum] The indentation level of the resulting Haml.
20
- # @option options (see Haml::HTML#initialize)
21
- def to_haml(tabs, options)
22
- return "" if converted_to_haml || to_s.strip.empty?
23
- text = uninterp(self.to_s)
24
- node = next_node
25
- while node.is_a?(::Hpricot::Elem) && node.name == "haml:loud"
26
- node.converted_to_haml = true
27
- text << '#{' <<
28
- CGI.unescapeHTML(node.inner_text).gsub(/\n\s*/, ' ').strip << '}'
29
-
30
- if node.next_node.is_a?(::Hpricot::Text)
31
- node = node.next_node
32
- text << uninterp(node.to_s)
8
+ module Nokogiri
9
+
10
+ module XML
11
+ # @see Nokogiri
12
+ class Node
13
+ # Whether this node has already been converted to Haml.
14
+ # Only used for text nodes and elements.
15
+ #
16
+ # @return [Boolean]
17
+ attr_accessor :converted_to_haml
18
+
19
+ # Returns the Haml representation of the given node.
20
+ #
21
+ # @param tabs [Fixnum] The indentation level of the resulting Haml.
22
+ # @option options (see Html2haml::HTML#initialize)
23
+ def to_haml(tabs, options)
24
+ return "" if converted_to_haml || to_s.strip.empty?
25
+ text = uninterp(self.to_s)
26
+ node = next_sibling
27
+ while node.is_a?(::Nokogiri::XML::Element) && node.name == "haml_loud"
33
28
  node.converted_to_haml = true
34
- end
29
+ text << '#{' <<
30
+ CGI.unescapeHTML(node.inner_text).gsub(/\n\s*/, ' ').strip << '}'
31
+
32
+ if node.next_sibling.is_a?(::Nokogiri::XML::Text)
33
+ node = node.next_sibling
34
+ text << uninterp(node.to_s)
35
+ node.converted_to_haml = true
36
+ end
35
37
 
36
- node = node.next_node
38
+ node = node.next_sibling
39
+ end
40
+ return parse_text_with_interpolation(text, tabs)
37
41
  end
38
- return parse_text_with_interpolation(text, tabs)
39
- end
40
42
 
41
- private
42
-
43
- def erb_to_interpolation(text, options)
44
- return text unless options[:erb]
45
- text = CGI.escapeHTML(uninterp(text))
46
- %w[<haml:loud> </haml:loud>].each {|str| text.gsub!(CGI.escapeHTML(str), str)}
47
- ::Hpricot::XML(text).children.inject("") do |str, elem|
48
- if elem.is_a?(::Hpricot::Text)
49
- str + CGI.unescapeHTML(elem.to_s)
50
- else # <haml:loud> element
51
- str + '#{' + CGI.unescapeHTML(elem.innerText.strip) + '}'
43
+ private
44
+
45
+ def erb_to_interpolation(text, options)
46
+ return text unless options[:erb]
47
+ text = CGI.escapeHTML(uninterp(text))
48
+ %w[<haml_loud> </haml_loud>].each {|str| text.gsub!(CGI.escapeHTML(str), str)}
49
+ ::Nokogiri::XML.fragment(text).children.inject("") do |str, elem|
50
+ if elem.is_a?(::Nokogiri::XML::Text)
51
+ str + CGI.unescapeHTML(elem.to_s)
52
+ else # <haml_loud> element
53
+ str + '#{' + CGI.unescapeHTML(elem.inner_text.strip) + '}'
54
+ end
52
55
  end
53
56
  end
54
- end
55
57
 
56
- def tabulate(tabs)
57
- ' ' * tabs
58
- end
58
+ def tabulate(tabs)
59
+ ' ' * tabs
60
+ end
59
61
 
60
- def uninterp(text)
61
- text.gsub('#{', '\#{') #'
62
- end
62
+ def uninterp(text)
63
+ text.gsub('#{', '\#{') #'
64
+ end
63
65
 
64
- def attr_hash
65
- attributes.to_hash
66
- end
66
+ def attr_hash
67
+ Hash[attributes.map {|k, v| [k.to_s, v.to_s]}]
68
+ end
67
69
 
68
- def parse_text(text, tabs)
69
- parse_text_with_interpolation(uninterp(text), tabs)
70
- end
70
+ def parse_text(text, tabs)
71
+ parse_text_with_interpolation(uninterp(text), tabs)
72
+ end
71
73
 
72
- def parse_text_with_interpolation(text, tabs)
73
- text.strip!
74
- return "" if text.empty?
74
+ def parse_text_with_interpolation(text, tabs)
75
+ text.strip!
76
+ return "" if text.empty?
75
77
 
76
- text.split("\n").map do |line|
77
- line.strip!
78
- "#{tabulate(tabs)}#{'\\' if Haml::Parser::SPECIAL_CHARACTERS.include?(line[0])}#{line}\n"
79
- end.join
78
+ text.split("\n").map do |line|
79
+ line.strip!
80
+ "#{tabulate(tabs)}#{'\\' if Haml::Parser::SPECIAL_CHARACTERS.include?(line[0])}#{line}\n"
81
+ end.join
82
+ end
80
83
  end
81
84
  end
82
85
  end
83
86
 
84
87
  # @private
85
- HAML_TAGS = %w[haml:block haml:loud haml:silent]
86
-
87
- HAML_TAGS.each do |t|
88
- Hpricot::ElementContent[t] = {}
89
- Hpricot::ElementContent.keys.each do |key|
90
- Hpricot::ElementContent[t][key.hash] = true
91
- end
92
- end
93
-
94
- Hpricot::ElementContent.keys.each do |k|
95
- HAML_TAGS.each do |el|
96
- val = Hpricot::ElementContent[k]
97
- val[el.hash] = true if val.is_a?(Hash)
98
- end
99
- end
100
-
101
- module Haml
88
+ HAML_TAGS = %w[haml_block haml_loud haml_silent]
89
+ #
90
+ # HAML_TAGS.each do |t|
91
+ # Nokogiri::XML::ElementContent[t] = {}
92
+ # Nokogiri::XML::ElementContent.keys.each do |key|
93
+ # Nokogiri::XML::ElementContent[t][key.hash] = true
94
+ # end
95
+ # end
96
+ #
97
+ # Nokogiri::XML::ElementContent.keys.each do |k|
98
+ # HAML_TAGS.each do |el|
99
+ # val = Nokogiri::XML::ElementContent[k]
100
+ # val[el.hash] = true if val.is_a?(Hash)
101
+ # end
102
+ # end
103
+
104
+ module Html2haml
102
105
  # Converts HTML documents into Haml templates.
103
- # Depends on [Hpricot](http://github.com/whymirror/hpricot) for HTML parsing.
104
- # If ERB conversion is being used, also depends on
106
+ # Depends on [Nokogiri](http://nokogiri.org/) for HTML parsing.
107
+ # If ERB conversion is being used, also depends on
105
108
  # [Erubis](http://www.kuwata-lab.com/erubis) to parse the ERB
106
109
  # and [ruby_parser](http://parsetree.rubyforge.org/) to parse the Ruby code.
107
110
  #
108
111
  # Example usage:
109
112
  #
110
- # Haml::HTML.new("<a href='http://google.com'>Blat</a>").render
113
+ # HTML.new("<a href='http://google.com'>Blat</a>").render
111
114
  # #=> "%a{:href => 'http://google.com'} Blat"
112
115
  class HTML
113
- # @param template [String, Hpricot::Node] The HTML template to convert
116
+ # @param template [String, Nokogiri::Node] The HTML template to convert
114
117
  # @option options :erb [Boolean] (false) Whether or not to parse
115
118
  # ERB's `<%= %>` and `<% %>` into Haml's `=` and `-`
116
119
  # @option options :xhtml [Boolean] (false) Whether or not to parse
@@ -118,7 +121,7 @@ module Haml
118
121
  def initialize(template, options = {})
119
122
  @options = options
120
123
 
121
- if template.is_a? Hpricot::Node
124
+ if template.is_a? Nokogiri::XML::Node
122
125
  @template = template
123
126
  else
124
127
  if template.is_a? IO
@@ -132,8 +135,23 @@ module Haml
132
135
  template = ERB.compile(template)
133
136
  end
134
137
 
135
- method = @options[:xhtml] ? Hpricot.method(:XML) : method(:Hpricot)
136
- @template = method.call(template.gsub('&', '&amp;'))
138
+ if template =~ /^\s*<!DOCTYPE|<html/i
139
+ return @template = Nokogiri.HTML(template)
140
+ end
141
+
142
+ @template = Nokogiri::HTML.fragment(template)
143
+
144
+ #detect missplaced head or body tag
145
+ #XML_HTML_STRUCURE_ERROR : 800
146
+ if @template.errors.any? { |e| e.code == 800 }
147
+ return @template = Nokogiri.HTML(template).at('/html').children
148
+ end
149
+
150
+ #in order to support CDATA in HTML (which is invalid) try using the XML parser
151
+ # we can detect this when libxml returns error code XML_ERR_NAME_REQUIRED : 68
152
+ if @template.errors.any? { |e| e.code == 68 }
153
+ return @template = Nokogiri::XML.fragment(template)
154
+ end
137
155
  end
138
156
  end
139
157
 
@@ -146,42 +164,64 @@ module Haml
146
164
 
147
165
  TEXT_REGEXP = /^(\s*).*$/
148
166
 
149
- # @see Hpricot
167
+
168
+ # @see Nokogiri
150
169
  # @private
151
- class ::Hpricot::Doc
152
- # @see Haml::HTML::Node#to_haml
170
+ class ::Nokogiri::XML::Document
171
+ # @see Html2haml::HTML::Node#to_haml
153
172
  def to_haml(tabs, options)
154
173
  (children || []).inject('') {|s, c| s << c.to_haml(0, options)}
155
174
  end
156
175
  end
157
176
 
158
- # @see Hpricot
177
+ class ::Nokogiri::XML::DocumentFragment
178
+ # @see Html2haml::HTML::Node#to_haml
179
+ def to_haml(tabs, options)
180
+ (children || []).inject('') {|s, c| s << c.to_haml(0, options)}
181
+ end
182
+ end
183
+
184
+ class ::Nokogiri::XML::NodeSet
185
+ # @see Html2haml::HTML::Node#to_haml
186
+ def to_haml(tabs, options)
187
+ self.inject('') {|s, c| s << c.to_haml(tabs, options)}
188
+ end
189
+ end
190
+
191
+ # @see Nokogiri
159
192
  # @private
160
- class ::Hpricot::XMLDecl
161
- # @see Haml::HTML::Node#to_haml
193
+ class ::Nokogiri::XML::ProcessingInstruction
194
+ # @see Html2haml::HTML::Node#to_haml
162
195
  def to_haml(tabs, options)
163
196
  "#{tabulate(tabs)}!!! XML\n"
164
197
  end
165
198
  end
166
199
 
167
- # @see Hpricot
200
+ # @see Nokogiri
168
201
  # @private
169
- class ::Hpricot::CData
170
- # @see Haml::HTML::Node#to_haml
202
+ class ::Nokogiri::XML::CDATA
203
+ # @see Html2haml::HTML::Node#to_haml
171
204
  def to_haml(tabs, options)
172
205
  content = parse_text_with_interpolation(
173
206
  erb_to_interpolation(self.content, options), tabs + 1)
174
207
  "#{tabulate(tabs)}:cdata\n#{content}"
175
208
  end
209
+
210
+ # removes the start and stop markers for cdata
211
+ def content_without_cdata_tokens
212
+ content.
213
+ gsub(/^\s*<!\[CDATA\[\n/,"").
214
+ gsub(/^\s*\]\]>\n/, "")
215
+ end
176
216
  end
177
217
 
178
- # @see Hpricot
218
+ # @see Nokogiri
179
219
  # @private
180
- class ::Hpricot::DocType
181
- # @see Haml::HTML::Node#to_haml
220
+ class ::Nokogiri::XML::DTD
221
+ # @see Html2haml::HTML::Node#to_haml
182
222
  def to_haml(tabs, options)
183
- attrs = public_id.nil? ? ["", "", ""] :
184
- public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0]
223
+ attrs = external_id.nil? ? ["", "", ""] :
224
+ external_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0]
185
225
  raise Haml::SyntaxError.new("Invalid doctype") if attrs == nil
186
226
 
187
227
  type, version, strictness = attrs.map { |a| a.downcase }
@@ -205,10 +245,10 @@ module Haml
205
245
  end
206
246
  end
207
247
 
208
- # @see Hpricot
248
+ # @see Nokogiri
209
249
  # @private
210
- class ::Hpricot::Comment
211
- # @see Haml::HTML::Node#to_haml
250
+ class ::Nokogiri::XML::Comment
251
+ # @see Html2haml::HTML::Node#to_haml
212
252
  def to_haml(tabs, options)
213
253
  content = self.content
214
254
  if content =~ /\A(\[[^\]]+\])>(.*)<!\[endif\]\z/m
@@ -224,26 +264,26 @@ module Haml
224
264
  end
225
265
  end
226
266
 
227
- # @see Hpricot
267
+ # @see Nokogiri
228
268
  # @private
229
- class ::Hpricot::Elem
230
- # @see Haml::HTML::Node#to_haml
269
+ class ::Nokogiri::XML::Element
270
+ # @see Html2haml::HTML::Node#to_haml
231
271
  def to_haml(tabs, options)
232
272
  return "" if converted_to_haml
233
273
  if name == "script" &&
234
- (attr_hash['type'].nil? || attr_hash['type'] == "text/javascript") &&
274
+ (attr_hash['type'].nil? || attr_hash['type'].to_s == "text/javascript") &&
235
275
  (attr_hash.keys - ['type']).empty?
236
276
  return to_haml_filter(:javascript, tabs, options)
237
277
  elsif name == "style" &&
238
- (attr_hash['type'].nil? || attr_hash['type'] == "text/css") &&
278
+ (attr_hash['type'].nil? || attr_hash['type'].to_s == "text/css") &&
239
279
  (attr_hash.keys - ['type']).empty?
240
280
  return to_haml_filter(:css, tabs, options)
241
281
  end
242
282
 
243
283
  output = tabulate(tabs)
244
- if options[:erb] && name[0...5] == 'haml:'
245
- case name[5..-1]
246
- when "loud"
284
+ if options[:erb] && HAML_TAGS.include?(name)
285
+ case name
286
+ when "haml_loud"
247
287
  lines = CGI.unescapeHTML(inner_text).split("\n").
248
288
  map {|s| s.rstrip}.reject {|s| s.strip.empty?}
249
289
  lines.first.gsub!(/^[ \t]*/, "= ")
@@ -261,18 +301,18 @@ module Haml
261
301
  length = lines.map {|s| s.size}.max + 1
262
302
  lines.map! {|s| "%#{-length}s|" % s}
263
303
 
264
- if next_sibling && next_sibling.is_a?(Hpricot::Elem) && next_sibling.name == "haml:loud" &&
304
+ if next_sibling && next_sibling.is_a?(Nokogiri::XML::Element) && next_sibling.name == "haml_loud" &&
265
305
  next_sibling.inner_text.split("\n").reject {|s| s.strip.empty?}.size > 1
266
306
  lines << "-#"
267
307
  end
268
308
  end
269
309
  return lines.map {|s| output + s + "\n"}.join
270
- when "silent"
310
+ when "haml_silent"
271
311
  return CGI.unescapeHTML(inner_text).split("\n").map do |line|
272
312
  next "" if line.strip.empty?
273
313
  "#{output}- #{line.strip}\n"
274
314
  end.join
275
- when "block"
315
+ when "haml_block"
276
316
  return render_children("", tabs, options)
277
317
  end
278
318
  end
@@ -286,21 +326,24 @@ module Haml
286
326
  output << "= succeed #{self.next.content.slice!(/\A[^\s]+/).dump} do\n"
287
327
  tabs += 1
288
328
  output << tabulate(tabs)
329
+ #empty the text node since it was inserted into the block
330
+ self.next.content = ""
289
331
  end
290
332
  end
291
333
 
292
- output << "%#{name}" unless name == 'div' &&
334
+ output << "%#{name}" unless name.to_s == 'div' &&
293
335
  (static_id?(options) ||
294
336
  static_classname?(options) &&
295
- attr_hash['class'].split(' ').any?(&method(:haml_css_attr?)))
337
+ attr_hash['class'].to_s.split(' ').any?(&method(:haml_css_attr?)))
296
338
 
297
339
  if attr_hash
340
+
298
341
  if static_id?(options)
299
- output << "##{attr_hash['id']}"
342
+ output << "##{attr_hash['id'].to_s}"
300
343
  remove_attribute('id')
301
344
  end
302
345
  if static_classname?(options)
303
- leftover = attr_hash['class'].split(' ').reject do |c|
346
+ leftover = attr_hash['class'].to_s.split(' ').reject do |c|
304
347
  next unless haml_css_attr?(c)
305
348
  output << ".#{c}"
306
349
  end
@@ -311,21 +354,21 @@ module Haml
311
354
  end
312
355
 
313
356
  output << ">" if nuke_outer_whitespace
314
- output << "/" if empty? && !etag
357
+ output << "/" if to_xhtml.end_with?("/>")
315
358
 
316
359
  if children && children.size == 1
317
360
  child = children.first
318
- if child.is_a?(::Hpricot::Text)
361
+ if child.is_a?(::Nokogiri::XML::Text)
319
362
  if !child.to_s.include?("\n")
320
363
  text = child.to_haml(tabs + 1, options)
321
364
  return output + " " + text.lstrip.gsub(/^\\/, '') unless text.chomp.include?("\n") || text.empty?
322
365
  return output + "\n" + text
323
366
  elsif ["pre", "textarea"].include?(name) ||
324
- (name == "code" && parent.is_a?(::Hpricot::Elem) && parent.name == "pre")
367
+ (name == "code" && parent.is_a?(::Nokogiri::XML::Element) && parent.name == "pre")
325
368
  return output + "\n#{tabulate(tabs + 1)}:preserve\n" +
326
- innerText.gsub(/^/, tabulate(tabs + 2))
369
+ inner_text.gsub(/^/, tabulate(tabs + 2))
327
370
  end
328
- elsif child.is_a?(::Hpricot::Elem) && child.name == "haml:loud"
371
+ elsif child.is_a?(::Nokogiri::XML::Element) && child.name == "haml_loud"
329
372
  return output + child.to_haml(tabs + 1, options).lstrip
330
373
  end
331
374
  end
@@ -344,24 +387,30 @@ module Haml
344
387
  def dynamic_attributes
345
388
  @dynamic_attributes ||= begin
346
389
  Hash[attr_hash.map do |name, value|
347
- next if value.empty?
348
- full_match = nil
349
- ruby_value = value.gsub(%r{<haml:loud>\s*(.+?)\s*</haml:loud>}) do
350
- full_match = $`.empty? && $'.empty?
351
- CGI.unescapeHTML(full_match ? $1: "\#{#{$1}}")
390
+ if value == ""
391
+ [nil, nil]
392
+ else
393
+ full_match = nil
394
+ ruby_value = value.to_s.gsub(%r{<haml_loud>\s*(.+?)\s*</haml_loud>}) do
395
+ full_match = $`.empty? && $'.empty?
396
+ CGI.unescapeHTML(full_match ? $1: "\#{#{$1}}")
397
+ end
398
+ if ruby_value == value
399
+ [nil, nil]
400
+ else
401
+ [name.to_s, full_match ? ruby_value : %("#{ruby_value}")]
402
+ end
352
403
  end
353
- next if ruby_value == value
354
- [name, full_match ? ruby_value : %("#{ruby_value}")]
355
404
  end]
356
405
  end
357
406
  end
358
407
 
359
408
  def to_haml_filter(filter, tabs, options)
360
409
  content =
361
- if children.first.is_a?(::Hpricot::CData)
362
- children.first.content
410
+ if children.first.cdata?
411
+ decode_entities(children.first.content_without_cdata_tokens)
363
412
  else
364
- CGI.unescapeHTML(self.innerText)
413
+ decode_entities(self.inner_text)
365
414
  end
366
415
 
367
416
  content = erb_to_interpolation(content, options)
@@ -382,6 +431,17 @@ module Haml
382
431
  "#{tabulate(tabs)}:#{filter}\n#{content}"
383
432
  end
384
433
 
434
+ # TODO: this method is utterly awful, find a better way to decode HTML entities.
435
+ def decode_entities(str)
436
+ str.gsub(/&[\S]+;/) do |entity|
437
+ begin
438
+ [Nokogiri::HTML::NamedCharacters[entity[1..-2]]].pack("C")
439
+ rescue TypeError
440
+ entity
441
+ end
442
+ end
443
+ end
444
+
385
445
  def static_attribute?(name, options)
386
446
  attr_hash[name] && !dynamic_attribute?(name, options)
387
447
  end
@@ -406,7 +466,7 @@ module Haml
406
466
  # that's prettier than that produced by Hash#inspect
407
467
  def haml_attributes(options)
408
468
  attrs = attr_hash.sort.map do |name, value|
409
- haml_attribute_pair(name, value, options)
469
+ haml_attribute_pair(name, value.to_s, options)
410
470
  end
411
471
  if options[:html_style_attributes]
412
472
  "(#{attrs.join(' ')})"
@@ -418,12 +478,20 @@ module Haml
418
478
  # Returns the string representation of a single attribute key value pair
419
479
  def haml_attribute_pair(name, value, options)
420
480
  value = dynamic_attribute?(name, options) ? dynamic_attributes[name] : value.inspect
481
+
421
482
  if options[:html_style_attributes]
422
- "#{name}=#{value}"
423
- else
424
- name = name.index(/\W/) ? name.inspect : ":#{name}"
425
- "#{name} => #{value}"
483
+ return "#{name}=#{value}"
484
+ end
485
+
486
+ if name.index(/\W/)
487
+ return "#{name.inspect} => #{value}"
426
488
  end
489
+
490
+ if options[:ruby19_style_attributes]
491
+ return "#{name}: #{value}"
492
+ end
493
+
494
+ ":#{name} => #{value}"
427
495
  end
428
496
  end
429
497
  end
@@ -2,10 +2,10 @@ require 'cgi'
2
2
  require 'erubis'
3
3
  require 'ruby_parser'
4
4
 
5
- module Haml
5
+ module Html2haml
6
6
  class HTML
7
7
  # A class for converting ERB code into a format that's easier
8
- # for the {Haml::HTML} Hpricot-based parser to understand.
8
+ # for the {Html2haml::HTML} Nokogiri-based parser to understand.
9
9
  #
10
10
  # Uses [Erubis](http://www.kuwata-lab.com/erubis)'s extensible parsing powers
11
11
  # to parse the ERB in a reliable way,
@@ -13,17 +13,17 @@ module Haml
13
13
  # to figure out whether a given chunk of Ruby code starts a block or not.
14
14
  #
15
15
  # The ERB tags are converted to HTML tags in the following way.
16
- # `<% ... %>` is converted into `<haml:silent> ... </haml:silent>`.
17
- # `<%= ... %>` is converted into `<haml:loud> ... </haml:loud>`.
16
+ # `<% ... %>` is converted into `<haml_silent> ... </haml_silent>`.
17
+ # `<%= ... %>` is converted into `<haml_loud> ... </haml_loud>`.
18
18
  # Finally, if either of these opens a Ruby block,
19
- # `<haml:block> ... </haml:block>` will wrap the entire contents of the block -
19
+ # `<haml_block> ... </haml_block>` will wrap the entire contents of the block -
20
20
  # that is, everything that should be indented beneath the previous silent or loud tag.
21
21
  class ERB < Erubis::Basic::Engine
22
- # Compiles an ERB template into a HTML document containing `haml:` tags.
22
+ # Compiles an ERB template into a HTML document containing `haml_*` tags.
23
23
  #
24
24
  # @param template [String] The ERB template
25
25
  # @return [String] The output document
26
- # @see Haml::HTML::ERB
26
+ # @see Html2haml::HTML::ERB
27
27
  def self.compile(template)
28
28
  new(template).src
29
29
  end
@@ -48,8 +48,8 @@ module Haml
48
48
  end
49
49
 
50
50
  # Concatenates a silent Ruby statement onto the source buffer.
51
- # This uses the `<haml:silent>` tag,
52
- # and may close and/or open a Ruby block with the `<haml:block>` tag.
51
+ # This uses the `<haml_silent>` tag,
52
+ # and may close and/or open a Ruby block with the `<haml_block>` tag.
53
53
  #
54
54
  # In particular, a block is closed if this statement is some form of `end`,
55
55
  # opened if it's a block opener like `do`, `if`, or `begin`,
@@ -59,9 +59,9 @@ module Haml
59
59
  # @param src [String] The source buffer
60
60
  # @param code [String] The Ruby statement to add to the buffer
61
61
  def add_stmt(src, code)
62
- src << '</haml:block>' if block_closer?(code) || mid_block?(code)
63
- src << '<haml:silent>' << h(code) << '</haml:silent>' unless code.strip == "end"
64
- src << '<haml:block>' if block_opener?(code) || mid_block?(code)
62
+ src << '</haml_block>' if block_closer?(code) || mid_block?(code)
63
+ src << '<haml_silent>' << h(code) << '</haml_silent>' unless code.strip == "end"
64
+ src << '<haml_block>' if block_opener?(code) || mid_block?(code)
65
65
  end
66
66
 
67
67
  # Concatenates a Ruby expression that's printed to the document
@@ -73,8 +73,8 @@ module Haml
73
73
  # @param src [String] The source buffer
74
74
  # @param code [String] The Ruby expression to add to the buffer
75
75
  def add_expr_literal(src, code)
76
- src << '<haml:loud>' << h(code) << '</haml:loud>'
77
- src << '<haml:block>' if block_opener?(code)
76
+ src << '<haml_loud>' << h(code) << '</haml_loud>'
77
+ src << '<haml_block>' if block_opener?(code)
78
78
  end
79
79
 
80
80
  # `html2haml` doesn't support debugging expressions.
@@ -1,3 +1,3 @@
1
1
  module Html2haml
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0.beta.1"
3
3
  end
@@ -10,6 +10,12 @@ class ErbTest < MiniTest::Unit::TestCase
10
10
 
11
11
  def test_inline_erb
12
12
  assert_equal("%p= foo", render_erb("<p><%= foo %></p>"))
13
+ assert_equal(<<HAML.rstrip, render_erb(<<HTML))
14
+ %p= foo
15
+ HAML
16
+ <p><%= foo %>
17
+ </p>
18
+ HTML
13
19
  end
14
20
 
15
21
  def test_non_inline_erb
@@ -27,13 +33,6 @@ HTML
27
33
  HAML
28
34
  <p>
29
35
  <%= foo %></p>
30
- HTML
31
- assert_equal(<<HAML.rstrip, render_erb(<<HTML))
32
- %p
33
- = foo
34
- HAML
35
- <p><%= foo %>
36
- </p>
37
36
  HTML
38
37
  end
39
38
 
@@ -460,15 +459,15 @@ ERB
460
459
  def test_can_parse_ruby_19_hashes_as_arguments
461
460
  erb = "<%= foobar 'foo', {bar: 'baz'} %>"
462
461
  begin
463
- Haml::HTML::ERB.new(erb)
462
+ Html2haml::HTML::ERB.new(erb)
464
463
  rescue
465
464
  flunk "should not raise an error"
466
465
  end
467
466
  end
468
467
 
469
468
  def test_should_wrap_in_silent
470
- assert_equal(<<HTML.rstrip, Haml::HTML::ERB.new(<<ERB).src)
471
- <haml:silent> some_variable_or_function \n</haml:silent>
469
+ assert_equal(<<HTML.rstrip, Html2haml::HTML::ERB.new(<<ERB).src)
470
+ <haml_silent> some_variable_or_function \n</haml_silent>
472
471
  HTML
473
472
  <% some_variable_or_function %>
474
473
  ERB
@@ -476,8 +475,8 @@ ERB
476
475
 
477
476
  #comment content is removed by erubis
478
477
  def test_should_wrap_process_comments_as_empty_lines
479
- assert_equal(<<HTML.rstrip, Haml::HTML::ERB.new(<<ERB).src)
480
- <haml:silent>\n</haml:silent>
478
+ assert_equal(<<HTML.rstrip, Html2haml::HTML::ERB.new(<<ERB).src)
479
+ <haml_silent>\n</haml_silent>
481
480
  HTML
482
481
  <%# some_variable_or_function %>
483
482
  ERB
@@ -45,6 +45,13 @@ class Html2HamlTest < MiniTest::Unit::TestCase
45
45
  render('<meta http-equiv="Content-Type" content="text/html" />', :html_style_attributes => true))
46
46
  end
47
47
 
48
+ def test_should_have_ruby_19_hash_style_attributes
49
+ assert_equal('%input{name: "login", type: "text"}/',
50
+ render('<input type="text" name="login" />', :ruby19_style_attributes => true))
51
+ assert_equal('%meta{content: "text/html", "http-equiv" => "Content-Type"}/',
52
+ render('<meta http-equiv="Content-Type" content="text/html" />', :ruby19_style_attributes => true))
53
+ end
54
+
48
55
  def test_class_with_dot_and_hash
49
56
  assert_equal('%div{:class => "foo.bar"}', render("<div class='foo.bar'></div>"))
50
57
  assert_equal('%div{:class => "foo#bar"}', render("<div class='foo#bar'></div>"))
@@ -81,7 +88,7 @@ HTML
81
88
  end
82
89
 
83
90
  def test_self_closing_tag
84
- assert_equal("%foo/", render("<foo />"))
91
+ assert_equal("%img/", render("<img />"))
85
92
  end
86
93
 
87
94
  def test_inline_text
@@ -142,6 +149,21 @@ HTML
142
149
  return "12" & "13";
143
150
  }
144
151
  HAML
152
+ <script type="text/javascript">
153
+ function foo() {
154
+ return "12" & "13";
155
+ }
156
+ </script>
157
+ HTML
158
+ end
159
+
160
+ def test_script_tag_with_html_escaped_javascript
161
+ assert_equal(<<HAML.rstrip, render(<<HTML))
162
+ :javascript
163
+ function foo() {
164
+ return "12" & "13";
165
+ }
166
+ HAML
145
167
  <script type="text/javascript">
146
168
  function foo() {
147
169
  return "12" &amp; "13";
@@ -333,24 +355,22 @@ HTML
333
355
 
334
356
  # Encodings
335
357
 
336
- unless RUBY_VERSION < "1.9"
337
- def test_encoding_error
338
- render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
339
- assert(false, "Expected exception")
340
- rescue Haml::Error => e
341
- assert_equal(3, e.line)
342
- assert_equal('Invalid UTF-8 character "\xFE"', e.message)
343
- end
344
-
345
- def test_ascii_incompatible_encoding_error
346
- template = "foo\nbar\nb_z".encode("utf-16le")
347
- template[9] = "\xFE".force_encoding("utf-16le")
348
- render(template)
349
- assert(false, "Expected exception")
350
- rescue Haml::Error => e
351
- assert_equal(3, e.line)
352
- assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
353
- end
358
+ def test_encoding_error
359
+ render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
360
+ assert(false, "Expected exception")
361
+ rescue Haml::Error => e
362
+ assert_equal(3, e.line)
363
+ assert_match(/Invalid UTF-8 character/, e.message)
364
+ end
365
+
366
+ def test_ascii_incompatible_encoding_error
367
+ template = "foo\nbar\nb_z".encode("utf-16le")
368
+ template[9] = "\xFE".force_encoding("utf-16le")
369
+ render(template)
370
+ assert(false, "Expected exception")
371
+ rescue Haml::Error => e
372
+ assert_equal(3, e.line)
373
+ assert_match(/Invalid UTF-16LE character/, e.message)
354
374
  end
355
375
 
356
376
  # Regression Tests
@@ -361,4 +381,25 @@ HTML
361
381
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
362
382
  HTML
363
383
  end
384
+
385
+ def test_html_document_without_doctype
386
+ assert_equal(<<HAML.rstrip, render(<<HTML))
387
+ !!!
388
+ %html
389
+ %head
390
+ %title Hello
391
+ %body
392
+ %p Hello
393
+ HAML
394
+ <html>
395
+ <head>
396
+ <title>Hello</title>
397
+ </head>
398
+ <body>
399
+ <p>Hello</p>
400
+ </body>
401
+ </html>
402
+ HTML
403
+ end
404
+
364
405
  end
@@ -13,7 +13,7 @@ require 'html2haml/html/erb'
13
13
  class MiniTest::Unit::TestCase
14
14
  protected
15
15
  def render(text, options = {})
16
- Haml::HTML.new(text, options).render.rstrip
16
+ Html2haml::HTML.new(text, options).render.rstrip
17
17
  end
18
18
 
19
19
  def render_erb(text)
metadata CHANGED
@@ -1,132 +1,126 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: html2haml
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 1
9
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.beta.1
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Norman Clarke
8
+ - Stefan Natchev
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2013-02-16 00:00:00 -03:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: hpricot
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
12
+ date: 2013-07-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
25
18
  - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 8
30
- - 6
31
- version: 0.8.6
19
+ - !ruby/object:Gem::Version
20
+ version: 1.6.0
32
21
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: erubis
36
22
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
39
25
  - - ~>
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 7
44
- - 0
26
+ - !ruby/object:Gem::Version
27
+ version: 1.6.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: erubis
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
45
34
  version: 2.7.0
46
35
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: ruby_parser
50
36
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
53
39
  - - ~>
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 3
57
- - 1
58
- - 1
59
- version: 3.1.1
40
+ - !ruby/object:Gem::Version
41
+ version: 2.7.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: ruby_parser
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 3.2.1
60
49
  type: :runtime
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: haml
64
50
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 4
71
- - 0
72
- - 0
73
- - rc
74
- - 1
75
- version: 4.0.0.rc.1
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 3.2.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: haml
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 4.0.0
76
63
  type: :runtime
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: simplecov
80
64
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
82
- requirements:
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 4.0.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
83
74
  - - ~>
84
- - !ruby/object:Gem::Version
85
- segments:
86
- - 0
87
- - 7
88
- - 1
75
+ - !ruby/object:Gem::Version
89
76
  version: 0.7.1
90
77
  type: :development
91
- version_requirements: *id005
92
- - !ruby/object:Gem::Dependency
93
- name: minitest
94
78
  prerelease: false
95
- requirement: &id006 !ruby/object:Gem::Requirement
96
- requirements:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 0.7.1
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
97
88
  - - ~>
98
- - !ruby/object:Gem::Version
99
- segments:
100
- - 4
101
- - 4
102
- - 0
89
+ - !ruby/object:Gem::Version
103
90
  version: 4.4.0
104
91
  type: :development
105
- version_requirements: *id006
106
- - !ruby/object:Gem::Dependency
107
- name: rake
108
92
  prerelease: false
109
- requirement: &id007 !ruby/object:Gem::Requirement
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- segments:
114
- - 0
115
- version: "0"
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: 4.4.0
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
116
105
  type: :development
117
- version_requirements: *id007
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
118
112
  description: Converts HTML into Haml
119
- email:
113
+ email:
120
114
  - norman@njclarke.com
121
- executables:
115
+ - stefan.natchev@gmail.com
116
+ executables:
122
117
  - html2haml
123
118
  extensions: []
124
-
125
119
  extra_rdoc_files: []
126
-
127
- files:
120
+ files:
128
121
  - .gitignore
129
122
  - .travis.yml
123
+ - .yardopts
130
124
  - Changelog.markdown
131
125
  - Gemfile
132
126
  - MIT-LICENSE
@@ -142,37 +136,30 @@ files:
142
136
  - test/erb_test.rb
143
137
  - test/html2haml_test.rb
144
138
  - test/test_helper.rb
145
- has_rdoc: true
146
139
  homepage: http://haml.info
147
140
  licenses: []
148
-
141
+ metadata: {}
149
142
  post_install_message:
150
143
  rdoc_options: []
151
-
152
- require_paths:
144
+ require_paths:
153
145
  - lib
154
- required_ruby_version: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- segments:
159
- - 0
160
- version: "0"
161
- required_rubygems_version: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- segments:
166
- - 0
167
- version: "0"
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - '>='
149
+ - !ruby/object:Gem::Version
150
+ version: 1.9.2
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>'
154
+ - !ruby/object:Gem::Version
155
+ version: 1.3.1
168
156
  requirements: []
169
-
170
157
  rubyforge_project:
171
- rubygems_version: 1.3.6
158
+ rubygems_version: 2.0.3
172
159
  signing_key:
173
- specification_version: 3
160
+ specification_version: 4
174
161
  summary: Converts HTML into Haml
175
- test_files:
162
+ test_files:
176
163
  - test/erb_test.rb
177
164
  - test/html2haml_test.rb
178
165
  - test/test_helper.rb