mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Support xhtml format for boolean attributes
This commit is contained in:
parent
e482f59b3d
commit
13bc49f618
3 changed files with 6 additions and 7 deletions
|
@ -109,7 +109,7 @@ module Hamlit
|
||||||
code = [
|
code = [
|
||||||
%Q|case #{value}|,
|
%Q|case #{value}|,
|
||||||
%Q|when true|,
|
%Q|when true|,
|
||||||
%Q|_buf << ' #{key}'.freeze|,
|
%Q|_buf << #{ (@format == :xhtml ? " #{key}=#{@quote}#{key}#{@quote}" : " #{key}").inspect }.freeze|,
|
||||||
%Q|when false, nil|,
|
%Q|when false, nil|,
|
||||||
%Q|else|,
|
%Q|else|,
|
||||||
%Q|_buf << " #{key}='".freeze|,
|
%Q|_buf << " #{key}='".freeze|,
|
||||||
|
|
|
@ -125,6 +125,9 @@ describe Hamlit::Engine do
|
||||||
%input(disabled='false'){ disabled: nil }
|
%input(disabled='false'){ disabled: nil }
|
||||||
%input(disabled=''){ disabled: nil }
|
%input(disabled=''){ disabled: nil }
|
||||||
HAML
|
HAML
|
||||||
|
|
||||||
|
assert_inline(%q|%input(checked=true)|)
|
||||||
|
assert_inline(%q|%input(checked=true)|, format: :xhtml)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify 'common attributes' do
|
specify 'common attributes' do
|
||||||
|
|
|
@ -36,12 +36,8 @@ module RenderAssertion
|
||||||
assert_equal html, render(haml, options)
|
assert_equal html, render(haml, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_inline(haml)
|
def assert_inline(haml, options = {})
|
||||||
options = {
|
options = { escape_html: true, escape_attrs: true, ugly: true }.merge(options)
|
||||||
escape_html: true,
|
|
||||||
escape_attrs: true,
|
|
||||||
ugly: true,
|
|
||||||
}
|
|
||||||
html = Haml::Engine.new(haml, options).to_html
|
html = Haml::Engine.new(haml, options).to_html
|
||||||
assert_equal html, render(haml, options)
|
assert_equal html, render(haml, options)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue