better_html 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c51581d5c834e5560f9ba999ec11a4902f57cb7
4
- data.tar.gz: cdb3a16f6c3cbfe74e7fc70d7685e63d2c00099b
3
+ metadata.gz: 3a3a50dbfab3ea7cc2e0f83c166345072bb1fa1f
4
+ data.tar.gz: 1fb0f5196c7069c9ad05af5b13b9993c744d2fbf
5
5
  SHA512:
6
- metadata.gz: ccdcf32b31d7aec4852181f6b0ccdaaad3b14fddcf0b4a08bf5b50ac298ac1bf9ff3ea26880835961c0cf571de5aeaab05613bee842322c31f51da703c1abf2c
7
- data.tar.gz: b9e2780e3b16b06bdbd124c2b1d0026656ae68a9d9665121d62fc9ed614091e649037e263eccb7f3593123ee07bb1bd052ceb8c8ba75fe1822661a11fefc7fcc
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}|-|\#|%)?(.*?)(?:[-=])?()?%>([ \t]*\r?\n)?/m
12
+ REGEXP_WITHOUT_TRIM = /<%(={1,2}|-|%)?(.*?)(?:[-=])?()?%>([ \t]*\r?\n)?/m
13
13
 
14
14
  def initialize(document)
15
15
  @parser = HtmlTokenizer::Parser.new
@@ -1,3 +1,3 @@
1
1
  module BetterHtml
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francois Chagnon