Project

Contents

Issue #00005088

Advanced WebTML pre-processor
Feature/Improvement

OpenWGA already has one TML preprocessor: {%label:key%} is translated to <tml:label key="key"/> when the TML is deployed.

We now added an optional second pre processor using a slightly different syntax and features.

The processor searches for text fragments of the form @{cmd value attributes}.

It first checks if the "cmd" begins with ":" or "/". If not it outputs <tml:item name="value" attributes/> or <tml:meta name="value" attributes/> if value is all upper case.

Samples:

@{TITLE}
<tml:meta name="title"/>

@{CREATED format="dd.MM.yyyy"}
<tml:meta name="created" format="dd.MM.yyyy"/>

@{some_item encode="none"}
<tml:item name="some_item" encode="none"/>

If a ":" is found as first character in cmd it is interpreted as a "command". the following commands currently are supported:

  • @{:each itemname}...@{/each}
  • @{:context context-expression}...@{/context}
  • @{:label key}
  • @{:encode encoder}...@{/encode}

Sample:

@{:each products}
    <h1>@{TITLE}</h1>
@{/each}

This outputs

<tml:foreach item="products">
    <tml:meta name="title"/>
</tml:foreach>

The new pre processor should currently be treated as "experimental" and is disabled by default. To enable the processor start your TML file with

##MDSET preprocess=true