# HiliteJs Demo: Templating Engines

## Marker-TPL

    This is a line [###VAR1|html###] [###VAR2|subtxt255|html###]
    This is an URL: https://test.dom/test/?v=[###VAR1|url|html###]
    <a id="test">This is a link</a>
    [%%%IF:VAR2:==###VAR4###;%%%]
    	[%%%IF:VAR5:==This-is:==a;Text;%%%]
    		[%%%IF:VAR6:!=;%%%]
    			[%%%IF:VAR7:%2;(1)%%%]
    				[###VAR7|int###]
    			[%%%ELSE:VAR7(1)%%%]
    				[%%%IF:VAR7:%5;(2)%%%]
    					[###VAR8|int###]
    				[%%%/IF:VAR7(2)%%%]
    			[%%%/IF:VAR7(1)%%%]
    		[%%%ELSE:VAR6%%%]
    			[###VAR6|upper|html###]
    		[%%%/IF:VAR6%%%]
    	[%%%/IF:VAR5%%%]
    [%%%/IF:VAR2%%%]
    [%%%IF:VAR3:==yes;(1)%%%]
    	[%%%LOOP:VAR4%%%]
    		[###VAR4.NAME|html###], [###VAR4.PNAME|htmid|html###]
    	[%%%/LOOP:VAR4%%%]
    	[%%%LOOP:VAR10(1)%%%]
    		[###VAR10.TYPE|html###]
    	[%%%/LOOP:VAR10(1)%%%]
    [%%%ELSE:VAR3(1)%%%]
    	No Data
    [%%%/IF:VAR3(1)%%%]
    [@@@SUB-TEMPLATE:%test%@@@]
    [@@@SUB-TEMPLATE:%test%|syntax@@@]
    [@@@SUB-TEMPLATE:%test%|html-no-subtpls@@@]
    [@@@SUB-TEMPLATE:test.mtpl.htm@@@]
    [@@@SUB-TEMPLATE:test.mtpl.htm|syntax@@@]
    [@@@SUB-TEMPLATE:test.mtpl.htm|html-no-subtpls@@@]
    [@@@SUB-TEMPLATE:!path/to/test.mtpl.htm!@@@]
    [@@@SUB-TEMPLATE:!path/to/test.mtpl.htm!|syntax@@@]
    [@@@SUB-TEMPLATE:!path/to/test.mtpl.htm!|html-no-subtpls@@@]
    [@@@SUB-TEMPLATE:?!path/to/test.mtpl.htm!@@@]
    [@@@SUB-TEMPLATE:?!path/to/test.mtpl.htm!|syntax@@@]
    [@@@SUB-TEMPLATE:?!path/to/test.mtpl.htm!|html-no-subtpls@@@]
    [%%%|R%%%][%%%|N%%%][%%%|T%%%][%%%|SB-L%%%][%%%|SPACE%%%][%%%|SB-R%%%]
    [%%%COMMENT%%%]
    This is a comment
    [%%%/COMMENT%%%]
    [:::PLACEHOLDER:::]

## Twig (PHP Templating)

    {% if posts|length %}
      {% for article in articles %}
      &lt;div&gt;
      {{ article.title|upper() }}

      {# outputs 'WELCOME' #}
      &lt;/div&gt;
      {% endfor %}
    {% endif %}

    {% set user = json_encode(user) %}

    {{ random(['apple', 'orange', 'citrus']) }}

    {{ include(template_from_string("Hello {{ name }}")) }}

    <table>
    <tr class="stripped">
      <td>{{ article }}</td>
    </tr>
    </table>

    {#
    Comments may be long and multiline.
    Markup is &lt;em&gt;not&lt;/em&gt; highlighted within comments.
    #}

## LaTeX

    \documentclass{article}
    \usepackage[koi8-r]{inputenc}
    \hoffset=0pt
    \voffset=.3em
    \tolerance=400
    \newcommand{\eTiX}{\TeX}
    \begin{document}
    \section*{Highlight.js}
    \begin{table}[c|c]
    $\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
    \end{table}
    Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b
    G\"otterd\"ammerung~45\%=34.
    $$
        \int\limits_{0}^{\pi}\frac{4}{x-7}=3
    $$
    \end{document}