html2haml 2.0.0.beta.1 → 2.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8e73acdd5aa2e60c2475d9fd27bfd5745b77518
4
- data.tar.gz: 368387da16cf45f3bd9149e5cd9f8a5b9fe9e1ec
3
+ metadata.gz: 95b03c7907b983668eb21e33ac4b0e90e5dd85f9
4
+ data.tar.gz: 69ef205bb13c17d15ef4d049f8c3f56a36f4637b
5
5
  SHA512:
6
- metadata.gz: 92c049a3f1c46df05f913af77bd2d6e9a2439e2c3d32ab28db9d351a4c22b95da168d5ad1ce29bf7b1333bd0c3d5e044266d78dbf9a950f7b3a45637e33b2724
7
- data.tar.gz: c5314e4c81f28df2be455ab26b4c58ca1de9ed88c8e7ff4e2eeee0a3b8210160db86df8c5ed6ff6adad4257b54366a4bcc6fb3e72527f900af2ff8106de6cf08
6
+ metadata.gz: df12289977268ce367289cea4bd97e0284532dcfdfb4775f6792899ff396f3dbae95b5a8c63a4459b0474f3dde97f245a6aeb34f6d38b7a720ed5f9c4c87dd3b
7
+ data.tar.gz: 30bac502eb17363cf4646d9c4d1674831f37873638f4efec4def2182ac6251f8ff00a6ba6723655a85d6915b86f08a186ebd0499f09a8ff12c6914dd006f31a6
@@ -1,7 +1,10 @@
1
+ language: ruby
1
2
  rvm:
2
- - 1.9.3
3
+ - 2.1.0
3
4
  - 2.0.0
4
- - rbx-19mode
5
+ - 1.9.3
6
+ - rbx-2
7
+ - jruby-19mode
5
8
 
6
9
  gemfile:
7
10
  - Gemfile
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2013 Hampton Catlin, Nathan Weizenbaum and Norman Clarke
1
+ Copyright (c) 2006-2014 Hampton Catlin, Natalie Weizenbaum and Norman Clarke
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Html2haml
2
2
 
