NIHVIVO-1336 Fixed formatting on join directive

This commit is contained in:
rjy7 2010-12-16 23:08:47 +00:00
parent be95a1bdd8
commit dd2cdb9991

View file

@ -4,11 +4,18 @@
<#-- Macro join: join array elements with the specified glue string. --> <#-- Macro join: join array elements with the specified glue string. -->
<#macro join arr glue=", "><#compress> <#macro join arr glue=", ">
<#assign count = 0> <#assign count = 0>
<#-- This is VERY ugly: adding any formatting here inserts extra spaces into the output, even with the compress <#-- Freemarker is very finicky about whitespace here. The compress directives and formatting
directive. The compress directive is also necessary, though. Seems counter to the documentation at here work; do not alter them. -->
http://freemarker.org/docs/dgui_misc_whitespace.html --> <#list arr as el>
<#list arr as el><#if el?has_content><#if (count > 0)>${glue}</#if>${el}<#assign count = count+1></#if></#list> <#if el?has_content>
</#compress></#macro> <#compress>
<#if (count > 0)>${glue}</#if>
${el}
</#compress>
<#assign count = count+1>
</#if>
</#list>
</#macro>