Closed ZeroIntensity closed 6 months ago
There does need to be a configuration setting for defining template locations. This will likely be something like:
[app]
templates = "./templates"
This does give me an idea for mixing different loader directories with different template paths, but that's for another issue.
In terms of engines, View will implement it's own template engine. This will also remove the "beginner" tag from this issue. It doesn't have to be anything too fancy, just something like:
<view template="index.html" /> <! -- includes a separate template -->
<view page="/" /> <! -- includes a separate page -->
<view ref="hello_world" /> <! -- takes the hello_world variable from the scope -->
<view iter="hello_world" item="i">
<view ref="i.foo" />
</view>
<view condition>
<view if="hello_world == 'test'">
<p>hello world is test</p>
</view>
<view else if="hello_world == 'not a test'">
<p>hello world is not a test</p>
<view>
<view else>
<p>idk what hello world is</p>
</view>
</view>
And of course, for batteries-detachable, I would like to support the following engines:
Feature description
With the introduction of the new component API (#12), a template rendering system should also be implemented to support features from other libraries. This will be pretty easy to implement.
Feature example API
Anything else?
Generally, Python templating uses Jinja, so naturally that would be the first option. However, other template engines could be introduced and selected via parameters to
template
or the configuration. The configuration will also specify atemplates
directory.The signature of
template
will probably end up looking like: