123b14edca
The current template inserts newlines after a location, which doesn't seem logical; one can't assume there will always be more blocks that follow. Therefore it is only logical to include the newline before a new location block is inserted, which lends itself to the convention of only prepending newlines to blocks, never appending them.
41 lines
1.2 KiB
Text
41 lines
1.2 KiB
Text
<% if @location_cfg_append -%>
|
|
<%- @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
|
|
<%- if value.is_a?(Hash) -%>
|
|
<%- value.each do |subkey,subvalue| -%>
|
|
<%- Array(subvalue).each do |asubvalue| -%>
|
|
<%= key %> <%= subkey %> <%= asubvalue %>;
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<%- else -%>
|
|
<%- Array(value).each do |asubvalue| -%>
|
|
<%= key %> <%= asubvalue %>;
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<% end -%>
|
|
<% if @location_custom_cfg_append -%>
|
|
<%- @location_custom_cfg_append.each do |key,value| -%>
|
|
<%- if value.is_a?(Hash) -%>
|
|
<%- value.each do |subkey,subvalue| -%>
|
|
<%- Array(subvalue).each do |asubvalue| -%>
|
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<%- else -%>
|
|
<%- Array(value).each do |asubvalue| -%>
|
|
<%= key %> <%= asubvalue %>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
<% end -%>
|
|
<% if @raw_append && Array(@raw_append).size > 0 -%>
|
|
<%- Array(@raw_append).each do |line| -%>
|
|
<%= line %>
|
|
<%- end -%>
|
|
<% end -%>
|
|
<% if @include -%>
|
|
<% @include.each do |include_file| -%>
|
|
include <%= include_file %>;
|
|
<%- end -%>
|
|
<% end -%>
|
|
}
|