diff --git a/CHANGELOG.md b/CHANGELOG.md index 7183db11..3285e229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ The format is based on [Keep a Changelog], and this project adheres to - Introduce `user_data_file`, `user_data_file_as_lines`, and `include_file` convenience methods to the YAML ERB template compiler ([#377]). -[2.13.4]: https://github.com/envato/stack_master/compare/v2.13.4...v2.14.0 +[2.14.0]: https://github.com/envato/stack_master/compare/v2.13.4...v2.14.0 [#375]: https://github.com/envato/stack_master/pull/375 [#376]: https://github.com/envato/stack_master/pull/376 [#377]: https://github.com/envato/stack_master/pull/377 diff --git a/lib/stack_master/cloudformation_interpolating_eruby.rb b/lib/stack_master/cloudformation_interpolating_eruby.rb index 852e7363..390b5d09 100644 --- a/lib/stack_master/cloudformation_interpolating_eruby.rb +++ b/lib/stack_master/cloudformation_interpolating_eruby.rb @@ -50,10 +50,7 @@ def format_lines_for_cloudformation(source) lines = lines.to_s if lines.is_a?(Symbol) next(lines) unless lines.is_a?(String) - newlines = Array.new(lines.count("\n"), "\n") - newlines = lines.split("\n").map { |line| "#{line}#{newlines.pop}" } - newlines.insert(0, "\n") if lines.start_with?("\n") - newlines + lines.scan(/[^\n]*\n?/).reject { |x| x == '' } end end end