better_html 0.0.7 → 0.0.8
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: 3a3a50dbfab3ea7cc2e0f83c166345072bb1fa1f
|
4
|
+
data.tar.gz: 1fb0f5196c7069c9ad05af5b13b9993c744d2fbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7de6bd1ecece7d662029e21911a89e54cb0534f07648638ee0e97ef45c1ededddc09256662a49c7b47bc71a21afaca7ccb35b9eebf77ae9fa87fadb99e9d3a61
|
7
|
+
data.tar.gz: d6214164d502b2e00f0b95f3659756f30b49d12e845d825d7946aa1f38c447a3246c8ea09152963c00d13822bf290daa343db45fba806fa7a42448334233896f
|
@@ -9,7 +9,7 @@ module BetterHtml
|
|
9
9
|
attr_reader :tokens
|
10
10
|
attr_reader :parser
|
11
11
|
|
12
|
-
REGEXP_WITHOUT_TRIM = /<%(={1,2}
|
12
|
+
REGEXP_WITHOUT_TRIM = /<%(={1,2}|-|%)?(.*?)(?:[-=])?()?%>([ \t]*\r?\n)?/m
|
13
13
|
|
14
14
|
def initialize(document)
|
15
15
|
@parser = HtmlTokenizer::Parser.new
|
data/lib/better_html/version.rb
CHANGED
@@ -83,6 +83,23 @@ module BetterHtml
|
|
83
83
|
assert_attributes ({ line: 4 }), scanner.tokens[3].location
|
84
84
|
end
|
85
85
|
|
86
|
+
test "line counts with comments" do
|
87
|
+
scanner = BetterHtml::NodeIterator::HtmlErb.new("before\n<%# BO$$ Mode %>\nafter")
|
88
|
+
assert_equal 4, scanner.tokens.size
|
89
|
+
|
90
|
+
assert_attributes ({ type: :text, text: "before\n" }), scanner.tokens[0]
|
91
|
+
assert_attributes ({ line: 1 }), scanner.tokens[0].location
|
92
|
+
|
93
|
+
assert_attributes ({ type: :stmt, text: "<%# BO$$ Mode %>" }), scanner.tokens[1]
|
94
|
+
assert_attributes ({ line: 2 }), scanner.tokens[1].location
|
95
|
+
|
96
|
+
assert_attributes ({ type: :text, text: "\n" }), scanner.tokens[2]
|
97
|
+
assert_attributes ({ line: 2 }), scanner.tokens[2].location
|
98
|
+
|
99
|
+
assert_attributes ({ type: :text, text: "after" }), scanner.tokens[3]
|
100
|
+
assert_attributes ({ line: 3 }), scanner.tokens[3].location
|
101
|
+
end
|
102
|
+
|
86
103
|
private
|
87
104
|
|
88
105
|
def assert_attributes(attributes, token)
|