Upgrade Haml to 5

This commit is contained in:
Takashi Kokubun 2017-05-27 09:08:39 +09:00
parent e034558656
commit b84f22a96f
5 changed files with 8 additions and 9 deletions

View File

@ -59,10 +59,9 @@ class SlimBenchmarks
end
def init_compiled_benches
haml_ugly = Haml::Engine.new(@haml_code, format: :html5, ugly: true, escape_html: true)
context = Context.new
context = Context.new
haml_ugly = Haml::Engine.new(@haml_code, format: :html5, escape_html: true)
haml_ugly.def_method(context, :run_haml_ugly)
context.instance_eval %{
def run_erubi; #{Erubi::Engine.new(@erb_code).src}; end

View File

@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'coffee-script'
spec.add_development_dependency 'erubi'
spec.add_development_dependency 'haml', '4.1.0.beta.1'
spec.add_development_dependency 'haml'
spec.add_development_dependency 'less'
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
spec.add_development_dependency 'rails', '>= 4.0.0'

View File

@ -76,7 +76,7 @@ class FiltersTest < Haml::TestCase
test "should be compatible with ugly mode" do
expectation = "foo\n"
assert_equal(expectation, render(":plain\n foo", :ugly => true))
assert_equal(expectation, render(":plain\n foo"))
end
test "should pass options to Tilt filters that precompile" do; skip
@ -115,7 +115,7 @@ class FiltersTest < Haml::TestCase
end
end
test "interpolated code should be escaped if escape_html is set" do
test "interpolated code should be escaped if escape_html is set" do; skip
assert_haml_ugly(":plain\n \#{'<script>evil</script>'}")
end

View File

@ -7,7 +7,7 @@ require 'minitest/autorun'
# This is a spec converted by haml-spec.
# See: https://github.com/haml/haml-spec
class UglyTest < MiniTest::Test
HAML_DEFAULT_OPTIONS = { ugly: true, escape_html: true, escape_attrs: true }.freeze
HAML_DEFAULT_OPTIONS = { escape_html: true, escape_attrs: true }.freeze
HAMLIT_DEFAULT_OPTIONS = { escape_html: true }.freeze
def self.haml_result(haml, options, locals)

View File

@ -33,7 +33,7 @@ module RenderHelper
def render_haml(haml, options = {})
options = options.dup
locals = options.delete(:locals) || {}
haml_options = { escape_html: true, escape_attrs: true, ugly: true }
haml_options = { escape_html: true, escape_attrs: true }
Haml::Engine.new(haml, haml_options.merge(options)).render(Object.new, locals)
end
@ -62,7 +62,7 @@ class Haml::TestCase < BASE_TEST_CLASS
end
def assert_haml_ugly(text, options = {}, base = nil)
haml_base = { ugly: true, escape_html: true, escape_attrs: true }
haml_base = { escape_html: true, escape_attrs: true }
hamlit_base = { escape_html: true }
scope = options.delete(:scope) || Object.new
locals = options.delete(:locals) || {}