Merge branch 'stable'
Conflicts: test/haml/engine_test.rb
This commit is contained in:
commit
cd8a7c2168
|
@ -191,6 +191,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
|
||||||
#
|
#
|
||||||
# <sandwich bread='whole wheat' delicious='true' filling='peanut butter and jelly' />
|
# <sandwich bread='whole wheat' delicious='true' filling='peanut butter and jelly' />
|
||||||
#
|
#
|
||||||
|
# Note that the Haml attributes list has the same syntax as a Ruby method call.
|
||||||
|
# This means that any attribute methods must come before the hash literal.
|
||||||
|
#
|
||||||
# ===== Boolean Attributes
|
# ===== Boolean Attributes
|
||||||
#
|
#
|
||||||
# Some attributes, such as "checked" for <tt>input</tt> tags or "selected" for <tt>option</tt> tags,
|
# Some attributes, such as "checked" for <tt>input</tt> tags or "selected" for <tt>option</tt> tags,
|
||||||
|
|
|
@ -151,9 +151,8 @@ module Haml
|
||||||
tabulation = @real_tabs
|
tabulation = @real_tabs
|
||||||
|
|
||||||
attributes = class_id
|
attributes = class_id
|
||||||
attributes_hashes.each do |attributes_hash|
|
attributes_hashes.each do |old|
|
||||||
attributes_hash.keys.each { |key| attributes_hash[key.to_s] = attributes_hash.delete(key) }
|
self.class.merge_attrs(attributes, old.inject({}) {|h, (key, val)| h[key.to_s] = val; h})
|
||||||
self.class.merge_attrs(attributes, attributes_hash)
|
|
||||||
end
|
end
|
||||||
self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref
|
self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref
|
||||||
|
|
||||||
|
|
|
@ -212,10 +212,10 @@ END
|
||||||
|
|
||||||
module Sass
|
module Sass
|
||||||
include Base
|
include Base
|
||||||
lazy_require 'sass/engine'
|
lazy_require 'sass/plugin'
|
||||||
|
|
||||||
def render(text)
|
def render(text)
|
||||||
::Sass::Engine.new(text,::Sass::Plugin.engine_options).render
|
::Sass::Engine.new(text, ::Sass::Plugin.engine_options).render
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -239,6 +239,7 @@ END
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RedCloth = Textile
|
RedCloth = Textile
|
||||||
|
Filters.defined['redcloth'] = RedCloth
|
||||||
|
|
||||||
# Uses BlueCloth or RedCloth to provide only Markdown (not Textile) parsing
|
# Uses BlueCloth or RedCloth to provide only Markdown (not Textile) parsing
|
||||||
module Markdown
|
module Markdown
|
||||||
|
|
|
@ -158,6 +158,20 @@ class EngineTest < Test::Unit::TestCase
|
||||||
assert_equal("<p a='b' c='d' e='f'></p>\n", render("%p{:a => 'b',\n :c => 'd',\n :e => 'f'}"))
|
assert_equal("<p a='b' c='d' e='f'></p>\n", render("%p{:a => 'b',\n :c => 'd',\n :e => 'f'}"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_attr_hashes_not_modified
|
||||||
|
hash = {:color => 'red'}
|
||||||
|
assert_equal(<<HTML, render(<<HAML, :locals => {:hash => hash}))
|
||||||
|
<div color='red'></div>
|
||||||
|
<div class='special' color='red'></div>
|
||||||
|
<div color='red'></div>
|
||||||
|
HTML
|
||||||
|
%div{hash}
|
||||||
|
.special{hash}
|
||||||
|
%div{hash}
|
||||||
|
HAML
|
||||||
|
assert_equal(hash, {:color => 'red'})
|
||||||
|
end
|
||||||
|
|
||||||
def test_end_of_file_multiline
|
def test_end_of_file_multiline
|
||||||
assert_equal("<p>0</p>\n<p>1</p>\n<p>2</p>\n", render("- for i in (0...3)\n %p= |\n i |"))
|
assert_equal("<p>0</p>\n<p>1</p>\n<p>2</p>\n", render("- for i in (0...3)\n %p= |\n i |"))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue