-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump haml from 6.1.2 to 6.2.3 #536
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [haml](https://github.com/haml/haml) from 6.1.2 to 6.2.3. - [Release notes](https://github.com/haml/haml/releases) - [Changelog](https://github.com/haml/haml/blob/main/CHANGELOG.md) - [Commits](haml/haml@v6.1.2...v6.2.3) --- updated-dependencies: - dependency-name: haml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
gem compare haml 6.1.2 6.2.3 Compared versions: ["6.1.2", "6.2.3"]
DIFFERENT date:
6.1.2: 2023-08-12 00:00:00 UTC
6.2.3: 2023-10-04 00:00:00 UTC
DIFFERENT extensions:
6.1.2: ["ext/haml/extconf.rb"]
6.2.3: []
DIFFERENT require_paths:
6.1.2: ["/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/haml-6.1.2", "lib"]
6.2.3: ["lib"]
DIFFERENT rubygems_version:
6.1.2: 3.4.1
6.2.3: 3.3.26
DIFFERENT version:
6.1.2: 6.1.2
6.2.3: 6.2.3
DIFFERENT files:
6.1.2->6.2.3:
* Deleted:
ext/haml/extconf.rb
ext/haml/haml.c
ext/haml/hescape.c
ext/haml/hescape.h
* Changed:
CHANGELOG.md +36/-1
FAQ.md +1/-1
README.md +5/-5
REFERENCE.md +25/-29
Rakefile +3/-37
haml.gemspec +1/-7
lib/haml/attribute_builder.rb +124/-136
lib/haml/attribute_compiler.rb +10/-5
lib/haml/compiler/doctype_compiler.rb +8/-2
lib/haml/rails_template.rb +5/-0
lib/haml/util.rb +5/-4
lib/haml/version.rb +1/-1
DIFFERENT development dependencies:
6.1.2->6.2.3:
* Deleted:
rake-compiler [">= 0"] (development) |
gem compare --diff haml 6.1.2 6.2.3 Compared versions: ["6.1.2", "6.2.3"]
DIFFERENT files:
6.1.2->6.2.3:
* Deleted:
ext/haml/extconf.rb
ext/haml/haml.c
ext/haml/hescape.c
ext/haml/hescape.h
* Changed:
CHANGELOG.md
--- /tmp/d20231004-1962-775rez/haml-6.1.2/CHANGELOG.md 2023-10-04 09:27:37.433758857 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/CHANGELOG.md 2023-10-04 09:27:37.449758985 +0000
@@ -2,0 +3,29 @@
+## 6.2.3
+
+* Resurrect RDFa doctype support [#1147](https://github.com/haml/haml/issues/1147)
+
+## 6.2.2
+
+* Allow adding custom attributes to `Haml::BOOLEAN_ATTRIBUTES` [#1148](https://github.com/haml/haml/issues/1148)
+* Consider `aria-xxx: false` as a boolean attribute
+
+## 6.2.1
+
+* Fix v6.2.0's bug in rendering dynamic `aria` attributes [#1149](https://github.com/haml/haml/issues/1149)
+
+## 6.2.0
+
+* Drop the C extension [#1146](https://github.com/haml/haml/issues/1146)
+
+## 6.1.4
+
+* Let `Haml::Util.escape_html` use `ERB::Escape` if available [#1145](https://github.com/haml/haml/issues/1145)
+
+## 6.1.3
+
+* Add `Haml::RailsTemplate#default_format` for Turbo compatibility [#1144](https://github.com/haml/haml/issues/1144)
+
+## 6.1.2
+
+* Use the rails template path as `filename` [#1140](https://github.com/haml/haml/issues/1140)
+
@@ -104,0 +134,6 @@
+ * Alternatives to the removed helpers:
+ * Some simple ones could work by copying [the original definition](https://github.com/haml/haml/blob/v5.2.2/lib/haml/helpers.rb).
+ * For helpers generating general HTML tags, also consider using what your framework provides, e.g. Rails `content_tag`.
+ Same applies to `capture_haml`, e.g. Rails `capture`.
+ * Ones that rely on `Haml::Buffer` have no direct alternative by design. They existed at the cost of performance.
+ You need to define a helper, instantiate a String buffer in it, append stuff to it, and call it inside `=`.
@@ -1429 +1464 @@
- %a(href="http://haml.info" title="Haml's so cool!")
+ %a(href="https://haml.info" title="Haml's so cool!")
FAQ.md
--- /tmp/d20231004-1962-775rez/haml-6.1.2/FAQ.md 2023-10-04 09:27:37.437758889 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/FAQ.md 2023-10-04 09:27:37.449758985 +0000
@@ -144 +144 @@
-Sorry! Try looking at the [Haml](http://haml.info/docs/yardoc/file.REFERENCE.html) reference,
+Sorry! Try looking at the [Haml](https://haml.info/docs/yardoc/file.REFERENCE.html) reference,
README.md
--- /tmp/d20231004-1962-775rez/haml-6.1.2/README.md 2023-10-04 09:27:37.437758889 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/README.md 2023-10-04 09:27:37.449758985 +0000
@@ -3 +3 @@
-[![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
+[![Gem Version](https://badge.fury.io/rb/haml.svg)](https://rubygems.org/gems/haml)
@@ -34 +34 @@
-To use Haml programmatically, check out the [YARD documentation](http://haml.info/docs/yardoc/).
+To use Haml programmatically, check out the [YARD documentation](https://haml.info/docs/yardoc/).
@@ -123 +123 @@
-documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
+documentation](https://haml.info/docs/yardoc/file.REFERENCE.html)
@@ -135 +135 @@
-[guidelines](http://haml.info/development.html#contributing).
+[guidelines](https://haml.info/development.html#contributing).
@@ -185 +185 @@
-[Norman Clarke](http://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
+[Norman Clarke](https://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
REFERENCE.md
--- /tmp/d20231004-1962-775rez/haml-6.1.2/REFERENCE.md 2023-10-04 09:27:37.437758889 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/REFERENCE.md 2023-10-04 09:27:37.449758985 +0000
@@ -1203,9 +1203,7 @@
-```ruby
-class HelloFilter < Haml::Filters::Base
- def compile(_node)
- [:static, "hello world"]
- end
-end
-
-Haml::Filters.registered[:hello] ||= HelloFilter
-```
+ class HelloFilter < Haml::Filters::Base
+ def compile(_node)
+ [:static, "hello world"]
+ end
+ end
+
+ Haml::Filters.registered[:hello] ||= HelloFilter
@@ -1215,16 +1213,17 @@
-```ruby
-class BetterFilter < Haml::Filters::Base
- def compile(node)
- temple = [:multi]
- temple << [:static, "hello "]
- temple << compile_text(node.value[:text])
- temple << [:static, " world"]
- temple
- end
-
- private
- def compile_text(text)
- if ::Haml::Util.contains_interpolation?(text)
- [:dynamic, ::Haml::Util.unescape_interpolation(text)]
- else
- [:static, text]
+ class BetterFilter < Haml::Filters::Base
+ def compile(node)
+ temple = [:multi]
+ temple << [:static, "hello "]
+ temple << compile_text(node.value[:text])
+ temple << [:static, " world"]
+ temple
+ end
+
+ private
+ def compile_text(text)
+ if ::Haml::Util.contains_interpolation?(text)
+ [:dynamic, ::Haml::Util.unescape_interpolation(text)]
+ else
+ [:static, text]
+ end
+ end
@@ -1232,2 +1230,0 @@
- end
-end
@@ -1235,2 +1232 @@
-Haml::Filters.registered[:better] ||= BetterFilter
-```
+ Haml::Filters.registered[:better] ||= BetterFilter
Rakefile
--- /tmp/d20231004-1962-775rez/haml-6.1.2/Rakefile 2023-10-04 09:27:37.437758889 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/Rakefile 2023-10-04 09:27:37.449758985 +0000
@@ -2,16 +1,0 @@
-
-#
-# Prepend DevKit into compilation phase
-#
-if Gem.win_platform?
- desc 'Activates DevKit'
- task :devkit do
- begin
- require 'devkit'
- rescue LoadError
- abort 'Failed to load DevKit required for compilation'
- end
- end
- task compile: :devkit
-end
-
@@ -19,18 +2,0 @@
-if /java/ === RUBY_PLATFORM
- # require 'rake/javaextensiontask'
- # Rake::JavaExtensionTask.new(:haml) do |ext|
- # ext.ext_dir = 'ext/java'
- # ext.lib_dir = 'lib/haml'
- # end
-
- task :compile do
- # dummy for now
- end
-else
- require 'rake/extensiontask'
- Rake::ExtensionTask.new(:haml) do |ext|
- ext.lib_dir = 'lib/haml'
- end
-end
-
-Dir['benchmark/*.rake'].each { |b| import(b) }
@@ -45 +11 @@
-task test: :compile
+task :test
@@ -48 +14 @@
-task bench: :compile do
+task :bench do
@@ -82 +48 @@
-task default: %w[compile test]
+task default: :test
haml.gemspec
--- /tmp/d20231004-1962-775rez/haml-6.1.2/haml.gemspec 2023-10-04 09:27:37.437758889 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/haml.gemspec 2023-10-04 09:27:37.453759017 +0000
@@ -24,6 +24 @@
- if /java/ === RUBY_PLATFORM
- spec.platform = 'java'
- else
- spec.extensions = ['ext/haml/extconf.rb']
- spec.required_ruby_version = '>= 2.1.0'
- end
+ spec.required_ruby_version = '>= 2.1.0'
@@ -44 +38,0 @@
- spec.add_development_dependency 'rake-compiler'
lib/haml/attribute_builder.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/attribute_builder.rb 2023-10-04 09:27:37.441758921 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/attribute_builder.rb 2023-10-04 09:27:37.453759017 +0000
@@ -5,29 +5,21 @@
- BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
- autoplay controls loop selected hidden scoped async
- defer reversed ismap seamless muted required
- autofocus novalidate formnovalidate open pubdate
- itemscope allowfullscreen default inert sortable
- truespeed typemustmatch download].freeze
-
- # For JRuby, TruffleRuby, and Wasm, fallback to Ruby implementation.
- if /java|wasm/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
- class << self
- def build(escape_attrs, quote, format, boolean_attributes, object_ref, *hashes)
- hashes << Haml::ObjectRef.parse(object_ref) if object_ref
- buf = []
- hash = merge_all_attrs(hashes)
-
- keys = hash.keys.sort!
- keys.each do |key|
- case key
- when 'id'.freeze
- buf << " id=#{quote}#{build_id(escape_attrs, *hash[key])}#{quote}"
- when 'class'.freeze
- buf << " class=#{quote}#{build_class(escape_attrs, *hash[key])}#{quote}"
- when 'data'.freeze
- buf << build_data(escape_attrs, quote, *hash[key])
- when *boolean_attributes, /\Adata-/
- build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
- else
- buf << " #{key}=#{quote}#{escape_html(escape_attrs, hash[key].to_s)}#{quote}"
- end
+ class << self
+ def build(escape_attrs, quote, format, object_ref, *hashes)
+ hashes << Haml::ObjectRef.parse(object_ref) if object_ref
+ buf = []
+ hash = merge_all_attrs(hashes)
+
+ keys = hash.keys.sort!
+ keys.each do |key|
+ case key
+ when 'id'
+ buf << " id=#{quote}#{build_id(escape_attrs, *hash[key])}#{quote}"
+ when 'class'
+ buf << " class=#{quote}#{build_class(escape_attrs, *hash[key])}#{quote}"
+ when 'data'
+ buf << build_data(escape_attrs, quote, *hash[key])
+ when 'aria'
+ buf << build_aria(escape_attrs, quote, *hash[key])
+ when *Haml::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
+ build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
+ else
+ buf << " #{key}=#{quote}#{escape_html(escape_attrs, hash[key].to_s)}#{quote}"
@@ -35,5 +26,0 @@
- buf.join
- end
-
- def build_id(escape_attrs, *values)
- escape_html(escape_attrs, values.flatten.select { |v| v }.join('_'))
@@ -40,0 +28,2 @@
+ buf.join
+ end
@@ -42,15 +31,3 @@
- def build_class(escape_attrs, *values)
- if values.size == 1
- value = values.first
- case
- when value.is_a?(String)
- # noop
- when value.is_a?(Array)
- value = value.flatten.select { |v| v }.map(&:to_s).uniq.join(' ')
- when value
- value = value.to_s
- else
- return ''
- end
- return escape_html(escape_attrs, value)
- end
+ def build_id(escape_attrs, *values)
+ escape_html(escape_attrs, values.flatten.select { |v| v }.join('_'))
+ end
@@ -58,10 +35,12 @@
- classes = []
- values.each do |value|
- case
- when value.is_a?(String)
- classes += value.split(' ')
- when value.is_a?(Array)
- classes += value.select { |v| v }
- when value
- classes << value.to_s
- end
+ def build_class(escape_attrs, *values)
+ if values.size == 1
+ value = values.first
+ case
+ when value.is_a?(String)
+ # noop
+ when value.is_a?(Array)
+ value = value.flatten.select { |v| v }.map(&:to_s).uniq.join(' ')
+ when value
+ value = value.to_s
+ else
+ return ''
@@ -69 +48 @@
- escape_html(escape_attrs, classes.map(&:to_s).uniq.join(' '))
+ return escape_html(escape_attrs, value)
@@ -72,2 +51,10 @@
- def build_data(escape_attrs, quote, *hashes)
- build_data_attribute(:data, escape_attrs, quote, *hashes)
+ classes = []
+ values.each do |value|
+ case
+ when value.is_a?(String)
+ classes += value.split(' ')
+ when value.is_a?(Array)
+ classes += value.select { |v| v }
+ when value
+ classes << value.to_s
+ end
@@ -74,0 +62,2 @@
+ escape_html(escape_attrs, classes.map(&:to_s).uniq.join(' '))
+ end
@@ -76,3 +65,3 @@
- def build_aria(escape_attrs, quote, *hashes)
- build_data_attribute(:aria, escape_attrs, quote, *hashes)
- end
+ def build_data(escape_attrs, quote, *hashes)
+ build_data_attribute(:data, escape_attrs, quote, *hashes)
+ end
@@ -80 +69,3 @@
- private
+ def build_aria(escape_attrs, quote, *hashes)
+ build_data_attribute(:aria, escape_attrs, quote, *hashes)
+ end
@@ -82,8 +73 @@
- def build_data_attribute(key, escape_attrs, quote, *hashes)
- attrs = []
- if hashes.size > 1 && hashes.all? { |h| h.is_a?(Hash) }
- data_value = merge_all_attrs(hashes)
- else
- data_value = hashes.last
- end
- hash = flatten_attributes(key => data_value)
+ private
@@ -91,11 +75,6 @@
- hash.sort_by(&:first).each do |key, value|
- case value
- when true
- attrs << " #{key}"
- when nil, false
- # noop
- else
- attrs << " #{key}=#{quote}#{escape_html(escape_attrs, value.to_s)}#{quote}"
- end
- end
- attrs.join
+ def build_data_attribute(key, escape_attrs, quote, *hashes)
+ attrs = []
+ if hashes.size > 1 && hashes.all? { |h| h.is_a?(Hash) }
+ data_value = merge_all_attrs(hashes)
+ else
+ data_value = hashes.last
@@ -102,0 +82 @@
+ hash = flatten_attributes(key => data_value)
@@ -104,17 +84,8 @@
- def flatten_attributes(attributes)
- flattened = {}
-
- attributes.each do |key, value|
- case value
- when attributes
- when Hash
- flatten_attributes(value).each do |k, v|
- if k.nil?
- flattened[key] = v
- else
- flattened["#{key}-#{k.to_s.gsub(/_/, '-')}"] = v
- end
- end
- else
- flattened[key] = value if value
- end
+ hash.sort_by(&:first).each do |key, value|
+ case value
+ when true
+ attrs << " #{key}"
+ when nil, false
+ # noop
+ else
+ attrs << " #{key}=#{quote}#{escape_html(escape_attrs, value.to_s)}#{quote}"
@@ -122 +92,0 @@
- flattened
@@ -123,0 +94,2 @@
+ attrs.join
+ end
@@ -125,9 +97,10 @@
- def merge_all_attrs(hashes)
- merged = {}
- hashes.each do |hash|
- hash.each do |key, value|
- key = key.to_s
- case key
- when 'id'.freeze, 'class'.freeze, 'data'.freeze
- merged[key] ||= []
- merged[key] << value
+ def flatten_attributes(attributes)
+ flattened = {}
+
+ attributes.each do |key, value|
+ case value
+ when attributes
+ when Hash
+ flatten_attributes(value).each do |k, v|
+ if k.nil?
+ flattened[key] = v
@@ -135 +108 @@
- merged[key] = value
+ flattened["#{key}-#{k.to_s.gsub(/_/, '-')}"] = v
@@ -137,0 +111,2 @@
+ else
+ flattened[key] = value if value
@@ -139 +113,0 @@
- merged
@@ -140,0 +115,2 @@
+ flattened
+ end
@@ -142,6 +118,12 @@
- def build_boolean!(escape_attrs, quote, format, buf, key, value)
- case value
- when true
- case format
- when :xhtml
- buf << " #{key}=#{quote}#{key}#{quote}"
+ def merge_all_attrs(hashes)
+ merged = {}
+ hashes.each do |hash|
+ unless hash.is_a?(Hash)
+ raise ArgumentError, "Non-hash object is given to attributes!"
+ end
+ hash.each do |key, value|
+ key = key.to_s
+ case key
+ when 'id', 'class', 'data', 'aria'
+ merged[key] ||= []
+ merged[key] << value
@@ -149 +131 @@
- buf << " #{key}"
+ merged[key] = value
@@ -151,4 +132,0 @@
- when false, nil
- # omitted
- else
- buf << " #{key}=#{quote}#{escape_html(escape_attrs, value)}#{quote}"
@@ -156,0 +135,2 @@
+ merged
+ end
@@ -158,3 +138,6 @@
- def escape_html(escape_attrs, str)
- if escape_attrs
- Haml::Util.escape_html(str)
+ def build_boolean!(escape_attrs, quote, format, buf, key, value)
+ case value
+ when true
+ case format
+ when :xhtml
+ buf << " #{key}=#{quote}#{key}#{quote}"
@@ -162 +145 @@
- str
+ buf << " #{key}"
@@ -163,0 +147,12 @@
+ when false, nil
+ # omitted
+ else
+ buf << " #{key}=#{quote}#{escape_html(escape_attrs, value)}#{quote}"
+ end
+ end
+
+ def escape_html(escape_attrs, str)
+ if escape_attrs
+ Haml::Util.escape_html(str)
+ else
+ str
@@ -166,7 +160,0 @@
- else
- # Haml::AttributeBuilder.build
- # Haml::AttributeBuilder.build_id
- # Haml::AttributeBuilder.build_class
- # Haml::AttributeBuilder.build_data
- # Haml::AttributeBuilder.build_aria
- require 'haml/haml'
lib/haml/attribute_compiler.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/attribute_compiler.rb 2023-10-04 09:27:37.441758921 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/attribute_compiler.rb 2023-10-04 09:27:37.453759017 +0000
@@ -6,0 +7,8 @@
+ # The list of boolean attributes. You may add custom attributes to this constant.
+ BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
+ autoplay controls loop selected hidden scoped async
+ defer reversed ismap seamless muted required
+ autofocus novalidate formnovalidate open pubdate
+ itemscope allowfullscreen default inert sortable
+ truespeed typemustmatch download]
+
@@ -34,4 +42 @@
- args = [
- @escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect,
- '::Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES', node.value[:object_ref],
- ] + attrs
+ args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect, node.value[:object_ref]] + attrs
@@ -55 +60 @@
- when *AttributeBuilder::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
+ when *BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
lib/haml/compiler/doctype_compiler.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/compiler/doctype_compiler.rb 2023-10-04 09:27:37.441758921 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/compiler/doctype_compiler.rb 2023-10-04 09:27:37.453759017 +0000
@@ -11,2 +10,0 @@
- when 'xml'
- xml_doctype
@@ -14,0 +13,4 @@
+ when 'xml'
+ xml_doctype
+ when 'rdfa'
+ rdfa_doctype
@@ -42,0 +45,4 @@
+ end
+
+ def rdfa_doctype
+ [:static, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">']
lib/haml/rails_template.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/rails_template.rb 2023-10-04 09:27:37.445758953 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/rails_template.rb 2023-10-04 09:27:37.461759082 +0000
@@ -50,0 +51,5 @@
+ # Rails Turbo looks for this
+ def default_format
+ :html
+ end
+
lib/haml/util.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/util.rb 2023-10-04 09:27:37.449758985 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/util.rb 2023-10-04 09:27:37.461759082 +0000
@@ -17,2 +17,5 @@
- # For JRuby, TruffleRuby, and Wasm, fallback to Ruby implementation.
- if /java|wasm/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
+ begin # Ruby 3.2+ or ERB 4+
+ require 'erb/escape'
+
+ define_singleton_method(:escape_html, ERB::Escape.instance_method(:html_escape))
+ rescue LoadError
@@ -24,2 +26,0 @@
- else
- require 'haml/haml' # Haml::Util.escape_html
lib/haml/version.rb
--- /tmp/d20231004-1962-775rez/haml-6.1.2/lib/haml/version.rb 2023-10-04 09:27:37.449758985 +0000
+++ /tmp/d20231004-1962-775rez/haml-6.2.3/lib/haml/version.rb 2023-10-04 09:27:37.461759082 +0000
@@ -3 +3 @@
- VERSION = '6.1.2'
+ VERSION = '6.2.3' |
gem compare temple 0.10.2 0.10.3 Compared versions: ["0.10.2", "0.10.3"]
DIFFERENT date:
0.10.2: 2023-05-27 00:00:00 UTC
0.10.3: 2023-10-03 00:00:00 UTC
DIFFERENT rubygems_version:
0.10.2: 3.2.5
0.10.3: 3.4.10
DIFFERENT version:
0.10.2: 0.10.2
0.10.3: 0.10.3
DIFFERENT files:
0.10.2->0.10.3:
* Deleted:
spec/engine_spec.rb
spec/erb_spec.rb
spec/filter_spec.rb
spec/filters/code_merger_spec.rb
spec/filters/control_flow_spec.rb
spec/filters/dynamic_inliner_spec.rb
spec/filters/eraser_spec.rb
spec/filters/escapable_spec.rb
spec/filters/multi_flattener_spec.rb
spec/filters/static_analyzer_spec.rb
spec/filters/static_merger_spec.rb
spec/filters/string_splitter_spec.rb
spec/generator_spec.rb
spec/grammar_spec.rb
spec/html/attribute_merger_spec.rb
spec/html/attribute_remover_spec.rb
spec/html/attribute_sorter_spec.rb
spec/html/fast_spec.rb
spec/html/pretty_spec.rb
spec/map_spec.rb
spec/mixins/dispatcher_spec.rb
spec/mixins/grammar_dsl_spec.rb
spec/spec_helper.rb
spec/static_analyzer_spec.rb
spec/utils_spec.rb
* Added:
lib/temple/filters/dynamic_merger.rb +69/-0
* Changed:
CHANGES +5/-0
Rakefile +0/-13
lib/temple.rb +1/-0
lib/temple/version.rb +1/-1
temple.gemspec +1/-2 |
gem compare --diff temple 0.10.2 0.10.3 Compared versions: ["0.10.2", "0.10.3"]
DIFFERENT files:
0.10.2->0.10.3:
* Deleted:
spec/engine_spec.rb
spec/erb_spec.rb
spec/filter_spec.rb
spec/filters/code_merger_spec.rb
spec/filters/control_flow_spec.rb
spec/filters/dynamic_inliner_spec.rb
spec/filters/eraser_spec.rb
spec/filters/escapable_spec.rb
spec/filters/multi_flattener_spec.rb
spec/filters/static_analyzer_spec.rb
spec/filters/static_merger_spec.rb
spec/filters/string_splitter_spec.rb
spec/generator_spec.rb
spec/grammar_spec.rb
spec/html/attribute_merger_spec.rb
spec/html/attribute_remover_spec.rb
spec/html/attribute_sorter_spec.rb
spec/html/fast_spec.rb
spec/html/pretty_spec.rb
spec/map_spec.rb
spec/mixins/dispatcher_spec.rb
spec/mixins/grammar_dsl_spec.rb
spec/spec_helper.rb
spec/static_analyzer_spec.rb
spec/utils_spec.rb
* Added:
lib/temple/filters/dynamic_merger.rb
--- /tmp/20231004-2127-tln9oy 2023-10-04 09:27:46.217822976 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/lib/temple/filters/dynamic_merger.rb 2023-10-04 09:27:46.209822918 +0000
@@ -0,0 +1,69 @@
+# frozen_string_literal: true
+module Temple
+ module Filters
+ # Compile [:multi, [:static, 'foo'], [:dynamic, 'bar']] to [:dynamic, '"foo#{bar}"']
+ class DynamicMerger < Filter
+ def on_multi(*exps)
+ exps = exps.dup
+ result = [:multi]
+ buffer = []
+
+ until exps.empty?
+ type, arg = exps.first
+ if type == :dynamic && arg.count("\n") == 0
+ buffer << exps.shift
+ elsif type == :static && exps.size > (count = arg.count("\n")) &&
+ exps[1, count].all? { |e| e == [:newline] }
+ (1 + count).times { buffer << exps.shift }
+ elsif type == :newline && exps.size > (count = count_newline(exps)) &&
+ exps[count].first == :static && count == exps[count].last.count("\n")
+ (count + 1).times { buffer << exps.shift }
+ else
+ result.concat(merge_dynamic(buffer))
+ buffer = []
+ result << compile(exps.shift)
+ end
+ end
+ result.concat(merge_dynamic(buffer))
+
+ result.size == 2 ? result[1] : result
+ end
+
+ private
+
+ def merge_dynamic(exps)
+ # Merge exps only when they have both :static and :dynamic
+ unless exps.any? { |type,| type == :static } && exps.any? { |type,| type == :dynamic }
+ return exps
+ end
+
+ strlit_body = String.new
+ exps.each do |type, arg|
+ case type
+ when :static
+ strlit_body << arg.dump.sub!(/\A"/, '').sub!(/"\z/, '').gsub('\n', "\n")
+ when :dynamic
+ strlit_body << "\#{#{arg}}"
+ when :newline
+ # newline is added by `gsub('\n', "\n")`
+ else
+ raise "unexpected type #{type.inspect} is given to #merge_dynamic"
+ end
+ end
+ [[:dynamic, "%Q\0#{strlit_body}\0"]]
+ end
+
+ def count_newline(exps)
+ count = 0
+ exps.each do |exp|
+ if exp == [:newline]
+ count += 1
+ else
+ return count
+ end
+ end
+ return count
+ end
+ end
+ end
+end
* Changed:
CHANGES
--- /tmp/d20231004-2127-w63e63/temple-0.10.2/CHANGES 2023-10-04 09:27:46.193822804 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/CHANGES 2023-10-04 09:27:46.209822918 +0000
@@ -0,0 +1,5 @@
+0.10.3
+
+ * Remove test files from the gem package (#146)
+ * Add DynamicMerger filter (#147)
+
Rakefile
--- /tmp/d20231004-2127-w63e63/temple-0.10.2/Rakefile 2023-10-04 09:27:46.193822804 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/Rakefile 2023-10-04 09:27:46.209822918 +0000
@@ -6,13 +5,0 @@
-
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |t|
- t.libs << 'lib' << 'test'
- t.pattern = 'test/**/test_*.rb'
- t.verbose = false
- end
-rescue LoadError
- task :rcov do
- abort "RCov is not available. In order to run rcov, you must: gem install rcov"
- end
-end
lib/temple.rb
--- /tmp/d20231004-2127-w63e63/temple-0.10.2/lib/temple.rb 2023-10-04 09:27:46.193822804 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/lib/temple.rb 2023-10-04 09:27:46.209822918 +0000
@@ -52,0 +53 @@
+ autoload :DynamicMerger, 'temple/filters/dynamic_merger'
lib/temple/version.rb
--- /tmp/d20231004-2127-w63e63/temple-0.10.2/lib/temple/version.rb 2023-10-04 09:27:46.201822861 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/lib/temple/version.rb 2023-10-04 09:27:46.217822976 +0000
@@ -3 +3 @@
- VERSION = '0.10.2'
+ VERSION = '0.10.3'
temple.gemspec
--- /tmp/d20231004-2127-w63e63/temple-0.10.2/temple.gemspec 2023-10-04 09:27:46.205822890 +0000
+++ /tmp/d20231004-2127-w63e63/temple-0.10.3/temple.gemspec 2023-10-04 09:27:46.217822976 +0000
@@ -15,2 +15 @@
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec)/}) } |
gem compare tilt 2.2.0 2.3.0 Compared versions: ["2.2.0", "2.3.0"]
DIFFERENT date:
2.2.0: 2023-06-05 00:00:00 UTC
2.3.0: 2023-09-14 00:00:00 UTC
DIFFERENT version:
2.2.0: 2.2.0
2.3.0: 2.3.0
DIFFERENT files:
2.2.0->2.3.0:
* Changed:
lib/tilt.rb +3/-14
lib/tilt/coffee.rb +0/-12
lib/tilt/erb.rb +1/-15
lib/tilt/erubis.rb +1/-4
lib/tilt/prawn.rb +3/-10
lib/tilt/redcarpet.rb +19/-32
lib/tilt/string.rb +5/-0
lib/tilt/template.rb +5/-5 |
gem compare --diff tilt 2.2.0 2.3.0 Compared versions: ["2.2.0", "2.3.0"]
DIFFERENT files:
2.2.0->2.3.0:
* Changed:
lib/tilt.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt.rb 2023-10-04 09:27:54.837892202 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt.rb 2023-10-04 09:27:54.841892234 +0000
@@ -8 +8 @@
- VERSION = '2.2.0'
+ VERSION = '2.3.0'
@@ -20,0 +21,2 @@
+ return self if @default_mapping.is_a?(FinalizedMapping)
+
@@ -81,13 +82,0 @@
- end
-
- # @return the template object that is currently rendering.
- #
- # @example
- # tmpl = Tilt['index.erb'].new { '<%= Tilt.current_template %>' }
- # tmpl.render == tmpl.to_s
- #
- # @note This is currently an experimental feature and might return nil
- # in the future.
- def self.current_template
- warn "Tilt.current_template is deprecated and will be removed in Tilt 2.3", uplevel: 1
- Thread.current[:tilt_current_template]
lib/tilt/coffee.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/coffee.rb 2023-10-04 09:27:54.837892202 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/coffee.rb 2023-10-04 09:27:54.845892267 +0000
@@ -18,12 +17,0 @@
- # :nocov:
- def self.default_no_wrap
- warn "#{self.class}.default_no_wrap is deprecated and will be removed in Tilt 2.3. Switch to #{self.class}.default_bare."
- default_bare
- end
-
- def self.default_no_wrap=(value)
- warn "#{self.class}.default_no_wrap= is deprecated and will be removed in Tilt 2.3. Switch to #{self.class}.default_bare=."
- self.default_bare = value
- end
- # :nocov:
-
lib/tilt/erb.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/erb.rb 2023-10-04 09:27:54.837892202 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/erb.rb 2023-10-04 09:27:54.845892267 +0000
@@ -11,14 +10,0 @@
- # Remove in Tilt 2.3
- @default_output_variable = nil
- def self._default_output_variable
- @default_output_variable
- end
- def self.default_output_variable
- warn "#{self}.default_output_variable is deprecated and will be removed in Tilt 2.3.", uplevel: 1
- @default_output_variable
- end
- def self.default_output_variable=(name)
- warn "#{self}.default_output_variable= is deprecated and will be removed in Tilt 2.3. Switch to using the :outvar option.", uplevel: 1
- @default_output_variable = name
- end
-
@@ -27 +13 @@
- @outvar = @options[:outvar] || self.class._default_output_variable || '_erbout'
+ @outvar = @options[:outvar] || '_erbout'
lib/tilt/erubis.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/erubis.rb 2023-10-04 09:27:54.837892202 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/erubis.rb 2023-10-04 09:27:54.845892267 +0000
@@ -19,3 +18,0 @@
- # Remove in Tilt 2.3
- @default_output_variable = nil
-
@@ -24 +21 @@
- @outvar = @options.delete(:outvar) || self.class._default_output_variable || '_erbout'
+ @outvar = @options.delete(:outvar) || '_erbout'
lib/tilt/prawn.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/prawn.rb 2023-10-04 09:27:54.841892234 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/prawn.rb 2023-10-04 09:27:54.849892299 +0000
@@ -18,10 +18,3 @@
- if @data.respond_to?(:to_str)
- locals = locals.dup
- locals[:pdf] = pdf
- super
- else
- warn "Non-string provided as prawn template data. This is no longer supported and support for it will be removed in Tilt 2.3", :uplevel=>2
- # :nocov:
- @data.call(pdf) if @data.kind_of?(Proc)
- # :nocov:
- end
+ locals = locals.dup
+ locals[:pdf] = pdf
+ super
lib/tilt/redcarpet.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/redcarpet.rb 2023-10-04 09:27:54.841892234 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/redcarpet.rb 2023-10-04 09:27:54.849892299 +0000
@@ -7,17 +7,4 @@
-# :nocov:
-unless defined? ::Redcarpet::Render and defined? ::Redcarpet::Markdown
- # Redcarpet 1.x
- warn "Tilt support for RedCarpet 1.x is deprecated and will be removed in Tilt 2.3", uplevel: 1
- _flags = [:smart, :filter_html, :smartypants, :escape_html]
-
- Tilt::RedcarpetTemplate = Tilt::StaticTemplate.subclass do
- flags = _flags.select { |flag| @options[flag] }.map! { |flag| aliases[flag] || flag }
- RedcarpetCompat.new(@data, *flags).to_html
- end
-# :nocov:
-else
- Tilt::RedcarpetTemplate = Tilt::StaticTemplate.subclass do
- aliases.each do |opt, aka|
- if options.key?(aka) || !@options.key?(opt)
- @options[opt] = @options.delete(aka)
- end
+Tilt::RedcarpetTemplate = Tilt::StaticTemplate.subclass do
+ aliases.each do |opt, aka|
+ if options.key?(aka) || !@options.key?(opt)
+ @options[opt] = @options.delete(aka)
@@ -24,0 +12 @@
+ end
@@ -26,2 +14,2 @@
- # only raise an exception if someone is trying to enable :escape_html
- @options.delete(:escape_html) unless @options[:escape_html]
+ # only raise an exception if someone is trying to enable :escape_html
+ @options.delete(:escape_html) unless @options[:escape_html]
@@ -29,11 +17,10 @@
- renderer = @options.delete(:renderer) || ::Redcarpet::Render::HTML.new(@options)
- if options.delete(:smartypants) && !(renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants)
- renderer = if renderer == ::Redcarpet::Render::XHTML
- ::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
- elsif renderer == ::Redcarpet::Render::HTML
- ::Redcarpet::Render::SmartyHTML
- elsif renderer.is_a? Class
- Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
- else
- renderer.extend ::Redcarpet::Render::SmartyPants
- end
+ renderer = @options.delete(:renderer) || ::Redcarpet::Render::HTML.new(@options)
+ if options.delete(:smartypants) && !(renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants)
+ renderer = if renderer == ::Redcarpet::Render::XHTML
+ ::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
+ elsif renderer == ::Redcarpet::Render::HTML
+ ::Redcarpet::Render::SmartyHTML
+ elsif renderer.is_a? Class
+ Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
+ else
+ renderer.extend ::Redcarpet::Render::SmartyPants
@@ -41,2 +27,0 @@
-
- Redcarpet::Markdown.new(renderer, @options).render(@data)
@@ -43,0 +29,2 @@
+
+ Redcarpet::Markdown.new(renderer, @options).render(@data)
lib/tilt/string.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/string.rb 2023-10-04 09:27:54.841892234 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/string.rb 2023-10-04 09:27:54.849892299 +0000
@@ -9,0 +10 @@
+ @freeze_string_literals = !!@options[:freeze]
@@ -19,0 +21,4 @@
+ end
+
+ def freeze_string_literals?
+ @freeze_string_literals
lib/tilt/template.rb
--- /tmp/d20231004-2263-r4mfqo/tilt-2.2.0/lib/tilt/template.rb 2023-10-04 09:27:54.841892234 +0000
+++ /tmp/d20231004-2263-r4mfqo/tilt-2.3.0/lib/tilt/template.rb 2023-10-04 09:27:54.849892299 +0000
@@ -102,2 +101,0 @@
- current_template = Thread.current[:tilt_current_template]
- Thread.current[:tilt_current_template] = self
@@ -105,2 +102,0 @@
- ensure
- Thread.current[:tilt_current_template] = current_template
@@ -358 +354,5 @@
- method_source = "class #{scope_class.name}\n#{method_source}\nend"
+ if freeze_string_literals?
+ method_source_prefix = "# frozen-string-literal: true\n"
+ method_source = method_source.sub(/\A# frozen-string-literal: true\n/, '')
+ end
+ method_source = "#{method_source_prefix}class #{scope_class.name}\n#{method_source}\nend" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps haml from 6.1.2 to 6.2.3.
Release notes
Sourced from haml's releases.
Changelog
Sourced from haml's changelog.
Commits
88049a6
Version 6.2.3e2807df
Resurrect RDFa doctype supportd5d7d4c
Version 6.2.23a32031
Fix hyphenated aria attributescb9cc05
Allow modifying Haml::BOOLEAN_ATTRIBUTES781dfef
Try removing a truffleruby guard (#1150)79ea7bc
Version 6.2.15e1caf4
Fix a regression in aria attributes2e2b4a0
http => httpse4f4cfb
The Haml Markdown documentation seems not to render "```ruby" markupDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)