Hi scott,

it's a good idea, I use this method this few month. The problem, on large file, it's difficult to use double formating and I don't found a good assistant to do an auto-format. If I have been many time I rewrite the actual ftl helper for eclipse but It's not the case.

Nicolas

Scott Gray wrote:
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

Reply via email to