无法弄清楚如何正确渲染此模板

时间:2016-01-06 21:58:06

标签: puppet erb

给出以下每个块

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

我需要它像这样呈现。

enter image description here

然而它正在像这样呈现

enter image description here

我错过了什么?

1 个答案:

答案 0 :(得分:2)

您需要在non-printing tags中使用空格修剪。像这样......

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

第一行和最后一行开头和结尾的<%--%>告诉Ruby不要添加换行符。

相关问题