htmlbeautifier 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,11 @@ module HtmlBeautifier
|
|
4
4
|
class Beautifier
|
5
5
|
|
6
6
|
RUBY_INDENT =
|
7
|
-
%r{ ^ ( if | unless | while | begin | elsif )\b
|
7
|
+
%r{ ^ ( if | unless | while | begin | elsif | else )\b
|
8
8
|
| \b ( do | \{ ) ( \s* \| [^\|]+ \| )? $
|
9
9
|
}x
|
10
10
|
RUBY_OUTDENT =
|
11
|
-
%r{ ^ ( end | elsif |\} ) \b
|
11
|
+
%r{ ^ ( end | elsif | else |\} ) \b
|
12
12
|
}x
|
13
13
|
ELEMENT_CONTENT = %r{ (?:[^<>]|<%.*?%>)* }mx
|
14
14
|
|
@@ -178,6 +178,24 @@ class HtmlBeautifierRegressionTest < Test::Unit::TestCase
|
|
178
178
|
assert_beautifies expected, source
|
179
179
|
end
|
180
180
|
|
181
|
+
def test_should_outdent_else
|
182
|
+
source = code(%q(
|
183
|
+
<% if @x %>
|
184
|
+
Foo
|
185
|
+
<% else %>
|
186
|
+
Bar
|
187
|
+
<% end %>
|
188
|
+
))
|
189
|
+
expected = code(%q(
|
190
|
+
<% if @x %>
|
191
|
+
Foo
|
192
|
+
<% else %>
|
193
|
+
Bar
|
194
|
+
<% end %>
|
195
|
+
))
|
196
|
+
assert_beautifies expected, source
|
197
|
+
end
|
198
|
+
|
181
199
|
def test_should_indent_with_hyphenated_erb_tags
|
182
200
|
source = code(%q(
|
183
201
|
<%- if @x -%>
|
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.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Battley
|
@@ -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.
|
62
|
+
rubygems_version: 1.3.5
|
63
63
|
signing_key:
|
64
64
|
specification_version: 3
|
65
65
|
summary: A normaliser/beautifier for HTML that also understands embedded Ruby.
|