3
- [![Build Status](https://travis-ci.org/haml/html2haml.png?branch=master)](https://travis-ci.org/haml/html2haml)
3
+ [![Build Status](https://travis-ci.org/haml/html2haml.svg?branch=master)](https://travis-ci.org/haml/html2haml)
4
+ [![Code Climate](https://codeclimate.com/github/haml/html2haml.svg)](https://codeclimate.com/github/haml/html2haml)
5
+ [![Gem Version](https://badge.fury.io/rb/html2haml.svg)](https://rubygems.org/gems/html2haml)
4
6
 
5
7
  Html2haml, not surprisingly, converts HTML to Haml. It works on HTML with
6
8
  embedded ERB tags as well as plain old HTML.
@@ -68,7 +70,7 @@ See `html2haml --help`:
68
70
 
69
71
  ## License
70
72
 
71
- Copyright (c) 2006-2013 Hampton Catlin, Nathan Weizenbaum and Norman Clarke
73
+ Copyright (c) 2006-2014 Hampton Catlin, Natalie Weizenbaum and Norman Clarke
72
74
 
73
75
  Permission is hereby granted, free of charge, to any person obtaining a copy of
74
76
  this software and associated documentation files (the "Software"), to deal in
data/Rakefile CHANGED
@@ -8,7 +8,11 @@ CLEAN.replace %w(pkg doc coverage .yardoc)
8
8
 
9
9
  Rake::TestTask.new do |t|
10
10
  t.libs << 'lib' << 'test'
11
- t.test_files = Dir["test/**/*_test.rb"]
11
+ if RUBY_PLATFORM == 'java'
12
+ t.test_files = FileList["test/**/*_test.rb"]
13
+ else
14
+ t.test_files = FileList["test/**/*_test.rb"].exclude(/jruby/)
15
+ end
12
16
  t.verbose = true
13
17
  end
14
18
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'nokogiri', '~> 1.6.0'
21
21
  gem.add_dependency 'erubis', '~> 2.7.0'
22
- gem.add_dependency 'ruby_parser', '~> 3.2.1'
22
+ gem.add_dependency 'ruby_parser', '~> 3.5'
23
23
  gem.add_dependency 'haml', '~> 4.0.0'
24
24
  gem.add_development_dependency 'simplecov', '~> 0.7.1'
25
25
  gem.add_development_dependency 'minitest', '~> 4.4.0'
@@ -23,21 +23,14 @@ module Nokogiri
23
23
  def to_haml(tabs, options)
24
24
  return "" if converted_to_haml || to_s.strip.empty?
25
25
  text = uninterp(self.to_s)
26
- node = next_sibling
27
- while node.is_a?(::Nokogiri::XML::Element) && node.name == "haml_loud"
28
- node.converted_to_haml = true
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
37
26
 
38
- node = node.next_sibling
27
+ #ending in a newline stops the inline nodes
28
+ if text.end_with?("\n")
29
+ parse_text_with_interpolation(text, tabs)
30
+ else
31
+ text << process_inline_nodes(next_sibling)
32
+ parse_text_with_interpolation(text, tabs)
39
33
  end
40
- return parse_text_with_interpolation(text, tabs)
41
34
  end
42
35
 
43
36
  private
@@ -80,6 +73,24 @@ module Nokogiri
80
73
  "#{tabulate(tabs)}#{'\\' if Haml::Parser::SPECIAL_CHARACTERS.include?(line[0])}#{line}\n"
81
74
  end.join
82
75
  end
76
+
77
+ def process_inline_nodes(node)
78
+ text = ""
79
+ while node.is_a?(::Nokogiri::XML::Element) && node.name == "haml_loud"
80
+ node.converted_to_haml = true
81
+ text << '#{' <<
82
+ CGI.unescapeHTML(node.inner_text).gsub(/\n\s*/, ' ').strip << '}'
83
+
84
+ if node.next_sibling.is_a?(::Nokogiri::XML::Text)
85
+ node = node.next_sibling
86
+ text << uninterp(node.to_s)
87
+ node.converted_to_haml = true
88
+ end
89
+
90
+ node = node.next_sibling
91
+ end
92
+ text
93
+ end
83
94
  end
84
95
  end
85
96
  end
@@ -135,24 +146,34 @@ module Html2haml
135
146
  template = ERB.compile(template)
136
147
  end
137
148
 
138
- if template =~ /^\s*<!DOCTYPE|<html/i
139
- return @template = Nokogiri.HTML(template)
140
- end
149
+ @template = detect_proper_parser(template)
150
+ end
151
+ end
141
152
 
142
- @template = Nokogiri::HTML.fragment(template)
153
+ def detect_proper_parser(template)
154
+ if template =~ /^\s*<!DOCTYPE|<html/i
155
+ return Nokogiri.HTML(template)
156
+ end
143
157
 
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
158
+ if template =~ /^\s*<head|<body/i
159
+ return Nokogiri.HTML(template).at('/html').children
160
+ end
149
161
 
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
162
+ parsed = Nokogiri::HTML::DocumentFragment.parse(template)
163
+
164
+ #detect missplaced head or body tag
165
+ #XML_HTML_STRUCURE_ERROR : 800
166
+ if parsed.errors.any? {|e| e.code == 800 }
167
+ return Nokogiri.HTML(template).at('/html').children
155
168
  end
169
+
170
+ #in order to support CDATA in HTML (which is invalid) try using the XML parser
171
+ # we can detect this when libxml returns error code XML_ERR_NAME_REQUIRED : 68
172
+ if parsed.errors.any? {|e| e.code == 68 } || template =~ /CDATA/
173
+ return Nokogiri::XML.fragment(template)
174
+ end
175
+
176
+ parsed
156
177
  end
157
178
 
158
179
  # Processes the document and returns the result as a string
@@ -270,6 +291,7 @@ module Html2haml
270
291
  # @see Html2haml::HTML::Node#to_haml
271
292
  def to_haml(tabs, options)
272
293
  return "" if converted_to_haml
294
+
273
295
  if name == "script" &&
274
296
  (attr_hash['type'].nil? || attr_hash['type'].to_s == "text/javascript") &&
275
297
  (attr_hash.keys - ['type']).empty?
@@ -286,7 +308,12 @@ module Html2haml
286
308
  when "haml_loud"
287
309
  lines = CGI.unescapeHTML(inner_text).split("\n").
288
310
  map {|s| s.rstrip}.reject {|s| s.strip.empty?}
289
- lines.first.gsub!(/^[ \t]*/, "= ")
311
+
312
+ if attribute("raw")
313
+ lines.first.gsub!(/^[ \t]*/, "!= ")
314
+ else
315
+ lines.first.gsub!(/^[ \t]*/, "= ")
316
+ end
290
317
 
291
318
  if lines.size > 1 # Multiline script block
292
319
  # Normalize the indentation so that the last line is the base
@@ -385,29 +412,51 @@ module Html2haml
385
412
  end
386
413
 
387
414
  def dynamic_attributes
388
- @dynamic_attributes ||= begin
389
- Hash[attr_hash.map do |name, value|
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
415
+ #reject any attrs without <haml>
416
+ @dynamic_attributes = attr_hash.select {|name, value| value =~ %r{<haml.*</haml} }
417
+ @dynamic_attributes.each do |name, value|
418
+ fragment = Nokogiri::XML.fragment(CGI.unescapeHTML(value))
419
+
420
+ # unwrap interpolation if we can:
421
+ if fragment.children.size == 1 && fragment.child.name == 'haml_loud'
422
+ if attribute_value_can_be_bare_ruby?(fragment.text)
423
+ value.replace(fragment.text.strip)
424
+ next
403
425
  end
404
- end]
426
+ end
427
+
428
+ # turn erb into interpolations
429
+ fragment.css('haml_loud').each do |el|
430
+ inner_text = el.text.strip
431
+ next if inner_text == ""
432
+ el.replace('#{' + inner_text + '}')
433
+ end
434
+
435
+ # put the resulting text in a string
436
+ value.replace('"' + fragment.text.strip + '"')
405
437
  end
406
438
  end
407
439
 
440
+ def attribute_value_can_be_bare_ruby?(value)
441
+ begin
442
+ ruby = RubyParser.new.parse(value)
443
+ rescue Racc::ParseError, RubyParser::SyntaxError
444
+ return false
445
+ end
446
+
447
+ return false if ruby.nil?
448
+ return true if ruby.sexp_type == :str #regular string
449
+ return true if ruby.sexp_type == :dstr #string with interpolation
450
+ return true if ruby.sexp_type == :lit #symbol
451
+ return true if ruby.sexp_type == :call && ruby.mass == 1 #local var or method with no params
452
+
453
+ false
454
+ end
455
+
456
+
408
457
  def to_haml_filter(filter, tabs, options)
409
458
  content =
410
- if children.first.cdata?
459
+ if children.first && children.first.cdata?
411
460
  decode_entities(children.first.content_without_cdata_tokens)
412
461
  else
413
462
  decode_entities(self.inner_text)
@@ -15,6 +15,7 @@ module Html2haml
15
15
  # The ERB tags are converted to HTML tags in the following way.
16
16
  # `<% ... %>` is converted into `<haml_silent> ... </haml_silent>`.
17
17
  # `<%= ... %>` is converted into `<haml_loud> ... </haml_loud>`.
18
+ # `<%== ... %>` is converted into `<haml_loud raw=raw> ... </haml_loud>`.
18
19
  # Finally, if either of these opens a Ruby block,
19
20
  # `<haml_block> ... </haml_block>` will wrap the entire contents of the block -
20
21
  # that is, everything that should be indented beneath the previous silent or loud tag.
@@ -28,11 +29,6 @@ module Html2haml
28
29
  new(template).src
29
30
  end
30
31
 
31
- # `html2haml` doesn't support HTML-escaped expressions.
32
- def escaped_expr(code)
33
- raise Haml::Error.new("html2haml doesn't support escaped expressions.")
34
- end
35
-
36
32
  # The ERB-to-Hamlized-HTML conversion has no preamble.
37
33
  def add_preamble(src); end
38
34
 
@@ -77,6 +73,10 @@ module Html2haml
77
73
  src << '<haml_block>' if block_opener?(code)
78
74
  end
79
75
 
76
+ def add_expr_escaped(src, code)
77
+ src << "<haml_loud raw=raw>" << h(code) << "</haml_loud>"
78
+ end
79
+
80
80
  # `html2haml` doesn't support debugging expressions.
81
81
  def add_expr_debug(src, code)
82
82
  raise Haml::Error.new("html2haml doesn't support debugging expressions.")
@@ -109,7 +109,9 @@ module Html2haml
109
109
  # @param code [String] Ruby code to check
110
110
  # @return [Boolean]
111
111
  def has_code?(code)
112
- code != "\n"
112
+ return false if code == "\n"
113
+ return false if valid_ruby?(code) == nil
114
+ true
113
115
  end
114
116
 
115
117
  # Checks if a string of Ruby code opens a block.
@@ -1,3 +1,3 @@
1
1
  module Html2haml
2
- VERSION = "2.0.0.beta.1"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -11,7 +11,8 @@ class ErbTest < MiniTest::Unit::TestCase
11
11
  def test_inline_erb
12
12
  assert_equal("%p= foo", render_erb("<p><%= foo %></p>"))
13
13
  assert_equal(<<HAML.rstrip, render_erb(<<HTML))
14
- %p= foo
14
+ %p
15
+ = foo
15
16
  HAML
16
17
  <p><%= foo %>
17
18
  </p>
@@ -117,6 +118,16 @@ HTML
117
118
  render_erb('<div class="<%= "foo" %>">Bang!</div>')
118
119
  end
119
120
 
121
+ def test_erb_in_html_escaped_attribute_with_symbol
122
+ assert_equal '%div{:class => :foo} Bang!',
123
+ render_erb('<div class="<%= :foo %>">Bang!</div>')
124
+ end
125
+
126
+ def test_empty_erb_in_attribute
127
+ assert_equal '%div{:class => ""}',
128
+ render_erb('<div class="<%= %>"></div>')
129
+ end
130
+
120
131
  def test_erb_in_attribute_to_multiple_interpolations
121
132
  assert_equal('%div{:class => "#{12} + #{13}"} Math is super',
122
133
  render_erb('<div class="<%= 12 %> + <%= 13 %>">Math is super</div>'))
@@ -198,7 +209,6 @@ ERB
198
209
  = foo + |
199
210
  bar.baz.bang + |
200
211
  baz |
201
- -#
202
212
  = foo.bar do |
203
213
  bang |
204
214
  end |
@@ -482,4 +492,55 @@ HTML
482
492
  ERB
483
493
  end
484
494
 
495
+ def test_conditional_structure_in_argument
496
+ assert_equal(<<HAML.rstrip, render_erb(<<HTML))
497
+ %span{:class => "\#{"active" if condition}"}
498
+ HAML
499
+ <span class="<%= "active" if condition %>"></span>
500
+ HTML
501
+ end
502
+
503
+ def test_method_call_without_brackets_in_argument
504
+ assert_equal(<<HAML.rstrip, render_erb(<<HTML))
505
+ %span{:class => "\#{call_me maybe}"}
506
+ HAML
507
+ <span class="<%= call_me maybe %>"></span>
508
+ HTML
509
+ end
510
+
511
+ def test_multiline_erb_comment
512
+ assert_equal(<<HAML.rstrip, render_erb(<<ERB))
513
+ - # comment
514
+ %p hi
515
+ HAML
516
+ <%
517
+ # comment
518
+ -%>
519
+ <p>hi</p>
520
+ ERB
521
+ end
522
+
523
+ ##
524
+ # <%== %> is supposed to be equal to <%= raw %>
525
+ def test_erb_with_double_equals
526
+ assert_equal(<<HAML.rstrip, render_erb(<<ERB))
527
+ != link_to "https://github.com/haml/html2haml/issues/44"
528
+ HAML
529
+ <%== link_to "https://github.com/haml/html2haml/issues/44" %>
530
+ ERB
531
+ end
532
+
533
+ #https://github.com/haml/html2haml/issues/43
534
+ def test_escaped_ruby_call_when_preceeded_by_text
535
+ assert_equal(<<HAML.rstrip, render_erb(<<ERB))
536
+ random text
537
+ = form_tag(url: sessions_path) do
538
+ = submit_tag "cdcd"
539
+ HAML
540
+ random text
541
+ <%= form_tag(url: sessions_path) do %>
542
+ <%= submit_tag "cdcd" %>
543
+ <% end %>
544
+ ERB
545
+ end
485
546
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require 'test_helper'
2
3
 
3
4
  class Html2HamlTest < MiniTest::Unit::TestCase
@@ -52,6 +53,10 @@ class Html2HamlTest < MiniTest::Unit::TestCase
52
53
  render('<meta http-equiv="Content-Type" content="text/html" />', :ruby19_style_attributes => true))
53
54
  end
54
55
 
56
+ def test_should_have_attributes_without_values
57
+ assert_equal('%input{:disabled => "disabled"}/', render('<input disabled>'))
58
+ end
59
+
55
60
  def test_class_with_dot_and_hash
56
61
  assert_equal('%div{:class => "foo.bar"}', render("<div class='foo.bar'></div>"))
57
62
  assert_equal('%div{:class => "foo#bar"}', render("<div class='foo#bar'></div>"))
@@ -279,6 +284,19 @@ HAML
279
284
  HTML
280
285
  end
281
286
 
287
+ def test_style_to_css_filter_with_no_content
288
+ assert_equal(<<HAML.rstrip, render(<<HTML))
289
+ :css
290
+ HAML
291
+ <style type="text/css"> </style>
292
+ HTML
293
+ assert_equal(<<HAML.rstrip, render(<<HTML))
294
+ :css
295
+ HAML
296
+ <style type="text/css"></style>
297
+ HTML
298
+ end
299
+
282
300
  def test_filter_with_inconsistent_indentation
283
301
  assert_equal(<<HAML.rstrip, render(<<HTML))
284
302
  :css
@@ -387,6 +405,7 @@ HTML
387
405
  !!!
388
406
  %html
389
407
  %head
408
+ %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
390
409
  %title Hello
391
410
  %body
392
411
  %p Hello
@@ -0,0 +1,28 @@
1
+ #reopen classes that need to be modified for JRuby specific behavior
2
+ class ErbTest
3
+ def test_two_multiline_erb_loud_scripts
4
+ assert_equal(<<HAML.rstrip, render_erb(<<ERB))
5
+ .blah
6
+ = foo + |
7
+ bar.baz.bang + |
8
+ baz |
9
+ = foo.bar do |
10
+ bang |
11
+ end |
12
+ %p foo
13
+ HAML
14
+ <div class="blah">
15
+ <%=
16
+ foo +
17
+ bar.baz.bang +
18
+ baz
19
+ %>
20
+ <%= foo.bar do
21
+ bang
22
+ end %>
23
+ <p>foo</p>
24
+ </div>
25
+ ERB
26
+ end
27
+
28
+ end
@@ -0,0 +1,72 @@
1
+ class Html2HamlTest
2
+
3
+ def test_doctype
4
+ empty_body = "\n%html\n %head\n %body"
5
+ assert_equal '!!!' + empty_body, render("<!DOCTYPE html>")
6
+ assert_equal '!!! 1.1' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">')
7
+ assert_equal '!!! Strict' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
8
+ assert_equal '!!! Frameset' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">')
9
+ assert_equal '!!! Mobile 1.2' + empty_body, render('<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">')
10
+ assert_equal '!!! Basic 1.1' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">')
11
+ assert_equal '!!!' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
12
+ assert_equal '!!! Strict' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">')
13
+ assert_equal '!!! Frameset' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">')
14
+ assert_equal '!!!' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">')
15
+ end
16
+
17
+ def test_xhtml_strict_doctype
18
+ assert_equal(<<HAML.rstrip, render(<<HTML))
19
+ !!! Strict
20
+ %html
21
+ %head
22
+ %body
23
+ HAML
24
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
25
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
26
+ HTML
27
+ end
28
+
29
+ def test_html_document_without_doctype
30
+ assert_equal(<<HAML.rstrip, render(<<HTML))
31
+ %html
32
+ %head
33
+ %title Hello
34
+ %body
35
+ %p Hello
36
+ HAML
37
+ <html>
38
+ <head>
39
+ <title>Hello</title>
40
+ </head>
41
+ <body>
42
+ <p>Hello</p>
43
+ </body>
44
+ </html>
45
+ HTML
46
+ end
47
+
48
+ def test_should_have_attributes_without_values
49
+ assert_equal('%input{:disabled => ""}/', render('<input disabled>'))
50
+ end
51
+
52
+ def test_style_to_css_filter_with_following_content
53
+ assert_equal(<<HAML.rstrip, render(<<HTML))
54
+ %head
55
+ :css
56
+ foo {
57
+ bar: baz;
58
+ }
59
+ %body
60
+ Hello
61
+ HAML
62
+ <head>
63
+ <style type="text/css">
64
+ foo {
65
+ bar: baz;
66
+ }
67
+ </style>
68
+ </head>
69
+ <body>Hello</body>
70
+ HTML
71
+ end
72
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2015-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.6.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.6.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: erubis
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 2.7.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 2.7.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: ruby_parser
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 3.2.1
48
+ version: '3.5'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 3.2.1
55
+ version: '3.5'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: haml
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: 4.0.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: 4.0.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simplecov
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: 0.7.1
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 0.7.1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: minitest
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: 4.4.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: 4.4.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  description: Converts HTML into Haml
@@ -118,9 +118,9 @@ executables:
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
- - .gitignore
122
- - .travis.yml
123
- - .yardopts
121
+ - ".gitignore"
122
+ - ".travis.yml"
123
+ - ".yardopts"
124
124
  - Changelog.markdown
125
125
  - Gemfile
126
126
  - MIT-LICENSE
@@ -135,6 +135,8 @@ files:
135
135
  - lib/html2haml/version.rb
136
136
  - test/erb_test.rb
137
137
  - test/html2haml_test.rb
138
+ - test/jruby/erb_test.rb
139
+ - test/jruby/html2haml_test.rb
138
140
  - test/test_helper.rb
139
141
  homepage: http://haml.info
140
142
  licenses: []
@@ -145,21 +147,23 @@ require_paths:
145
147
  - lib
146
148
  required_ruby_version: !ruby/object:Gem::Requirement
147
149
  requirements:
148
- - - '>='
150
+ - - ">="
149
151
  - !ruby/object:Gem::Version
150
152
  version: 1.9.2
151
153
  required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  requirements:
153
- - - '>'
155
+ - - ">="
154
156
  - !ruby/object:Gem::Version
155
- version: 1.3.1
157
+ version: '0'
156
158
  requirements: []
157
159
  rubyforge_project:
158
- rubygems_version: 2.0.3
160
+ rubygems_version: 2.4.5
159
161
  signing_key:
160
162
  specification_version: 4
161
163
  summary: Converts HTML into Haml
162
164
  test_files:
163
165
  - test/erb_test.rb
164
166
  - test/html2haml_test.rb
167
+ - test/jruby/erb_test.rb
168
+ - test/jruby/html2haml_test.rb
165
169
  - test/test_helper.rb