Pyjoyment.Plugin.EPRenderer - Embedded Python renderer plugin¶
# Pyjoyment
app.plugin('EPRenderer')
app.plugin('EPRenderer', name='foo')
app.plugin('EPRenderer', name='bar', template={'line_start': '.'})
# Pyjoyment.Lite
plugin('EPRenderer')
plugin('EPRenderer', name='foo')
plugin('EPRenderer', name='bar', template={'line_start': '.'})
Pyjoyment.Plugin.EPRenderer is a renderer for Embedded Python
templates, ep, the default handler of Pyjoyment. They are
templates of Pyjo.Template with automatic escaping, in which the
values of the stash are variables, self and c are the current
controller, and the helpers are functions.
% title('Welcome!')
<p>Hello <%= name %>, this is <%= url_for('index') %>.</p>
A value of the stash hides a helper of the same name, which is still a
method of c, as is the helper c, which the variable c hides.
% c.title('Welcome!')
%= c.c('a', 'b', 'c').join(', ')
This is a core plugin, that means it is always enabled and its code a good example for learning to build new plugins, you’re welcome to fork it.
See Pyjoyment.Plugins for a list of plugins that are available by
default.
Options¶
Pyjoyment.Plugin.EPRenderer supports the following options.
name
# Pyjoyment.Lite
plugin('EPRenderer', name='foo')
Handler name, defaults to ep.
template
# Pyjoyment.Lite
plugin('EPRenderer', template={'line_start': '.'})
Attribute values passed to Pyjo.Template objects used to render
templates.
See also¶
Pyjoyment, https://mojolicious.org.
Ported from Mojolicious::Plugin::EPRenderer of Mojolicious 9.49.
- class Pyjoyment.Plugin.EPRenderer.Pyjoyment_Plugin_EPRenderer[source]¶
Pyjoyment.Plugin.EPRendererinherits all methods fromPyjoyment.Plugin.EPLRendererand implements the following new ones.- register(app: Pyjoyment_App, conf: dict[str, Any] | None = None) None[source]¶
plugin.register(Pyjoyment.new()) plugin.register(Pyjoyment.new(), {'name': 'foo'})
Register renderer in
Pyjoymentapplication.