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: 32b2be796cb45394207282b6a25e8693d1ce3f97
4
- data.tar.gz: 476a5f910d219388ae59fce6d659a42c39592b7c
3
+ metadata.gz: 95ad9728944ffefd290a95bafdae8287daaabf06
4
+ data.tar.gz: fe451877b03af1bf86ce58906869682fb6c3d515
5
5
  SHA512:
6
- metadata.gz: e1db514d84e7fd2ba2f6af76afeb01ca1dfd386d98b4c0cf969046e7ab48b4359a3c6697e38836db7722916a250dd716e5e477376981c9b711f48dd435626990
7
- data.tar.gz: 9cc7b477585bdb26bedc4ee9858e8a1b02d0ba9fdbc19f4dc602049bbc6ae359429443cd3ea0939da4913165042df6d49c781980436c04514e19bc4d1521f116
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(-|#)?(.*?)(-)?\z/m
9
+ STMT_TRIM_MATCHER = /\A(-|#)?(.*?)([-=])?\z/m
10
10
  EXPR_TRIM_MATCHER = /\A(.*?)(-)?\z/m
11
11
 
12
12
  attr_reader :tokens
@@ -1,3 +1,3 @@
1
1
  module BetterHtml
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -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
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: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francois Chagnon