mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Follow haml's weird behavior
This commit is contained in:
parent
cfd98d33e1
commit
412063ba70
1 changed files with 9 additions and 4 deletions
|
@ -3,12 +3,17 @@ module Hamlit
|
|||
class Plain
|
||||
def compile(lines)
|
||||
ast = [:multi]
|
||||
lines.each_with_index do |line, index|
|
||||
ast << [:static, "\n"] if index > 0
|
||||
ast << [:haml, :text, line]
|
||||
end
|
||||
text = lines.join("\n")
|
||||
ast << [:haml, :text, text]
|
||||
ast << [:static, "\n"] if string_interpolated?(text)
|
||||
ast
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def string_interpolated?(text)
|
||||
text =~ /\#{[^\#{}]*}/
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue