Enable trim_mode via '-' in ERB templates

This adds whitespace supression optionally, similar to the default
behavior in Rails ActionView ERB templates.

Just add - to a %> like so: -%> and it will remove trailing whitespace
and newlines. This can also be done to the beginning tag for removing
newlines from the beginning of the tag line.
This commit is contained in:
Aaron Kalin
2012-09-10 18:18:56 -05:00
parent f29bf49a35
commit f6d4badcd2

View File

@@ -119,7 +119,7 @@ private ######################################################################
end
def write_template(name, target, binding)
compiled = ERB.new(export_template(name)).result(binding)
compiled = ERB.new(export_template(name), nil, '-').result(binding)
write_file target, compiled
end