lib/trenni/template.rb in trenni-1.5.0 vs lib/trenni/template.rb in trenni-1.5.1
- old
+ new
@@ -48,10 +48,14 @@
attr :parts
# Output raw text to the template.
def text(text)
- @parts << "#{OUT}<<#{text.dump};"
+ text = text.gsub("'", "\\\\'")
+ @parts << "#{OUT}<<'#{text}';"
+
+ # This is an interesting approach, but it doens't preserve newlines or tabs as raw characters, so template line numbers don't match up.
+ # @parts << "#{OUT}<<#{text.dump};"
end
# Output a ruby expression (or part of).
def expression(text)
@parts << "#{text};"