1

Given the following each block

<%@variables.each do | index, value |%>
<%= 'export ' + index.upcase %>=<%= value.upcase%>
<%= 'export ' + index.downcase %>=<%= value.downcase%>
<%end%>

I need it to render like this.

enter image description here

however it is rendering like this

enter image description here

what am i missing?

NDBoost
  • 10,184
  • 6
  • 53
  • 73

1 Answers1

2

You need to use space trimming in your non-printing tags. Like this...

<%- @variables.each do | index, value | -%>
<%= 'export ' + index.upcase %>=<%= value.upcase %>
<%= 'export ' + index.downcase %>=<%= value.downcase %>
<%- end -%>

The <%- and -%> at the start and end of the first and last lines tells Ruby not to add a line break.

Patrick Lee
  • 1,990
  • 1
  • 19
  • 24
  • OK, I made a small edit to use `<%-` opening tags on the lines that shouldn't cause line breaks. – Patrick Lee Jan 06 '16 at 22:12
  • still does :( i edited my question with your example. – NDBoost Jan 06 '16 at 22:13
  • Silly question, but did you re-run Puppet after editing the template? – Patrick Lee Jan 06 '16 at 22:16
  • figured it out, its because im editing in windows which is adding the `^M` and then moving it to a linux box.. ugh. – NDBoost Jan 06 '16 at 22:19
  • 1
    OK, cool. Gotta love Windoze. Would you mind rolling back your edit to the question? The answer won't make sense to folks who come along later if the suggested code matches the non-working code. :) – Patrick Lee Jan 06 '16 at 22:23