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

Allow interpolation in plain

This commit is contained in:
Takashi Kokubun 2015-10-12 08:38:15 +09:00
parent 1265fdb98a
commit 07492e7152
2 changed files with 16 additions and 9 deletions

View file

@ -1,8 +1,15 @@
require 'haml/util'
module Hamlit
class FilterCompiler
class Plain
def compile(node)
[:static, node.value[:text].rstrip + "\n"]
text = node.value[:text].rstrip + "\n"
if Haml::Util.contains_interpolation?(text)
[:dynamic, Haml::Util.unescape_interpolation(text + "\n")]
else
[:static, text]
end
end
end
end

View file

@ -455,14 +455,14 @@ Ruby-style interpolation:
optional: true
locals:
var: value
# interpolation inside filtered content:
# haml: |-
# :plain
# #{var} interpolated: #{var}
# html: 'value interpolated: value'
# optional: true
# locals:
# var: value
interpolation inside filtered content:
haml: |-
:plain
#{var} interpolated: #{var}
html: 'value interpolated: value'
optional: true
locals:
var: value
# HTML escaping:
# code following '&=':
# haml: '&= ''<"&>'''