From f6d4badcd2bd4e42eb55a04e446a419cbee8191a Mon Sep 17 00:00:00 2001 From: Aaron Kalin Date: Mon, 10 Sep 2012 18:18:56 -0500 Subject: [PATCH] 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. --- lib/foreman/export/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/foreman/export/base.rb b/lib/foreman/export/base.rb index d55fe23..72dd464 100644 --- a/lib/foreman/export/base.rb +++ b/lib/foreman/export/base.rb @@ -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