better_html 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/better_html/test_helper/safe_erb/no_javascript_tag_helper.rb +1 -1
- data/lib/better_html/test_helper/safe_erb/script_interpolation.rb +1 -1
- data/lib/better_html/test_helper/safe_erb/tag_interpolation.rb +1 -1
- data/lib/better_html/tokenizer/base_erb.rb +2 -1
- data/lib/better_html/version.rb +1 -1
- data/test/better_html/tokenizer/html_erb_test.rb +6 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a62a4416eaa383372a21c1b8f90494d681ad7ca
|
4
|
+
data.tar.gz: bf03706d26596c0b03bec716d2b55f35324221b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ede71b45ba3cc636f1d77e76eab6e22eb539014a4fe049e9f91796bb3efc7c8c8d6629f6b2cb8f6a80738a26a892d39341b0c578b28d222a353b945f18266ac
|
7
|
+
data.tar.gz: 788384054b7e79a080dda17b7cbb3658e14ba1034849ca855fe9e144ac47126246631984ab509c986515e82a063133a647bf94b5f3986b0b3bf8aebb40ffbeaf
|
@@ -14,7 +14,7 @@ module BetterHtml
|
|
14
14
|
def no_javascript_tag_helper(node)
|
15
15
|
erb_nodes(node).each do |erb_node, indicator_node, code_node|
|
16
16
|
indicator = indicator_node&.loc&.source
|
17
|
-
next if indicator == '#'
|
17
|
+
next if indicator == '#' || indicator == '%'
|
18
18
|
source = code_node.loc.source
|
19
19
|
|
20
20
|
ruby_node = begin
|
@@ -25,7 +25,7 @@ module BetterHtml
|
|
25
25
|
erb_nodes(node).each do |erb_node, indicator_node, code_node|
|
26
26
|
next unless indicator_node.present?
|
27
27
|
indicator = indicator_node.loc.source
|
28
|
-
next if indicator == '#'
|
28
|
+
next if indicator == '#' || indicator == '%'
|
29
29
|
source = code_node.loc.source
|
30
30
|
|
31
31
|
ruby_node = begin
|
@@ -67,7 +67,7 @@ module BetterHtml
|
|
67
67
|
def validate_text_node(text_node)
|
68
68
|
erb_nodes(text_node).each do |erb_node, indicator_node, code_node|
|
69
69
|
indicator = indicator_node&.loc&.source
|
70
|
-
next if indicator == '#'
|
70
|
+
next if indicator == '#' || indicator == '%'
|
71
71
|
source = code_node.loc.source
|
72
72
|
|
73
73
|
ruby_node = begin
|
@@ -29,7 +29,8 @@ module BetterHtml
|
|
29
29
|
|
30
30
|
def add_code(code)
|
31
31
|
if code[0] == '%'
|
32
|
-
|
32
|
+
add_erb_tokens(nil, '%', code[1..-1], nil)
|
33
|
+
append("<%#{code}%>")
|
33
34
|
else
|
34
35
|
_, ltrim_or_comment, code, rtrim = *STMT_TRIM_MATCHER.match(code)
|
35
36
|
ltrim = ltrim_or_comment if ltrim_or_comment == '-'
|
data/lib/better_html/version.rb
CHANGED
@@ -152,19 +152,14 @@ module BetterHtml
|
|
152
152
|
|
153
153
|
test "escaped opening ERB tag <%%" do
|
154
154
|
scanner = HtmlErb.new(buffer("just some <%%= text %> no erb"))
|
155
|
-
assert_equal
|
155
|
+
assert_equal 6, scanner.tokens.size
|
156
156
|
|
157
157
|
assert_attributes ({ type: :text, loc: { line: 1, source: "just some " } }), scanner.tokens[0]
|
158
|
-
assert_attributes ({ type: :
|
159
|
-
assert_attributes ({ type: :
|
160
|
-
assert_attributes ({ type: :
|
161
|
-
assert_attributes ({ type: :
|
162
|
-
assert_attributes ({ type: :
|
163
|
-
assert_attributes ({ type: :malformed, loc: { line: 1, source: "%>" } }), scanner.tokens[6]
|
164
|
-
assert_attributes ({ type: :whitespace, loc: { line: 1, source: " " } }), scanner.tokens[7]
|
165
|
-
assert_attributes ({ type: :attribute_name, loc: { line: 1, source: "no" } }), scanner.tokens[8]
|
166
|
-
assert_attributes ({ type: :whitespace, loc: { line: 1, source: " " } }), scanner.tokens[9]
|
167
|
-
assert_attributes ({ type: :attribute_name, loc: { line: 1, source: "erb" } }), scanner.tokens[10]
|
158
|
+
assert_attributes ({ type: :erb_begin, loc: { line: 1, source: '<%' } }), scanner.tokens[1]
|
159
|
+
assert_attributes ({ type: :indicator, loc: { line: 1, source: "%" } }), scanner.tokens[2]
|
160
|
+
assert_attributes ({ type: :code, loc: { line: 1, source: "= text " } }), scanner.tokens[3]
|
161
|
+
assert_attributes ({ type: :erb_end, loc: { line: 1, source: "%>" } }), scanner.tokens[4]
|
162
|
+
assert_attributes ({ type: :text, loc: { line: 1, source: " no erb" } }), scanner.tokens[5]
|
168
163
|
end
|
169
164
|
|
170
165
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Chagnon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|