Hello community, here is the log from the commit of package rubygem-haml for openSUSE:Factory checked in at 2019-08-06 15:09:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-haml (Old) and /work/SRC/openSUSE:Factory/.rubygem-haml.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-haml" Tue Aug 6 15:09:37 2019 rev:30 rq:717298 version:5.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-haml/rubygem-haml.changes 2017-12-07 13:51:54.113500752 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-haml.new.4126/rubygem-haml.changes 2019-08-06 15:09:39.623798109 +0200 @@ -1,0 +2,26 @@ +Fri Jul 19 09:15:36 UTC 2019 - Stephan Kulow <[email protected]> + +- updated to version 5.1.1 + see installed CHANGELOG.md + + ## 5.1.1 + + Released on May 25, 2019 + ([diff](https://github.com/haml/haml/compare/v5.1.0...v5.1.1)). + + * Fix NameError bug for that happens on ruby 2.6.1-2.6.3 + haml 5.1.0 + rails 4.2.x + erubi. (Akira Matsuda) + + ## 5.1.0 + + Released on May 16, 2019 + ([diff](https://github.com/haml/haml/compare/v5.0.4...v5.1.0)). + + * Rails 6 support [#1008](https://github.com/haml/haml/pull/1008) (thanks [Seb Jacobs](https://github.com/sebjacobs)) + * Add `escape_filter_interpolations` option for backwards compatibility with haml 4 defaults [#984](https://github.com/haml/haml/pull/984) (thanks [Will Jordan](https://github.com/wjordan)) + * Fix error on empty :javascript and :css filter blocks [#986](https://github.com/haml/haml/pull/986) (thanks [Will Jordan](https://github.com/wjordan)) + * Respect changes in Haml::Options.defaults in `Haml::TempleEngine` options (Takashi Kokubun) + * Un-freeze TempleEngine precompiled string literals [#983](https://github.com/haml/haml/pull/983) (thanks [Will Jordan](https://github.com/wjordan)) + * Various performance/memory improvements [#965](https://github.com/haml/haml/pull/965), [#966](https://github.com/haml/haml/pull/966), [#963](https://github.com/haml/haml/pull/963) (thanks [Dillon Welch](https://github.com/oniofchaos)) + * Enable `frozen_string_literal` magic comment for all .rb files [#967](https://github.com/haml/haml/pull/967) (thanks [Dillon Welch](https://github.com/oniofchaos)) + +------------------------------------------------------------------- Old: ---- haml-5.0.4.gem New: ---- haml-5.1.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-haml.spec ++++++ --- /var/tmp/diff_new_pack.Cqbw9J/_old 2019-08-06 15:09:40.711797493 +0200 +++ /var/tmp/diff_new_pack.Cqbw9J/_new 2019-08-06 15:09:40.711797493 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-haml # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,7 +24,7 @@ # Name: rubygem-haml -Version: 5.0.4 +Version: 5.1.1 Release: 0 %define mod_name haml %define mod_full_name %{mod_name}-%{version} ++++++ haml-5.0.4.gem -> haml-5.1.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2017-10-13 10:07:03.000000000 +0200 +++ new/.travis.yml 2019-05-25 04:04:40.000000000 +0200 @@ -4,14 +4,18 @@ cache: bundler rvm: - ruby-head - - 2.4.2 - - 2.3.5 - - 2.2.8 + - 2.6.3 + - 2.5.5 + - 2.4.6 + - 2.3.8 + - 2.2.10 - 2.1.10 - 2.0.0 - - jruby-9.1.12.0 + - jruby-9.2.7.0 - rbx-3 gemfile: + - test/gemfiles/Gemfile.rails-6.0.x + - test/gemfiles/Gemfile.rails-5.2.x - test/gemfiles/Gemfile.rails-5.1.x - test/gemfiles/Gemfile.rails-5.0.x - test/gemfiles/Gemfile.rails-5.0.x.erubi @@ -21,6 +25,20 @@ matrix: exclude: - rvm: 2.0.0 + gemfile: test/gemfiles/Gemfile.rails-6.0.x + - rvm: 2.1.10 + gemfile: test/gemfiles/Gemfile.rails-6.0.x + - rvm: 2.2.10 + gemfile: test/gemfiles/Gemfile.rails-6.0.x + - rvm: 2.3.8 + gemfile: test/gemfiles/Gemfile.rails-6.0.x + - rvm: 2.4.6 + gemfile: test/gemfiles/Gemfile.rails-6.0.x + - rvm: 2.0.0 + gemfile: test/gemfiles/Gemfile.rails-5.2.x + - rvm: 2.1.10 + gemfile: test/gemfiles/Gemfile.rails-5.2.x + - rvm: 2.0.0 gemfile: test/gemfiles/Gemfile.rails-5.1.x - rvm: 2.1.10 gemfile: test/gemfiles/Gemfile.rails-5.1.x @@ -32,12 +50,28 @@ gemfile: test/gemfiles/Gemfile.rails-5.0.x - rvm: 2.1.10 gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi - - rvm: 2.4.2 + - rvm: 2.4.6 gemfile: test/gemfiles/Gemfile.rails-4.0.x - - rvm: 2.4.2 + - rvm: 2.4.6 gemfile: test/gemfiles/Gemfile.rails-4.1.x - - rvm: 2.4.2 + - rvm: 2.4.6 gemfile: test/gemfiles/Gemfile.rails-4.2.x + - rvm: 2.5.5 + gemfile: test/gemfiles/Gemfile.rails-4.0.x + - rvm: 2.5.5 + gemfile: test/gemfiles/Gemfile.rails-4.1.x + - rvm: 2.5.5 + gemfile: test/gemfiles/Gemfile.rails-4.2.x + - rvm: 2.6.3 + gemfile: test/gemfiles/Gemfile.rails-4.0.x + - rvm: 2.6.3 + gemfile: test/gemfiles/Gemfile.rails-4.1.x + - rvm: 2.6.3 + gemfile: test/gemfiles/Gemfile.rails-4.2.x + - rvm: 2.6.3 + gemfile: test/gemfiles/Gemfile.rails-5.0.x + - rvm: 2.6.3 + gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi - rvm: ruby-head gemfile: test/gemfiles/Gemfile.rails-4.0.x - rvm: ruby-head @@ -45,10 +79,21 @@ - rvm: ruby-head gemfile: test/gemfiles/Gemfile.rails-4.2.x include: - - rvm: 2.4.2 + - rvm: 2.6.3 gemfile: test/gemfiles/Gemfile.rails-edge allow_failures: + - rvm: ruby-head - rvm: rbx-3 - gemfile: test/gemfiles/Gemfile.rails-edge + - rvm: jruby-9.2.7.0 + gemfile: test/gemfiles/Gemfile.rails-4.2.x + - rvm: jruby-9.2.7.0 + gemfile: test/gemfiles/Gemfile.rails-4.1.x + - rvm: jruby-9.2.7.0 + gemfile: test/gemfiles/Gemfile.rails-4.0.x + - rvm: jruby-9.2.7.0 + gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi fast_finish: true +before_install: gem i rubygems-update -v '<3' && update_rubygems # https://github.com/travis-ci/travis-ci/issues/8974 +before_install: gem i bundler -v '<2' script: "bundle exec rake submodules test" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.yardopts new/.yardopts --- old/.yardopts 2017-10-13 10:07:03.000000000 +0200 +++ new/.yardopts 2019-05-25 04:04:40.000000000 +0200 @@ -7,8 +7,7 @@ --title "Haml Documentation" --query 'object.type != :classvariable' --query 'object.type != :constant || @api && @api.text == "public"' ---exclude lib/haml/template/patch.rb ---exclude lib/haml/template/plugin.rb +--exclude lib/haml/plugin.rb --exclude lib/haml/railtie.rb --exclude lib/haml/helpers/action_view_mods.rb --exclude lib/haml/helpers/xss_mods.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2017-10-13 10:07:03.000000000 +0200 +++ new/CHANGELOG.md 2019-05-25 04:04:40.000000000 +0200 @@ -1,5 +1,25 @@ # Haml Changelog +## 5.1.1 + +Released on May 25, 2019 +([diff](https://github.com/haml/haml/compare/v5.1.0...v5.1.1)). + +* Fix NameError bug for that happens on ruby 2.6.1-2.6.3 + haml 5.1.0 + rails 4.2.x + erubi. (Akira Matsuda) + +## 5.1.0 + +Released on May 16, 2019 +([diff](https://github.com/haml/haml/compare/v5.0.4...v5.1.0)). + +* Rails 6 support [#1008](https://github.com/haml/haml/pull/1008) (thanks [Seb Jacobs](https://github.com/sebjacobs)) +* Add `escape_filter_interpolations` option for backwards compatibility with haml 4 defaults [#984](https://github.com/haml/haml/pull/984) (thanks [Will Jordan](https://github.com/wjordan)) +* Fix error on empty :javascript and :css filter blocks [#986](https://github.com/haml/haml/pull/986) (thanks [Will Jordan](https://github.com/wjordan)) +* Respect changes in Haml::Options.defaults in `Haml::TempleEngine` options (Takashi Kokubun) +* Un-freeze TempleEngine precompiled string literals [#983](https://github.com/haml/haml/pull/983) (thanks [Will Jordan](https://github.com/wjordan)) +* Various performance/memory improvements [#965](https://github.com/haml/haml/pull/965), [#966](https://github.com/haml/haml/pull/966), [#963](https://github.com/haml/haml/pull/963) (thanks [Dillon Welch](https://github.com/oniofchaos)) +* Enable `frozen_string_literal` magic comment for all .rb files [#967](https://github.com/haml/haml/pull/967) (thanks [Dillon Welch](https://github.com/oniofchaos)) + ## 5.0.4 Released on October 13, 2017 @@ -1452,4 +1472,3 @@ YARD is an excellent documentation system, and allows us to write our documentation in [Maruku](http://maruku.rubyforge.org), which is also excellent. ->>>>>>> External Changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2017-10-13 10:07:03.000000000 +0200 +++ new/Gemfile 2019-05-25 04:04:40.000000000 +0200 @@ -5,7 +5,7 @@ gem "pry" group :docs do - gem "yard", "~> 0.8.0" + gem "yard" gem "kramdown" gem "sass" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE --- old/MIT-LICENSE 2017-10-13 10:07:03.000000000 +0200 +++ new/MIT-LICENSE 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2006-2009 Hampton Catlin and Natalie Weizenbaum +Copyright (c) 2006-2019 Hampton Catlin and Natalie Weizenbaum Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -17,4 +17,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-10-13 10:07:03.000000000 +0200 +++ new/README.md 2019-05-25 04:04:40.000000000 +0200 @@ -2,7 +2,7 @@ [](http://rubygems.org/gems/haml) [](http://travis-ci.org/haml/haml) -[](https://codeclimate.com/github/haml/haml) +[](https://codeclimate.com/github/haml/haml) [](https://coveralls.io/r/haml/haml) [](http://inch-ci.org/github/haml/haml) @@ -191,7 +191,7 @@ Beyond that, the implementation is licensed under the MIT License. -Copyright (c) 2006-2013 Hampton Catlin, Natalie Weizenbaum and the Haml team +Copyright (c) 2006-2019 Hampton Catlin, Natalie Weizenbaum and the Haml team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/REFERENCE.md new/REFERENCE.md --- old/REFERENCE.md 2017-10-13 10:07:03.000000000 +0200 +++ new/REFERENCE.md 2019-05-25 04:04:40.000000000 +0200 @@ -115,6 +115,11 @@ Haml::Options.defaults[:format] = :html5 +In sinatra specifically, you can set them in global config with: +```ruby +set :haml, { escape_html: true } +``` + Finally, you can also set them by passing an options hash to {Haml::Engine#initialize}. For the complete list of available options, please see {Haml::Options}. @@ -1120,8 +1125,8 @@ <p>I <strong>really</strong> prefer <em>raspberry</em> jam.</p> </div> -Note that `#{}` interpolation within filters is HTML-escaped if you specify -{Haml::Options#escape_html `:escape_html`} option. +Note that `#{}` interpolation within filters is HTML-escaped if you specify true to +{Haml::Options#escape_filter_interpolations `:escape_filter_interpolations`} option. The functionality of some filters such as Markdown can be provided by many different libraries. Usually you don't have to worry about this - you can just diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/benchmark.rb new/benchmark.rb --- old/benchmark.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/benchmark.rb 2019-05-25 04:04:40.000000000 +0200 @@ -12,7 +12,7 @@ exit 1 end -%w[erb erubis rails active_support action_controller +%w[erb erubi rails active_support action_controller action_view action_pack haml/template rbench].each {|dep| require(dep)} def view @@ -28,7 +28,7 @@ RBench.run(times) do column :haml, :title => "Haml" column :erb, :title => "ERB" - column :erubis, :title => "Erubis" + column :erubi, :title => "Erubi" template_name = 'standard' haml_template = File.read("#{File.dirname(__FILE__)}/test/templates/#{template_name}.haml") @@ -38,12 +38,16 @@ obj = Object.new Haml::Engine.new(haml_template).def_method(obj, :haml) - Erubis::Eruby.new(erb_template).def_method(obj, :erubis) - obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end") + if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ + obj.instance_eval("def erb; #{ERB.new(erb_template, trim_mode: '-').src}; end") + else + obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end") + end + obj.instance_eval("def erubi; #{Erubi::Engine.new(erb_template).src}; end") haml { obj.haml } erb { obj.erb } - erubis { obj.erubis } + erubi { obj.erubi } end report "ActionView" do @@ -51,8 +55,8 @@ render view, 'templates/standard' render view, 'erb/standard' - haml { render view, 'templates/standard' } - erb { render view, 'erb/standard' } + haml { render view, 'templates/standard' } + erubi { render view, 'erb/standard' } end report "ActionView with deep partials" do @@ -60,7 +64,7 @@ render view, 'templates/action_view' render view, 'erb/action_view' - haml { render view, 'templates/action_view' } - erb { render view, 'erb/action_view' } + haml { render view, 'templates/action_view' } + erubi { render view, 'erb/action_view' } end end Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haml.gemspec new/haml.gemspec --- old/haml.gemspec 2017-10-13 10:07:03.000000000 +0200 +++ new/haml.gemspec 2019-05-25 04:04:40.000000000 +0200 @@ -6,16 +6,22 @@ spec.summary = "An elegant, structured (X)HTML/XML templating engine." spec.version = Haml::VERSION spec.authors = ['Natalie Weizenbaum', 'Hampton Catlin', 'Norman Clarke', 'Akira Matsuda'] - spec.email = ['[email protected]', '[email protected]'] + spec.email = ['[email protected]', '[email protected]'] - readmes = Dir['*'].reject{ |x| x =~ /(^|[^.a-z])[a-z]+/ || x == "TODO" } spec.executables = ['haml'] spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{\Atest/}) end spec.homepage = 'http://haml.info/' - spec.has_rdoc = false spec.license = "MIT" + spec.metadata = { + "bug_tracker_uri" => "https://github.com/haml/haml/issues", + "changelog_uri" => "https://github.com/haml/haml/blob/master/CHANGELOG.md", + "documentation_uri" => "http://haml.info/docs.html", + "homepage_uri" => "http://haml.info", + "mailing_list_uri" => "https://groups.google.com/forum/?fromgroups#!forum/haml", + "source_code_uri" => "https://github.com/haml/haml" + } spec.required_ruby_version = '>= 2.0.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/attribute_builder.rb new/lib/haml/attribute_builder.rb --- old/lib/haml/attribute_builder.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/attribute_builder.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml module AttributeBuilder # https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/attribute_compiler.rb new/lib/haml/attribute_compiler.rb --- old/lib/haml/attribute_compiler.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/attribute_compiler.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'haml/attribute_parser' module Haml @@ -6,7 +7,7 @@ # @param type [Symbol] :static or :dynamic # @param key [String] # @param value [String] Actual string value for :static type, value's Ruby literal for :dynamic type. - class AttributeValue < Struct.new(:type, :key, :value) + AttributeValue = Struct.new(:type, :key, :value) do # @return [String] A Ruby literal of value. def to_literal case type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/attribute_parser.rb new/lib/haml/attribute_parser.rb --- old/lib/haml/attribute_parser.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/attribute_parser.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,8 +1,10 @@ # frozen_string_literal: true + begin require 'ripper' rescue LoadError end +require 'temple/static_analyzer' module Haml # Haml::AttriubuteParser parses Hash literal to { String (key name) => String (value literal) }. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/buffer.rb new/lib/haml/buffer.rb --- old/lib/haml/buffer.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/buffer.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml # This class is used only internally. It holds the buffer of HTML that # is eventually output as the resulting document. @@ -132,7 +133,9 @@ def attributes(class_id, obj_ref, *attributes_hashes) attributes = class_id attributes_hashes.each do |old| - AttributeBuilder.merge_attributes!(attributes, Hash[old.map {|k, v| [k.to_s, v]}]) + result = {} + old.each { |k, v| result[k.to_s] = v } + AttributeBuilder.merge_attributes!(attributes, result) end AttributeBuilder.merge_attributes!(attributes, parse_object_ref(obj_ref)) if obj_ref AttributeBuilder.build_attributes( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/compiler.rb new/lib/haml/compiler.rb --- old/lib/haml/compiler.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/compiler.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require 'haml/attribute_builder' require 'haml/attribute_compiler' require 'haml/temple_line_counter' @@ -167,7 +168,7 @@ end def compile_filter - unless filter = @filters[@node.value[:name]] + unless (filter = @filters[@node.value[:name]]) name = @node.value[:name] if ["maruku", "textile"].include?(name) raise Error.new(Error.message(:install_haml_contrib, name), @node.line - 1) @@ -315,7 +316,7 @@ case last.first when :text - last[1].rstrip! + last[1] = last[1].rstrip if last[1].empty? @to_merge.slice! index rstrip_buffer! index diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/engine.rb new/lib/haml/engine.rb --- old/lib/haml/engine.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/engine.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require 'forwardable' require 'haml/parser' @@ -51,6 +52,9 @@ # see {file:REFERENCE.md#options the Haml options documentation} # @raise [Haml::Error] if there's a Haml syntax error in the template def initialize(template, options = {}) + # Reflect changes of `Haml::Options.defaults` to `Haml::TempleEngine` options, but `#initialize_encoding` + # should be run against the arguemnt `options[:encoding]` for backward compatibility with old `Haml::Engine`. + options = Options.defaults.dup.tap { |o| o.delete(:encoding) }.merge!(options) @options = Options.new(options) @template = check_haml_encoding(template) do |msg, line| @@ -166,8 +170,13 @@ end begin - eval("Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {};" << - @temple_engine.precompiled_with_ambles(local_names) << "}\n", scope, @options.filename, @options.line) + str = @temple_engine.precompiled_with_ambles(local_names) + eval( + "Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {}; #{str}}\n", + scope, + @options.filename, + @options.line + ) rescue ::SyntaxError => e raise SyntaxError, e.message end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/error.rb new/lib/haml/error.rb --- old/lib/haml/error.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/error.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml # An exception raised by Haml code. class Error < StandardError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/escapable.rb new/lib/haml/escapable.rb --- old/lib/haml/escapable.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/escapable.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml # Like Temple::Filters::Escapable, but with support for escaping by # Haml::Herlpers.html_escape and Haml::Herlpers.escape_once. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/exec.rb new/lib/haml/exec.rb --- old/lib/haml/exec.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/exec.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'optparse' require 'rbconfig' require 'pp' @@ -337,11 +338,9 @@ end def validate_ruby(code) - begin - eval("BEGIN {return nil}; #{code}", binding, @options[:filename] || "") - rescue ::SyntaxError # Not to be confused with Haml::SyntaxError - $! - end + eval("BEGIN {return nil}; #{code}", binding, @options[:filename] || "") + rescue ::SyntaxError # Not to be confused with Haml::SyntaxError + $! end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/filters.rb new/lib/haml/filters.rb --- old/lib/haml/filters.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/filters.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require "tilt" module Haml @@ -119,7 +120,7 @@ # @param text [String] The source text for the filter to process # @return [String] The filtered result # @raise [Haml::Error] if it's not overridden - def render(text) + def render(_text) raise Error.new("#{self.inspect}#render not defined!") end @@ -130,7 +131,7 @@ # @param text [String] The source text for the filter to process # @return [String] The filtered result # @raise [Haml::Error] if it or \{#render} isn't overridden - def render_with_options(text, options) + def render_with_options(text, _options) render(text) end @@ -164,7 +165,11 @@ if contains_interpolation?(text) return if options[:suppress_eval] - text = unescape_interpolation(text, options[:escape_html]).gsub(/(\\+)n/) do |s| + escape = options[:escape_filter_interpolations] + # `escape_filter_interpolations` defaults to `escape_html` if unset. + escape = options[:escape_html] if escape.nil? + + text = unescape_interpolation(text, escape).gsub(/(\\+)n/) do |s| escapes = $1.size next s if escapes % 2 == 0 "#{'\\' * (escapes - 1)}\n" @@ -182,9 +187,8 @@ return end - rendered = Haml::Helpers::find_and_preserve(filter.render_with_options(text, compiler.options), compiler.options[:preserve]) - rendered.rstrip! - push_text("#{rendered}\n") + rendered = Haml::Helpers::find_and_preserve(filter.render_with_options(text.to_s, compiler.options), compiler.options[:preserve]) + push_text("#{rendered.rstrip}\n") end end end @@ -247,10 +251,7 @@ # @see Base#render def render(text) - text = "\n#{text}" - text.rstrip! - text.gsub!("\n", "\n ") - "<![CDATA[#{text}\n]]>" + "<![CDATA[#{"\n#{text.rstrip}".gsub("\n", "\n ")}\n]]>" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/generator.rb new/lib/haml/generator.rb --- old/lib/haml/generator.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/generator.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + module Haml # Ruby code generator, which is a limited version of Temple::Generator. # Limit methods since Haml doesn't need most of them. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/action_view_extensions.rb new/lib/haml/helpers/action_view_extensions.rb --- old/lib/haml/helpers/action_view_extensions.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/action_view_extensions.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml module Helpers @@action_view_defined = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/action_view_mods.rb new/lib/haml/helpers/action_view_mods.rb --- old/lib/haml/helpers/action_view_mods.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/action_view_mods.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml module Helpers module ActionViewMods @@ -52,10 +53,12 @@ end module TagHelper + DEFAULT_PRESERVE_OPTIONS = %w(textarea pre code).freeze + def content_tag_with_haml(name, *args, &block) return content_tag_without_haml(name, *args, &block) unless is_haml? - preserve = haml_buffer.options.fetch(:preserve, %w[textarea pre code]).include?(name.to_s) + preserve = haml_buffer.options.fetch(:preserve, DEFAULT_PRESERVE_OPTIONS).include?(name.to_s) if block_given? && block_is_haml?(block) && preserve return content_tag_without_haml(name, *args) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/action_view_xss_mods.rb new/lib/haml/helpers/action_view_xss_mods.rb --- old/lib/haml/helpers/action_view_xss_mods.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/action_view_xss_mods.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ActionView module Helpers module CaptureHelper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/safe_erubi_template.rb new/lib/haml/helpers/safe_erubi_template.rb --- old/lib/haml/helpers/safe_erubi_template.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/safe_erubi_template.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'action_view' module Haml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/safe_erubis_template.rb new/lib/haml/helpers/safe_erubis_template.rb --- old/lib/haml/helpers/safe_erubis_template.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/safe_erubis_template.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'action_view' module Haml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers/xss_mods.rb new/lib/haml/helpers/xss_mods.rb --- old/lib/haml/helpers/xss_mods.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers/xss_mods.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml module Helpers # This module overrides Haml helpers to work properly diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/helpers.rb new/lib/haml/helpers.rb --- old/lib/haml/helpers.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/helpers.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require 'erb' module Haml @@ -109,10 +110,7 @@ # @yield The block within which to escape newlines def find_and_preserve(input = nil, tags = haml_buffer.options[:preserve], &block) return find_and_preserve(capture_haml(&block), input || tags) if block - tags = tags.each_with_object('') do |t, s| - s << '|' unless s.empty? - s << Regexp.escape(t) - end + tags = tags.map { |tag| Regexp.escape(tag) }.join('|') re = /<(#{tags})([^>]*)>(.*?)(<\/\1>)/im input.to_s.gsub(re) do |s| s =~ re # Can't rely on $1, etc. existing since Rails' SafeBuffer#gsub is incompatible @@ -200,8 +198,8 @@ # @yield [item] A block which contains Haml code that goes within list items # @yieldparam item An element of `enum` def list_of(enum, opts={}, &block) - opts_attributes = opts.each_with_object('') {|(k, v), s| s << " #{k}='#{v}'"} - enum.each_with_object('') do |i, ret| + opts_attributes = opts.map { |k, v| " #{k}='#{v}'" }.join + enum.map do |i| result = capture_haml(i, &block) if result.count("\n") > 1 @@ -211,9 +209,8 @@ result.strip! end - ret << "\n" unless ret.empty? - ret << %Q!<li#{opts_attributes}>#{result}</li>! - end + %Q!<li#{opts_attributes}>#{result}</li>! + end.join("\n") end # Returns a hash containing default assignments for the `xmlns`, `lang`, and `xml:lang` @@ -704,4 +701,3 @@ false end end - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/options.rb new/lib/haml/options.rb --- old/lib/haml/options.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/options.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml # This class encapsulates all of the configuration options that Haml # understands. Please see the {file:REFERENCE.md#options Haml Reference} to @@ -8,7 +9,7 @@ @valid_formats = [:html4, :html5, :xhtml] @buffer_option_keys = [:autoclose, :preserve, :attr_wrapper, :format, - :encoding, :escape_html, :escape_attrs, :hyphenate_data_attrs, :cdata] + :encoding, :escape_html, :escape_filter_interpolations, :escape_attrs, :hyphenate_data_attrs, :cdata] # The default option values. # @return Hash @@ -85,6 +86,13 @@ # Defaults to false. attr_accessor :escape_html + # Sets whether or not to escape HTML-sensitive characters in interpolated strings. + # See also {file:REFERENCE.md#escaping_html Escaping HTML} and + # {file:REFERENCE.md#unescaping_html Unescaping HTML}. + # + # Defaults to the current value of `escape_html`. + attr_accessor :escape_filter_interpolations + # The name of the Haml file being parsed. # This is only used as information when exceptions are raised. This is # automatically assigned when working through ActionView, so it's really diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/parser.rb new/lib/haml/parser.rb --- old/lib/haml/parser.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/parser.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require 'strscan' module Haml @@ -178,7 +179,7 @@ private # @private - class Line < Struct.new(:whitespace, :text, :full, :index, :parser, :eod) + Line = Struct.new(:whitespace, :text, :full, :index, :parser, :eod) do alias_method :eod?, :eod # @private @@ -194,7 +195,7 @@ end # @private - class ParseNode < Struct.new(:type, :line, :value, :parent, :children) + ParseNode = Struct.new(:type, :line, :value, :parent, :children) do def initialize(*args) super self.children ||= [] @@ -207,12 +208,13 @@ # @param [String] new - Hash literal including dynamic values. # @param [String] old - Hash literal including dynamic values or Ruby literal of multiple Hashes which MUST be interpreted as method's last arguments. - class DynamicAttributes < Struct.new(:new, :old) + DynamicAttributes = Struct.new(:new, :old) do + undef :old= def old=(value) unless value =~ /\A{.*}\z/m raise ArgumentError.new('Old attributes must start with "{" and end with "}"') end - super + self[:old] = value end # This will be a literal for Haml::Buffer#attributes's last argument, `attributes_hashes`. @@ -287,7 +289,7 @@ end def block_keyword(text) - return unless keyword = text.scan(BLOCK_KEYWORD_REGEX)[0] + return unless (keyword = text.scan(BLOCK_KEYWORD_REGEX)[0]) keyword[0] || keyword[1] end @@ -534,7 +536,7 @@ # Post-process case statements to normalize the nesting of "when" clauses return unless node.value[:keyword] == "case" - return unless first = node.children.first + return unless (first = node.children.first) return unless first.type == :silent_script && first.value[:keyword] == "when" return if first.children.empty? # If the case node has a "when" child with children, it's the @@ -583,9 +585,9 @@ scanner = StringScanner.new(text) scanner.scan(/\s+/) until scanner.eos? - return unless key = scanner.scan(LITERAL_VALUE_REGEX) + return unless (key = scanner.scan(LITERAL_VALUE_REGEX)) return unless scanner.scan(/\s*=>\s*/) - return unless value = scanner.scan(LITERAL_VALUE_REGEX) + return unless (value = scanner.scan(LITERAL_VALUE_REGEX)) return unless scanner.scan(/\s*(?:,|$)\s*/) attributes[eval(key).to_s] = eval(value).to_s end @@ -698,7 +700,7 @@ end static_attributes = {} - dynamic_attributes = "{" + dynamic_attributes = "{".dup attributes.each do |name, (type, val)| if type == :static static_attributes[name] = val @@ -713,7 +715,7 @@ end def parse_new_attribute(scanner) - unless name = scanner.scan(/[-:\w]+/) + unless (name = scanner.scan(/[-:\w]+/)) return if scanner.scan(/\)/) return false end @@ -722,8 +724,8 @@ return name, [:static, true] unless scanner.scan(/=/) #/end scanner.scan(/\s*/) - unless quote = scanner.scan(/["']/) - return false unless var = scanner.scan(/(@@?|\$)?\w+/) + unless (quote = scanner.scan(/["']/)) + return false unless (var = scanner.scan(/(@@?|\$)?\w+/)) return name, [:dynamic, var] end @@ -738,7 +740,7 @@ return name, [:static, content.first[1]] if content.size == 1 return name, [:dynamic, - %!"#{content.each_with_object('') {|(t, v), s| s << (t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}")}}"!] + %!"#{content.each_with_object(''.dup) {|(t, v), s| s << (t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}")}}"!] end def next_line diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/plugin.rb new/lib/haml/plugin.rb --- old/lib/haml/plugin.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/plugin.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,11 +1,12 @@ # frozen_string_literal: true + module Haml # This module makes Haml work with Rails using the template handler API. class Plugin def handles_encoding?; true; end - def compile(template) + def compile(template, source) options = Haml::Template.options.dup if template.respond_to?(:type) options[:mime_type] = template.type @@ -13,14 +14,16 @@ options[:mime_type] = template.mime_type end options[:filename] = template.identifier - Haml::Engine.new(template.source, options).compiler.precompiled_with_ambles( + Haml::Engine.new(source, options).compiler.precompiled_with_ambles( [], after_preamble: '@output_buffer = output_buffer ||= ActionView::OutputBuffer.new if defined?(ActionView::OutputBuffer)', ) end - def self.call(template) - new.compile(template) + def self.call(template, source = nil) + source ||= template.source + + new.compile(template, source) end def cache_fragment(block, name = {}, options = nil) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/railtie.rb new/lib/haml/railtie.rb --- old/lib/haml/railtie.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/railtie.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,10 +1,11 @@ # frozen_string_literal: true + require 'haml/template/options' # check for a compatible Rails version when Haml is loaded if (activesupport_spec = Gem.loaded_specs['activesupport']) - if activesupport_spec.version.to_s < '3.2' - raise Exception.new("\n\n** Haml now requires Rails 3.2 and later. Use Haml version 4.0.4\n\n") + if activesupport_spec.version.to_s < '4.0' + raise Exception.new("\n\n** Haml now requires Rails 4.0 and later. Use Haml version 4.0.x\n\n") end end @@ -33,8 +34,7 @@ # solved by looking for ::Erubi first. # However, in JRuby, the const_defined? finds it anyway, so we must make sure that it's # not just a reference to ::Erubi. - if defined?(::Erubi) && const_defined?('ActionView::Template::Handlers::ERB::Erubi') && - ActionView::Template::Handlers::ERB::Erubi != ::Erubi + if defined?(::Erubi) && (::ActionView::Template::Handlers::ERB.const_get('Erubi') != ::Erubi) require "haml/helpers/safe_erubi_template" Haml::Filters::RailsErb.template_class = Haml::SafeErubiTemplate else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/sass_rails_filter.rb new/lib/haml/sass_rails_filter.rb --- old/lib/haml/sass_rails_filter.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/sass_rails_filter.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml module Filters # This is an extension of Sass::Rails's SassTemplate class that allows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/template/options.rb new/lib/haml/template/options.rb --- old/lib/haml/template/options.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/template/options.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + # We keep options in its own self-contained file # so that we can load it independently in Rails 3, # where the full template stuff is lazy-loaded. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/template.rb new/lib/haml/template.rb --- old/lib/haml/template.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/template.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'haml/template/options' if defined?(ActiveSupport) ActiveSupport.on_load(:action_view) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/temple_engine.rb new/lib/haml/temple_engine.rb --- old/lib/haml/temple_engine.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/temple_engine.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ -# frozen_string_literal: false +# frozen_string_literal: true + require 'temple' require 'haml/escapable' require 'haml/generator' @@ -13,6 +14,7 @@ encoding: nil, escape_attrs: true, escape_html: false, + escape_filter_interpolations: nil, filename: '(haml)', format: :html5, hyphenate_data_attrs: true, @@ -49,12 +51,12 @@ # @return [String] def precompiled encoding = Encoding.find(@encoding || '') - return @precompiled.force_encoding(encoding) if encoding == Encoding::ASCII_8BIT + return @precompiled.dup.force_encoding(encoding) if encoding == Encoding::ASCII_8BIT return @precompiled.encode(encoding) end def precompiled_with_return_value - "#{precompiled};#{precompiled_method_return_value}" + "#{precompiled};#{precompiled_method_return_value}".dup end # The source code that is evaluated to produce the Haml document. @@ -64,20 +66,20 @@ # # @return [String] def precompiled_with_ambles(local_names, after_preamble: '') - preamble = <<END.tr!("\n", ';') + preamble = <<END.tr("\n", ';') begin extend Haml::Helpers _hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{Options.new(options).for_buffer.inspect}) _erbout = _hamlout.buffer #{after_preamble} END - postamble = <<END.tr!("\n", ';') + postamble = <<END.tr("\n", ';') #{precompiled_method_return_value} ensure @haml_buffer = @haml_buffer.upper if @haml_buffer end END - "#{preamble}#{locals_code(local_names)}#{precompiled}#{postamble}" + "#{preamble}#{locals_code(local_names)}#{precompiled}#{postamble}".dup end private @@ -99,12 +101,12 @@ def locals_code(names) names = names.keys if Hash === names - names.each_with_object('') do |name, code| + names.map do |name| # Can't use || because someone might explicitly pass in false with a symbol sym_local = "_haml_locals[#{inspect_obj(name.to_sym)}]" str_local = "_haml_locals[#{inspect_obj(name.to_s)}]" - code << "#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local};" - end + "#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local};" + end.join end def inspect_obj(obj) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/temple_line_counter.rb new/lib/haml/temple_line_counter.rb --- old/lib/haml/temple_line_counter.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/temple_line_counter.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml # A module to count lines of expected code. This would be faster than actual code generation # and counting newlines in it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/util.rb new/lib/haml/util.rb --- old/lib/haml/util.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/util.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true begin require 'erubis/tiny' @@ -166,7 +166,7 @@ # and the rest of the string. # `["Foo (Bar (Baz bang) bop)", " (Bang (bop bip))"]` in the example above. def balance(scanner, start, finish, count = 0) - str = '' + str = ''.dup scanner = StringScanner.new(scanner) unless scanner.is_a? StringScanner regexp = Regexp.new("(.*?)[\\#{start.chr}\\#{finish.chr}]", Regexp::MULTILINE) while scanner.scan(regexp) @@ -199,7 +199,7 @@ end def unescape_interpolation(str, escape_html = nil) - res = '' + res = ''.dup rest = Haml::Util.handle_interpolation str.dump do |scan| escapes = (scan[2].size - 1) / 2 char = scan[3] # '{', '@' or '$' @@ -212,7 +212,7 @@ else scan.scan(/\w+/) end - content = eval('"' + interpolated + '"') + content = eval("\"#{interpolated}\"") content.prepend(char) if char == '@' || char == '$' content = "Haml::Helpers.html_escape((#{content}))" if escape_html @@ -234,7 +234,7 @@ scanner = StringScanner.new(str.dup.force_encoding(Encoding::ASCII_8BIT)) bom = scanner.scan(/\xEF\xBB\xBF/n) return bom unless scanner.scan(/-\s*#\s*/n) - if coding = try_parse_haml_emacs_magic_comment(scanner) + if (coding = try_parse_haml_emacs_magic_comment(scanner)) return bom, coding end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml/version.rb new/lib/haml/version.rb --- old/lib/haml/version.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml/version.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Haml - VERSION = "5.0.4" + VERSION = "5.1.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/haml.rb new/lib/haml.rb --- old/lib/haml.rb 2017-10-13 10:07:03.000000000 +0200 +++ new/lib/haml.rb 2019-05-25 04:04:40.000000000 +0200 @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'haml/version' # The module that contains everything Haml-related: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-10-13 10:07:03.000000000 +0200 +++ new/metadata 2019-05-25 04:04:40.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: haml version: !ruby/object:Gem::Version - version: 5.0.4 + version: 5.1.1 platform: ruby authors: - Natalie Weizenbaum @@ -11,7 +11,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2017-10-13 00:00:00.000000000 Z +date: 2019-05-25 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: temple @@ -105,7 +105,7 @@ but it can function as a stand-alone templating engine. email: - [email protected] -- [email protected] +- [email protected] executables: - haml extensions: [] @@ -163,7 +163,13 @@ homepage: http://haml.info/ licenses: - MIT -metadata: {} +metadata: + bug_tracker_uri: https://github.com/haml/haml/issues + changelog_uri: https://github.com/haml/haml/blob/master/CHANGELOG.md + documentation_uri: http://haml.info/docs.html + homepage_uri: http://haml.info + mailing_list_uri: https://groups.google.com/forum/?fromgroups#!forum/haml + source_code_uri: https://github.com/haml/haml post_install_message: rdoc_options: [] require_paths: @@ -179,8 +185,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: -rubygems_version: 2.6.14 +rubygems_version: 3.0.3 signing_key: specification_version: 4 summary: An elegant, structured (X)HTML/XML templating engine.
