Don't die on nil options for both Sass and Haml.
This commit is contained in:
parent
441fea8cbd
commit
207b9620d3
|
@ -7,6 +7,9 @@
|
|||
|
||||
* Fix compilation of HTML5 doctypes when using `html2haml`.
|
||||
|
||||
* `nil` values for Sass options are now ignored,
|
||||
rather than raising errors.
|
||||
|
||||
## [2.2.16](http://github.com/nex3/haml/commit/2.2.16)
|
||||
|
||||
* Abstract out references to `ActionView::TemplateError`,
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
* Report the filename in warnings about selectors without properties.
|
||||
|
||||
* `nil` values for Sass options are now ignored,
|
||||
rather than raising errors.
|
||||
|
||||
### Must Read!
|
||||
|
||||
* When `@import` is given a filename without an extension,
|
||||
|
|
|
@ -88,7 +88,7 @@ module Haml
|
|||
unless ruby1_8?
|
||||
@options[:encoding] = Encoding.default_internal || "utf-8"
|
||||
end
|
||||
@options.merge! options
|
||||
@options.merge! options.reject {|k, v| v.nil?}
|
||||
@index = 0
|
||||
|
||||
unless [:xhtml, :html4, :html5].include?(@options[:format])
|
||||
|
|
|
@ -129,7 +129,7 @@ module Sass
|
|||
# @param options [{Symbol => Object}] An options hash;
|
||||
# see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
|
||||
def initialize(template, options={})
|
||||
@options = DEFAULT_OPTIONS.merge(options)
|
||||
@options = DEFAULT_OPTIONS.merge(options.reject {|k, v| v.nil?})
|
||||
@template = template
|
||||
|
||||
# Backwards compatibility
|
||||
|
|
|
@ -278,6 +278,10 @@ RESULT
|
|||
SOURCE
|
||||
end
|
||||
|
||||
def test_nil_option
|
||||
assert_equal("<p foo='bar'></p>\n", render('%p{:foo => "bar"}', :attr_wrapper => nil))
|
||||
end
|
||||
|
||||
# Regression tests
|
||||
|
||||
def test_whitespace_nuke_with_both_newlines
|
||||
|
|
|
@ -781,6 +781,16 @@ p
|
|||
SASS
|
||||
end
|
||||
|
||||
def test_nil_option
|
||||
assert_equal(<<CSS, render(<<SASS, :format => nil))
|
||||
foo {
|
||||
a: b; }
|
||||
CSS
|
||||
foo
|
||||
a: b
|
||||
SASS
|
||||
end
|
||||
|
||||
# Regression tests
|
||||
|
||||
def test_parens_in_mixins
|
||||
|
|
Loading…
Reference in New Issue