+1 Scott.
I have suffered a lot with this pain in some of my customized projects. For highly confusing code for the same can also be seen in sidedeepcategory.ftl .
I also prefer to indent html tags separately and ftl tags separately.

Regards
--
Chirag Manocha


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