Skip to content
Snippets Groups Projects
Commit 918a6159 authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Handle tabs when indenting <VirtualHost> content.

Expand tabs before indenting the lines provided as the configuration
for a named virtual host (apache::named_vhost).  This will give users
the expected indentation in the generated vhost-NAME.conf file even
if they use TAB characters in their config lines.

This is only for aesthetics; the semantics of the configuration should
not be affected.
parent 9ea4dcbf
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,11 @@ NameVirtualHost <%= addr %> ...@@ -92,6 +92,11 @@ NameVirtualHost <%= addr %>
<% end -%> <% end -%>
<VirtualHost <%= server_addrs.join(' ') %>> <VirtualHost <%= server_addrs.join(' ') %>>
<%= vhostcfg.join("\n").gsub(/^./, ' \&') %> <% vhostcfg.each do |chunk|
# Expand tabs and indent four spaces
chunk = chunk.gsub(/([^\t\n]*)\t/) { $1 + " " * (8 - ($1.size % 8)) }
-%>
<%= chunk.rstrip.gsub(/^./, ' \&') %>
<% end -%>
</VirtualHost> </VirtualHost>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment