How do I change the tag delimiter in a templated document?

David Semko
David Semko
  • Updated

Ketryx has a powerful document templating mechanism that can generate highly customizable documents for Milestones and Releases. Certain tags delimited by {...} are recognized by the Ketryx document generator and can be used to insert dynamic data from a Ketryx project into the document. In some cases, users desire that the { and/or } characters be treated as plain text by the document generator such that they appear in generated documents in their original form; to achieve this, the tag delimiter can be changed within the template document itself either throughout the document or applicable to certain sections.

Change delimiter in the entirety of a template document

In this example, we will consider changing the standard delimiter of { and } to a custom delimiter of <% and %>.

If these custom delimiters are desired to be used as a tag throughout the entire template, then the following Set Delimiter tag can be utilized at the beginning of the templated document.

{=<% %>=}

The document generator would treat all appearances of { and } after this point as text and would only look for <% and %> for recognized tags.

Custom delimiters may not contain whitespace or the equals sign, but otherwise, they can be arbitrary strings.

Change delimiter in only part of a template document

Sometimes, a template may utilize the standard tag delimiters, but a user may desire to ignore these delimiters in one (or a few) instances. In these cases, it is possible to set and reset the delimiters as follows.

{default_tags}

{=<% %>=}

{Not a tag}

<%={ }=%>

{default_tags_again}

Here, the template functions normally until the delimiter is changed immediately before a section that the user does not intend to be recognized as a tag. The delimiter is then reset to the default after this section and the document generator would read default tags again.

Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.