Yet another way to extend html?

33 views
Skip to first unread message

Ivan Z.

unread,
Jun 16, 2023, 1:02:44 PM6/16/23
to Trac Users
Hi, all!

There is a restriction here:
With Jinja2, the content is produced in one step, with no possibility of post-processing. The only way left to alter the generated content is to perform these modifications dynamically on client-side using JavaScript.

Have you considered the option of inheriting a template with the same name?

Here is an implementation based on Jinja for Sphinx-doc:
Templates with the same name in the templates_path override templates supplied by the selected theme.

Another example is based on Django templates:
A Django reusable app providing the overextends template tag, a drop-in replacement for Django's extends tag, which allows you to use circular template inheritance.

It seems like it is possible to extend/replace any block of any jinja-based template with the same name by any trac-extension without client-side rendering.
Reply all
Reply to author
Forward
0 new messages