Merge branch 'stable'

Conflicts:
	test/haml/engine_test.rb
This commit is contained in:
Nathan Weizenbaum 2008-10-02 22:58:59 -07:00
commit cd8a7c2168
4 changed files with 22 additions and 5 deletions

View File

@ -191,6 +191,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
#
# <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
#
# Some attributes, such as "checked" for <tt>input</tt> tags or "selected" for <tt>option</tt> tags,

View File

@ -151,9 +151,8 @@ module Haml
tabulation = @real_tabs
attributes = class_id
attributes_hashes.each do |attributes_hash|
attributes_hash.keys.each { |key| attributes_hash[key.to_s] = attributes_hash.delete(key) }
self.class.merge_attrs(attributes, attributes_hash)
attributes_hashes.each do |old|
self.class.merge_attrs(attributes, old.inject({}) {|h, (key, val)| h[key.to_s] = val; h})
end
self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref

View File

@ -212,10 +212,10 @@ END
module Sass
include Base
lazy_require 'sass/engine'
lazy_require 'sass/plugin'
def render(text)
::Sass::Engine.new(text,::Sass::Plugin.engine_options).render
::Sass::Engine.new(text, ::Sass::Plugin.engine_options).render
end
end
@ -239,6 +239,7 @@ END
end
end
RedCloth = Textile
Filters.defined['redcloth'] = RedCloth
# Uses BlueCloth or RedCloth to provide only Markdown (not Textile) parsing
module Markdown

View File

@ -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'}"))
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
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