better_html 1.0.11 → 1.0.12

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
- SHA1:
3
- metadata.gz: 5a62a4416eaa383372a21c1b8f90494d681ad7ca
4
- data.tar.gz: bf03706d26596c0b03bec716d2b55f35324221b3
2
+ SHA256:
3
+ metadata.gz: e9a13c27533e3023181c42a6d1d67eec983dd1f1c3dc045eb95c9868a65cc5ac
4
+ data.tar.gz: 6c78a69777c0a02a7409767c5fd746a4c496f99bdfea1cad4bd39c68063ed9bb
5
5
  SHA512:
6
- metadata.gz: 8ede71b45ba3cc636f1d77e76eab6e22eb539014a4fe049e9f91796bb3efc7c8c8d6629f6b2cb8f6a80738a26a892d39341b0c578b28d222a353b945f18266ac
7
- data.tar.gz: 788384054b7e79a080dda17b7cbb3658e14ba1034849ca855fe9e144ac47126246631984ab509c986515e82a063133a647bf94b5f3986b0b3bf8aebb40ffbeaf
6
+ metadata.gz: ad1164a2dc8b92d1b18687b40b2190dae8137036067288f7b138323db8a02712235324353baf44c0f70d3526b0f35cbba78a82c1897211e60f8f8eca744026fc
7
+ data.tar.gz: e229b74bb327bb4e6820c7c90fea5974c4302fe234e2909e2268d24dff8a79a8a236332c46ec4dc0ebe2a910a84de7f174d6fec7b0fa9cb3e8d7c90fa5b0142f
@@ -27,27 +27,28 @@ class BetterHtml::BetterErb
27
27
 
28
28
  module ConditionalImplementation
29
29
 
30
- def call(template)
31
- generate(template)
30
+ def call(template, source = nil)
31
+ generate(template, source)
32
32
  end
33
33
 
34
34
  private
35
35
 
36
- def generate(template)
36
+ def generate(template, source)
37
37
  # First, convert to BINARY, so in case the encoding is
38
38
  # wrong, we can still find an encoding tag
39
39
  # (<%# encoding %>) inside the String using a regular
40
40
  # expression
41
41
 
42
+ source ||= template.source
42
43
  filename = template.identifier.split("/").last
43
44
  exts = filename.split(".")
44
45
  exts = exts[1..exts.length].join(".")
45
- template_source = template.source.dup.force_encoding(Encoding::ASCII_8BIT)
46
+ template_source = source.dup.force_encoding(Encoding::ASCII_8BIT)
46
47
 
47
48
  erb = template_source.gsub(ActionView::Template::Handlers::ERB::ENCODING_TAG, '')
48
49
  encoding = $2
49
50
 
50
- erb.force_encoding valid_encoding(template.source.dup, encoding)
51
+ erb.force_encoding valid_encoding(source.dup, encoding)
51
52
 
52
53
  # Always make sure we return a String in the default_internal
53
54
  erb.encode!
@@ -1,3 +1,3 @@
1
1
  module BetterHtml
2
- VERSION = "1.0.11"
2
+ VERSION = "1.0.12"
3
3
  end
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.11
4
+ version: 1.0.12
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-24 00:00:00.000000000 Z
11
+ date: 2019-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -239,59 +239,59 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  requirements: []
241
241
  rubyforge_project:
242
- rubygems_version: 2.6.14
242
+ rubygems_version: 2.7.6
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: Better HTML for Rails.
246
246
  test_files:
247
- - test/dummy/public/404.html
248
- - test/dummy/public/favicon.ico
249
- - test/dummy/public/422.html
250
- - test/dummy/public/500.html
251
- - test/dummy/config.ru
252
- - test/dummy/bin/setup
253
- - test/dummy/bin/rake
247
+ - test/test_helper.rb
248
+ - test/better_html/helpers_test.rb
249
+ - test/better_html/better_erb/implementation_test.rb
250
+ - test/better_html/errors_test.rb
251
+ - test/better_html/parser_test.rb
252
+ - test/better_html/tokenizer/token_array_test.rb
253
+ - test/better_html/tokenizer/token_test.rb
254
+ - test/better_html/tokenizer/html_lodash_test.rb
255
+ - test/better_html/tokenizer/location_test.rb
256
+ - test/better_html/tokenizer/html_erb_test.rb
257
+ - test/better_html/test_helper/safe_erb/script_interpolation_test.rb
258
+ - test/better_html/test_helper/safe_erb/allowed_script_type_test.rb
259
+ - test/better_html/test_helper/safe_erb/no_javascript_tag_helper_test.rb
260
+ - test/better_html/test_helper/safe_erb/no_statements_test.rb
261
+ - test/better_html/test_helper/safe_erb/tag_interpolation_test.rb
262
+ - test/better_html/test_helper/ruby_node_test.rb
263
+ - test/better_html/test_helper/safe_lodash_tester_test.rb
264
+ - test/dummy/app/controllers/application_controller.rb
265
+ - test/dummy/app/helpers/application_helper.rb
266
+ - test/dummy/app/views/layouts/application.html.erb
267
+ - test/dummy/app/assets/stylesheets/application.css
268
+ - test/dummy/app/assets/javascripts/application.js
254
269
  - test/dummy/bin/bundle
270
+ - test/dummy/bin/rake
255
271
  - test/dummy/bin/rails
256
- - test/dummy/README.rdoc
257
- - test/dummy/config/database.yml
258
- - test/dummy/config/secrets.yml
259
- - test/dummy/config/environments/development.rb
260
- - test/dummy/config/environments/production.rb
261
- - test/dummy/config/environments/test.rb
262
- - test/dummy/config/initializers/cookies_serializer.rb
272
+ - test/dummy/bin/setup
263
273
  - test/dummy/config/initializers/filter_parameter_logging.rb
264
- - test/dummy/config/initializers/backtrace_silencers.rb
265
274
  - test/dummy/config/initializers/wrap_parameters.rb
266
- - test/dummy/config/initializers/inflections.rb
267
- - test/dummy/config/initializers/assets.rb
275
+ - test/dummy/config/initializers/backtrace_silencers.rb
276
+ - test/dummy/config/initializers/cookies_serializer.rb
268
277
  - test/dummy/config/initializers/session_store.rb
278
+ - test/dummy/config/initializers/assets.rb
269
279
  - test/dummy/config/initializers/mime_types.rb
280
+ - test/dummy/config/initializers/inflections.rb
281
+ - test/dummy/config/secrets.yml
282
+ - test/dummy/config/application.rb
283
+ - test/dummy/config/database.yml
284
+ - test/dummy/config/environment.rb
270
285
  - test/dummy/config/boot.rb
271
286
  - test/dummy/config/locales/en.yml
272
- - test/dummy/config/environment.rb
273
- - test/dummy/config/application.rb
287
+ - test/dummy/config/environments/development.rb
288
+ - test/dummy/config/environments/test.rb
289
+ - test/dummy/config/environments/production.rb
274
290
  - test/dummy/config/routes.rb
275
- - test/dummy/app/helpers/application_helper.rb
276
- - test/dummy/app/views/layouts/application.html.erb
277
- - test/dummy/app/controllers/application_controller.rb
278
- - test/dummy/app/assets/stylesheets/application.css
279
- - test/dummy/app/assets/javascripts/application.js
291
+ - test/dummy/public/500.html
292
+ - test/dummy/public/favicon.ico
293
+ - test/dummy/public/422.html
294
+ - test/dummy/public/404.html
280
295
  - test/dummy/Rakefile
281
- - test/test_helper.rb
282
- - test/better_html/helpers_test.rb
283
- - test/better_html/errors_test.rb
284
- - test/better_html/parser_test.rb
285
- - test/better_html/better_erb/implementation_test.rb
286
- - test/better_html/test_helper/safe_erb/script_interpolation_test.rb
287
- - test/better_html/test_helper/safe_erb/no_javascript_tag_helper_test.rb
288
- - test/better_html/test_helper/safe_erb/tag_interpolation_test.rb
289
- - test/better_html/test_helper/safe_erb/no_statements_test.rb
290
- - test/better_html/test_helper/safe_erb/allowed_script_type_test.rb
291
- - test/better_html/test_helper/ruby_node_test.rb
292
- - test/better_html/test_helper/safe_lodash_tester_test.rb
293
- - test/better_html/tokenizer/location_test.rb
294
- - test/better_html/tokenizer/html_lodash_test.rb
295
- - test/better_html/tokenizer/html_erb_test.rb
296
- - test/better_html/tokenizer/token_array_test.rb
297
- - test/better_html/tokenizer/token_test.rb
296
+ - test/dummy/config.ru
297
+ - test/dummy/README.rdoc