Hi All,

I always find freemarker templates to be a real pain to try and inspect because the ftl and html code is indented together even though they represent different markup. What does everyone think about formatting the files so that ftl code is indented independently from the output?
For example this is how it looks at the moment:
<form>
  <table>
    <tr>
      <td>${uiLabelMap.WebtoolsFieldName}</td>
    </tr>
    <#assign alt_row = false>
    <#list fieldList as field>
      <tr<#if alt_row> class="alternate-row"</#if>>
        <td>${field.name}</td>
      </tr>
      <#assign alt_row = !alt_row>
    </#list>
    <tr>
      <td><input type="submit" value="${uiLabelMap.CommonFind}"></td>
    </tr>
  </table>
</form>

I'm suggesting we change it to this:
<form>
  <table>
    <tr>
      <td>${uiLabelMap.WebtoolsFieldName}</td>
    </tr>
<#assign alt_row = false>
<#list fieldList as field>
    <tr<#if alt_row> class="alternate-row"</#if>>
      <td>${field.name}</td>
    </tr>
    <#assign alt_row = !alt_row>
</#list>
    <tr>
      <td><input type="submit" value="${uiLabelMap.CommonFind}"></td>
    </tr>
  </table>
</form>

I guess on a small sample the change doesn't look like much but on large files I think it would make life a lot easier. The html output will be correctly indented and the templates will be easier to read because the ftl and html will usually sit at different indent levels so you can focus on one or the other.

Thoughts?

Thanks
Scott

HotWax Media
http://www.hotwaxmedia.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to