1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Change default attribute quote to single quote

This commit is contained in:
Takashi Kokubun 2015-03-27 13:29:18 +09:00
parent 9fb452934c
commit 6b5619e297
4 changed files with 20 additions and 19 deletions

View file

@ -14,8 +14,9 @@ require 'hamlit/text_compiler'
module Hamlit
class Engine < Temple::Engine
define_options(
generator: Temple::Generators::ArrayBuffer,
format: :html,
generator: Temple::Generators::ArrayBuffer,
format: :html,
attr_quote: "'",
)
use MultilinePreprocessor

View file

@ -4,7 +4,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%span{class: 'foo'} bar
HAML
<span class="foo">bar</span>
<span class='foo'>bar</span>
HTML
end
@ -12,23 +12,23 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%span{ data: 2 } bar
HAML
<span data="2">bar</span>
<span data='2'>bar</span>
HTML
end
it 'renders attributes' do
assert_render(<<-'HAML', <<-HTML)
%span{ :class => "foo" } bar
%span{ :class => 'foo' } bar
HAML
<span class="foo">bar</span>
<span class='foo'>bar</span>
HTML
end
it 'renders attributes' do
assert_render(<<-'HAML', <<-HTML)
%span{ :class => "foo", id: 'bar' } bar
%span{ :class => 'foo', id: 'bar' } bar
HAML
<span class="foo" id="bar">bar</span>
<span class='foo' id='bar'>bar</span>
HTML
end
@ -36,7 +36,7 @@ describe Hamlit::Engine do
assert_render(<<-'HAML', <<-HTML)
%span{ :'data-disable' => true } bar
HAML
<span data-disable="true">bar</span>
<span data-disable='true'>bar</span>
HTML
end
@ -44,15 +44,15 @@ describe Hamlit::Engine do
assert_render(<<-'HAML', <<-HTML)
%span{ data: { disable: true } } bar
HAML
<span data-disable="true">bar</span>
<span data-disable='true'>bar</span>
HTML
end
it 'accepts even illegal input for haml' do
assert_render(<<-'HAML', <<-HTML)
%span{ class: "}}}", id: '{}}' } }{
%span{ class: '}}}', id: '{}}' } }{
HAML
<span class="}}}" id="{}}">}{</span>
<span class='}}}' id='{}}'>}{</span>
HTML
end
end

View file

@ -4,7 +4,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%p(class='foo') bar
HAML
<p class="foo">bar</p>
<p class='foo'>bar</p>
HTML
end
end

View file

@ -75,7 +75,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%span.foo-1.bar_A hello
HAML
<span class="foo-1 bar_A">hello</span>
<span class='foo-1 bar_A'>hello</span>
HTML
end
@ -84,7 +84,7 @@ describe Hamlit::Engine do
%span#Bar_0#bar-
hello
HAML
<span id="Bar_0 bar-">
<span id='Bar_0 bar-'>
hello
</span>
HTML
@ -94,7 +94,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%span#a.b#c.d hello
HAML
<span id="a c" class="b d">hello</span>
<span id='a c' class='b d'>hello</span>
HTML
end
@ -102,7 +102,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
#hello.world
HAML
<div id="hello" class="world"></div>
<div id='hello' class='world'></div>
HTML
end
@ -111,7 +111,7 @@ describe Hamlit::Engine do
.world#hello
foo
HAML
<div class="world" id="hello">
<div class='world' id='hello'>
foo
</div>
HTML
@ -156,7 +156,7 @@ describe Hamlit::Engine do
assert_render(<<-HAML, <<-HTML)
%span{a: 2}a
HAML
<span a="2">a</span>
<span a='2'>a</span>
HTML
end