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:
parent
1265fdb98a
commit
07492e7152
2 changed files with 16 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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: '&= ''<"&>'''
|
||||
|
|
Loading…
Add table
Reference in a new issue