htmlbeautifier 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,7 +95,7 @@ module HtmlBeautifier
95
95
  def scan(html)
96
96
  html = html.strip.gsub(/\t/, @tab)
97
97
  parser = Parser.new do
98
- map %r{(<%=?)(.*?)(%>)}m, :embed
98
+ map %r{(<%-?=?)(.*?)(-?%>)}m, :embed
99
99
  map %r{<!--\[.*?\]>}m, :open_element
100
100
  map %r{<!\[.*?\]-->}m, :close_element
101
101
  map %r{<!--.*?-->}m, :standalone_element
@@ -2,7 +2,7 @@ module HtmlBeautifier #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -11,9 +11,7 @@ module HtmlBeautifierTestUtilities
11
11
  actual = ''
12
12
  beautifier = HtmlBeautifier::Beautifier.new(actual)
13
13
  beautifier.scan(source)
14
- # puts expected
15
- # puts actual
16
- assert_equal expected, actual
14
+ assert expected == actual, "Expected:\n#{expected}\nbut was:\n#{actual}"
17
15
  end
18
16
 
19
17
  end
@@ -178,4 +178,26 @@ class HtmlBeautifierRegressionTest < Test::Unit::TestCase
178
178
  assert_beautifies expected, source
179
179
  end
180
180
 
181
+ def test_should_indent_with_hyphenated_erb_tags
182
+ source = code(%q(
183
+ <%- if @x -%>
184
+ <%- @ys.each do |y| -%>
185
+ <p>Foo</p>
186
+ <%- end -%>
187
+ <%- elsif @z -%>
188
+ <hr />
189
+ <%- end -%>
190
+ ))
191
+ expected = code(%q(
192
+ <%- if @x -%>
193
+ <%- @ys.each do |y| -%>
194
+ <p>Foo</p>
195
+ <%- end -%>
196
+ <%- elsif @z -%>
197
+ <hr />
198
+ <%- end -%>
199
+ ))
200
+ assert_beautifies expected, source
201
+ end
202
+
181
203
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlbeautifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-11 00:00:00 +01:00
12
+ date: 2009-10-13 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -25,13 +25,13 @@ files:
25
25
  - Rakefile
26
26
  - README.txt
27
27
  - bin/htmlbeautifier
28
- - test/test_html_beautifier_regression.rb
29
- - test/test_parser.rb
28
+ - test/html_beautifier_test_utilities.rb
30
29
  - test/test_helper.rb
31
30
  - test/test_html_beautifier_integration.rb
32
- - test/html_beautifier_test_utilities.rb
33
- - lib/htmlbeautifier/parser.rb
31
+ - test/test_html_beautifier_regression.rb
32
+ - test/test_parser.rb
34
33
  - lib/htmlbeautifier/beautifier.rb
34
+ - lib/htmlbeautifier/parser.rb
35
35
  - lib/htmlbeautifier/version.rb
36
36
  - lib/htmlbeautifier.rb
37
37
  has_rdoc: true
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements: []
60
60
 
61
61
  rubyforge_project:
62
- rubygems_version: 1.3.5
62
+ rubygems_version: 1.3.4
63
63
  signing_key:
64
64
  specification_version: 3
65
65
  summary: A normaliser/beautifier for HTML that also understands embedded Ruby.