[Haml] Make <code> tags automatically preserved.

This commit is contained in:
Nathan Weizenbaum 2009-10-05 19:25:13 -07:00
parent 565655766a
commit bbca715be5
3 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,9 @@
* Fixed an `html2haml` issue where `#{}` wasn't escaped
before being transformed into Haml.
* Add `<code>` to the list of tags that's
{file:HAML_REFERENCE.md#preserve-option automatically whitespace-preserved}.
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
* Made the error message when unable to load a dependency for html2haml

View File

@ -72,9 +72,10 @@ module Haml
:suppress_eval => false,
:attr_wrapper => "'",
# Don't forget to update the docs in lib/haml.rb if you update these
# Don't forget to update the docs in doc-src/HAML_REFERENCE.md
# if you update these
:autoclose => %w[meta img link br hr input area param col base],
:preserve => %w[textarea pre],
:preserve => %w[textarea pre code],
:filename => '(haml)',
:line => 1,

View File

@ -227,6 +227,19 @@ HAML
SOURCE
end
def test_pre_code
assert_equal(<<HTML, render(<<HAML))
<pre><code>Foo&#x000A; bar&#x000A; baz</code></pre>
HTML
%pre
%code
:preserve
Foo
bar
baz
HAML
end
def test_boolean_attributes
assert_equal("<p bar baz='true' foo='bar'></p>\n",
render("%p{:foo => 'bar', :bar => true, :baz => 'true'}", :format => :html4))