mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Optimize slow inline escape
This commit is contained in:
parent
4f726ea6ff
commit
c967f3c531
1 changed files with 10 additions and 5 deletions
|
@ -373,7 +373,8 @@ module Hamlit
|
||||||
when '='
|
when '='
|
||||||
parse = true
|
parse = true
|
||||||
if value[0] == ?=
|
if value[0] == ?=
|
||||||
value = slow_unescape_interpolation(value[1..-1].strip, escape_html)
|
value = ::Hamlit::HamlUtil.unescape_interpolation(value[1..-1].strip)
|
||||||
|
escape_interpolation = true if escape_html
|
||||||
escape_html = false
|
escape_html = false
|
||||||
end
|
end
|
||||||
when '&', '!'
|
when '&', '!'
|
||||||
|
@ -381,19 +382,22 @@ module Hamlit
|
||||||
parse = true
|
parse = true
|
||||||
preserve_script = (value[0] == ?~)
|
preserve_script = (value[0] == ?~)
|
||||||
if value[1] == ?=
|
if value[1] == ?=
|
||||||
value = slow_unescape_interpolation(value[2..-1].strip, escape_html)
|
value = ::Hamlit::HamlUtil.unescape_interpolation(value[2..-1].strip)
|
||||||
|
escape_interpolation = true if escape_html
|
||||||
escape_html = false
|
escape_html = false
|
||||||
else
|
else
|
||||||
value = value[1..-1].strip
|
value = value[1..-1].strip
|
||||||
end
|
end
|
||||||
elsif contains_interpolation?(value)
|
elsif contains_interpolation?(value)
|
||||||
value = slow_unescape_interpolation(value, escape_html)
|
value = ::Hamlit::HamlUtil.unescape_interpolation(value)
|
||||||
|
escape_interpolation = true if escape_html
|
||||||
parse = true
|
parse = true
|
||||||
escape_html = false
|
escape_html = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if contains_interpolation?(value)
|
if contains_interpolation?(value)
|
||||||
value = slow_unescape_interpolation(value, escape_html)
|
value = ::Hamlit::HamlUtil.unescape_interpolation(value)
|
||||||
|
escape_interpolation = true if escape_html
|
||||||
parse = true
|
parse = true
|
||||||
escape_html = false
|
escape_html = false
|
||||||
end
|
end
|
||||||
|
@ -434,7 +438,8 @@ module Hamlit
|
||||||
:nuke_inner_whitespace => nuke_inner_whitespace,
|
:nuke_inner_whitespace => nuke_inner_whitespace,
|
||||||
:nuke_outer_whitespace => nuke_outer_whitespace, :object_ref => object_ref,
|
:nuke_outer_whitespace => nuke_outer_whitespace, :object_ref => object_ref,
|
||||||
:escape_html => escape_html, :preserve_tag => preserve_tag,
|
:escape_html => escape_html, :preserve_tag => preserve_tag,
|
||||||
:preserve_script => preserve_script, :parse => parse, :value => line.text)
|
:preserve_script => preserve_script, :parse => parse, :value => line.text,
|
||||||
|
:escape_interpolation => escape_interpolation)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders a line that creates an XHTML tag and has an implicit div because of
|
# Renders a line that creates an XHTML tag and has an implicit div because of
|
||||||
|
|
Loading…
Reference in a new issue