
Teddy is the most readable and easy to learn templating language there is!
Or put a more technical way, Teddy is an easy to read, HTML-inspired, mostly logic-less DOM templating engine with support for both server-side and client-side templating.
It uses HTML-like <tags>
for rudimentary templating logic and Teddy Roosevelt's facial hair for {variables}
.
Why yet another templating engine?
Good question.
Here's why:
Other popular templating engines are too cryptic
Are you tired of all those unnecessarily cryptic templating systems out there that look like this?
<h1>{{header}}</h1>
{{#bug}}
{{/bug}}
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}
{{#empty}}
<p>The list is empty.</p>
{{/empty}}
...Or this?
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}
...Or this?
{#names}{.}{@idx}{.}{/idx}{@sep}, {/sep}{/names}
Want something simpler and more readable so you can stop wasting time memorizing what all those funky symbols do so you can focus more on getting actual work done?
Well you're not the only one.
Teddy, symbol-buster extraordinaire
Teddy the trust-buster was a man of the people, curtailing the abuse of monopolists. As the most badass President of all-time, there's no way he'd put up with all this indecipherable templating nonsense.
As such, Teddy the templating engine is an engine of the people, curtailing the abuse of indecipherable templating systems. Teddy trust-buster extraordinaire is now symbol-buster extraordinaire.
Here's how:
- More concise
{variable}
syntax. One curly bracket. Not two, not three, no pound signs, no question marks, no backticks, no gang signs, and no hieroglyphs. - An
<include>
tag for layout templates and partials which accepts arguments via child<arg>
elements. - Flow control tags:
<if>
,<unless>
,<elseif>
,<elseunless>
, and<else>
for basic templating logic. - A
<loop>
tag for looping. - Server-side comments using
<!--! this syntax -->
or{! this syntax !}
which are stripped out at the template compilation stage.
This module was built and is maintained by the Roosevelt web framework team, but it can be used independently of Roosevelt as well.