mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Revert "[Haml] Refactored some more code to reduce the number of warnings in the test suite"
This reverts commit fef4a39acd
.
This commit is contained in:
parent
521431a2b0
commit
9b8616e03f
3 changed files with 25 additions and 19 deletions
|
@ -13,6 +13,7 @@ begin
|
|||
extend Haml::Helpers
|
||||
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
|
||||
_erbout = _hamlout.buffer
|
||||
__in_erb_template = true
|
||||
END
|
||||
postamble = <<END.gsub("\n", ";")
|
||||
#{precompiled_method_return_value}
|
||||
|
|
|
@ -73,20 +73,19 @@ module Haml
|
|||
# @raise [Haml::Error] if there's a Haml syntax error in the template
|
||||
def initialize(template, options = {})
|
||||
@options = {
|
||||
:suppress_eval => false,
|
||||
:attr_wrapper => "'",
|
||||
:suppress_eval => false,
|
||||
:attr_wrapper => "'",
|
||||
# Don't forget to update the docs in doc-src/REFERENCE.md
|
||||
# if you update these
|
||||
:autoclose => %w[meta img link br hr input area param col base],
|
||||
:preserve => %w[textarea pre code],
|
||||
:filename => '(haml)',
|
||||
:line => 1,
|
||||
:ugly => false,
|
||||
:format => :xhtml,
|
||||
:escape_html => false,
|
||||
:escape_attrs => true,
|
||||
:hyphenate_data_attrs => true,
|
||||
:ignore_default_internal_encoding => false
|
||||
:autoclose => %w[meta img link br hr input area param col base],
|
||||
:preserve => %w[textarea pre code],
|
||||
:filename => '(haml)',
|
||||
:line => 1,
|
||||
:ugly => false,
|
||||
:format => :xhtml,
|
||||
:escape_html => false,
|
||||
:escape_attrs => true,
|
||||
:hyphenate_data_attrs => true,
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,10 +94,7 @@ module Haml
|
|||
end
|
||||
|
||||
unless ruby1_8?
|
||||
unless options[:ignore_default_internal_encoding]
|
||||
@options[:encoding] = Encoding.default_internal
|
||||
end
|
||||
@options[:encoding] ||= template.encoding
|
||||
@options[:encoding] = Encoding.default_internal || template.encoding
|
||||
@options[:encoding] = "utf-8" if @options[:encoding].name == "US-ASCII"
|
||||
end
|
||||
@options.merge! options.reject {|k, v| v.nil?}
|
||||
|
@ -130,8 +126,7 @@ module Haml
|
|||
|
||||
compile(parse)
|
||||
rescue Haml::Error => e
|
||||
index = instance_variable_defined?('@index') ? @index : false
|
||||
if index || e.line
|
||||
if @index || e.line
|
||||
e.backtrace.unshift "#{@options[:filename]}:#{(e.line ? e.line + 1 : @index) + @options[:line] - 1}"
|
||||
end
|
||||
raise
|
||||
|
|
|
@ -113,10 +113,20 @@ MESSAGE
|
|||
caller[i+=1] =~ /`(.+?)'/ until $1 and $1.index('test_') == 0
|
||||
options[:filename] = "(#{$1})"
|
||||
end
|
||||
options[:ignore_default_internal_encoding] = true
|
||||
Haml::Engine.new(text, options)
|
||||
end
|
||||
|
||||
def setup
|
||||
return if Haml::Util.ruby1_8?
|
||||
@old_default_internal = Encoding.default_internal
|
||||
Encoding.default_internal = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
return if Haml::Util.ruby1_8?
|
||||
Encoding.default_internal = @old_default_internal
|
||||
end
|
||||
|
||||
def test_empty_render
|
||||
assert_equal "", render("")
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue