better_html 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95ad9728944ffefd290a95bafdae8287daaabf06
|
4
|
+
data.tar.gz: fe451877b03af1bf86ce58906869682fb6c3d515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc11cea71f259eb4a29240046210578901e02c6d60fb94aad47d8a1cc1bf2059f151e9e925d9bdceda62c3bf7813a2a5e8e6e1cd30bcc3c14d68cf5f2a4acb06
|
7
|
+
data.tar.gz: 4275b7bee8df693a25e2dd2a094e9bba1d1560f35cd046b357926a3203f489b40b7e230df6509ebcff9523fa3befa10839da5fa73ca6342e62cd675aa4d23039
|
@@ -6,7 +6,7 @@ module BetterHtml
|
|
6
6
|
module Tokenizer
|
7
7
|
class BaseErb < ::Erubi::Engine
|
8
8
|
REGEXP_WITHOUT_TRIM = /<%(={1,2}|%)?(.*?)()?%>([ \t]*\r?\n)?/m
|
9
|
-
STMT_TRIM_MATCHER = /\A(-|#)?(.*?)(
|
9
|
+
STMT_TRIM_MATCHER = /\A(-|#)?(.*?)([-=])?\z/m
|
10
10
|
EXPR_TRIM_MATCHER = /\A(.*?)(-)?\z/m
|
11
11
|
|
12
12
|
attr_reader :tokens
|
data/lib/better_html/version.rb
CHANGED
@@ -113,6 +113,16 @@ module BetterHtml
|
|
113
113
|
assert_attributes ({ type: :text, loc: { line: 4, source: "after" } }), scanner.tokens[6]
|
114
114
|
end
|
115
115
|
|
116
|
+
test "right trim with =%>" do
|
117
|
+
scanner = HtmlErb.new("<% trim =%>")
|
118
|
+
assert_equal 4, scanner.tokens.size
|
119
|
+
|
120
|
+
assert_attributes ({ type: :erb_begin, loc: { line: 1, source: '<%' } }), scanner.tokens[0]
|
121
|
+
assert_attributes ({ type: :code, loc: { line: 1, source: " trim " } }), scanner.tokens[1]
|
122
|
+
assert_attributes ({ type: :trim, loc: { line: 1, source: "=" } }), scanner.tokens[2]
|
123
|
+
assert_attributes ({ type: :erb_end, loc: { line: 1, source: "%>" } }), scanner.tokens[3]
|
124
|
+
end
|
125
|
+
|
116
126
|
test "multi-line expression with trim" do
|
117
127
|
scanner = HtmlErb.new("before\n<%= multi\nline -%>\nafter")
|
118
128
|
assert_equal 8, scanner.tokens.size
|