erubi 1.7.0 → 1.7.1

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
- SHA1:
3
- metadata.gz: '06927703ddb707650937af01e62308503844ea83'
4
- data.tar.gz: a15b6bf8a5bcc28f16aa5ccc4e607946816c6fac
2
+ SHA256:
3
+ metadata.gz: f90a1816343b873297c5d0f5cc2a4d5506c129b3f7613a63cdb34afa82cb28ee
4
+ data.tar.gz: ed8b6d7739ebae9db5818bebd6c42120a155da3d1eef8732f1d1e2b64bfdf417
5
5
  SHA512:
6
- metadata.gz: 1319c023421b758f72d2a0c07d67fa1e1267879a3eb82999a523154b9b7bdd6fdd23b8767f4f058f72c5e75720670271df5f8e70a10e7d1101748962d0e4e386
7
- data.tar.gz: 2a35f88d8c20279919fac6704fe0bc51ed4fcba6d56fb2e6ff7a1fde03c7ea44691a14da10588333daeeb4eb61b3cdae68700006424894fd1dd447eeb0b203ed
6
+ metadata.gz: 56b1f608a9f0f049ae3523afaf8ff1ab0970290f4adb703a1e3b949ee476ddb2347d550e20cef140ec7afa72d1d34bc35d9fd8404c5eb94f43b5fcf644d7d031
7
+ data.tar.gz: d8027fd9255e838d6c4df2064d37d5e2f2fa55c65bbd783b983438684a229706a8d35e3d2fbbaee79ffca0785a68804545acbb40c66ae9e1640322b501c17ff8
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.7.1 (2018-03-05)
2
+
3
+ * Make whitespace handling for <%# %> tags more compatible with Erubis (jeremyevans) (#14)
4
+
1
5
  === 1.7.0 (2017-10-09)
2
6
 
3
7
  * Fix escaping in erubi/capture_end, the setting was previously inverted (jeremyevans) (#10)
@@ -1,5 +1,5 @@
1
1
  copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
2
- copyright(c) 2016-2017 Jeremy Evans
2
+ copyright(c) 2016-2018 Jeremy Evans
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
@@ -13,7 +13,6 @@ the same basic algorithm, with the following differences:
13
13
  * Does no monkey patching (Erubis adds a method to Kernel)
14
14
  * Uses an immutable design (all options passed to the constructor, which returns a frozen object)
15
15
  * Has simpler internals (1 file, <150 lines of code)
16
- * Has an open development model (Erubis doesn't have a public source control repository or bug tracker)
17
16
  * Is not dead (Erubis hasn't been updated since 2011)
18
17
 
19
18
  It is not designed with Erubis API compatibility in mind, though most Erubis
@@ -37,9 +36,8 @@ file:
37
36
  require 'erubi'
38
37
  eval(Erubi::Engine.new(File.read('filename.erb')).src)
39
38
 
40
- Most users are will probably use Erubi via Rails or Tilt. Erubi is the default
41
- erb template handler in Tilt 2.0.6+ and will be the default template handler in
42
- Rails 5.1+.
39
+ Most users will probably use Erubi via Rails or Tilt. Erubi is the default
40
+ erb template handler in Tilt 2.0.6+ and Rails 5.1+.
43
41
 
44
42
  == Capturing
45
43
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Erubi
4
- VERSION = '1.7.0'
4
+ VERSION = '1.7.1'
5
5
  RANGE_ALL = 0..-1
6
6
 
7
7
  if RUBY_VERSION >= '1.9'
@@ -123,7 +123,7 @@ module Erubi
123
123
  end
124
124
  end
125
125
 
126
- is_bol = rspace ? true : false
126
+ is_bol = rspace
127
127
  add_text(text) if text && !text.empty?
128
128
  case ch
129
129
  when '='
@@ -133,7 +133,7 @@ module Erubi
133
133
  add_text(rspace) if rspace
134
134
  when '#'
135
135
  n = code.count("\n") + (rspace ? 1 : 0)
136
- if trim
136
+ if trim && lspace && rspace
137
137
  add_code("\n" * n)
138
138
  else
139
139
  add_text(lspace) if lspace
@@ -119,6 +119,67 @@ END2
119
119
  END3
120
120
  end
121
121
 
122
+ it "should strip only whitespace for <%, <%- and <%# tags" do
123
+ check_output(<<END1, <<END2, <<END3){}
124
+ <% 1 %>
125
+ a
126
+ <%- 2 %>
127
+ b
128
+ <%# 3 %>
129
+ c
130
+ /<% 1 %>
131
+ a
132
+ / <%- 2 %>
133
+ b
134
+ //<%# 3 %>
135
+ c
136
+ <% 1 %> /
137
+ a
138
+ <%- 2 %>/
139
+ b
140
+ <%# 3 %>//
141
+ c
142
+ END1
143
+ _buf = String.new; 1
144
+ _buf << 'a
145
+ '; 2
146
+ _buf << 'b
147
+ ';
148
+ _buf << 'c
149
+ /'; 1 ; _buf << '
150
+ '; _buf << 'a
151
+ / '; 2 ; _buf << '
152
+ '; _buf << 'b
153
+ //';
154
+ _buf << '
155
+ '; _buf << 'c
156
+ '; _buf << ' '; 1 ; _buf << ' /
157
+ a
158
+ '; _buf << ' '; 2 ; _buf << '/
159
+ b
160
+ '; _buf << ' ';; _buf << '//
161
+ c
162
+ ';
163
+ _buf.to_s
164
+ END2
165
+ a
166
+ b
167
+ c
168
+ /
169
+ a
170
+ /
171
+ b
172
+ //
173
+ c
174
+ /
175
+ a
176
+ /
177
+ b
178
+ //
179
+ c
180
+ END3
181
+ end
182
+
122
183
  it "should handle ensure option" do
123
184
  list = ['&\'<>"2']
124
185
  @options[:ensure] = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erubi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-09 00:00:00.000000000 Z
12
+ date: 2018-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 2.6.13
71
+ rubygems_version: 2.7.3
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: Small ERB Implementation