Ticket #751 (closed enhancement: duplicate)

Opened 3 years ago

Last modified 2 years ago

[TiddlyWeb] consider a generic serializer that uses a templating system

Reported by: cdent Owned by: cdent
Priority: trivial Milestone:
Component: tiddlyweb Version:
Severity: low Keywords:
Cc:

Description (last modified by cdent) (diff)

Jeremy is interested in a way to use a template engine for the creation of arbitrary outputs of tiddler data.

One way to do this would be to have a serializer that can take a template as an input. The system can be configured then to handle proper mime types in the right circumstances and somehow manage to do the right thing.

Having such a thing would allow for some interesting experiments.

To be truly useful it would need to integrate with other serializations so you could, in templates, say things like:

{for tiddler in tiddlers} <p>{tiddler.as_html}</p> {end for}

and

{for tiddler in tiddlers} <pre><tiddler.as_text}</p> <end for>

Or whatever. Some thought would be required to make sure that we are able to present the right information to templates.

In Chris's mind this system can be as complicated as we like, but should maintain as much compartmentalization and separation from the rest of TiddlyWeb as possible.

Change History

Changed 3 years ago by cdent

  • type changed from defect to enhancement

Now that jinja2 is being used in various places in TiddlyWeb plugins and the like, it seems like the obvious candidate as the templating language to use here. It's basically the same syntax as django templates without the rest of django.

Any given URL would take a template argument and if that template is found in the template dir, then a known and published data dictionary would be given to that template file and away it would go.

Changed 3 years ago by cdent

  • owner changed from ChrisDent to cdent
  • description modified (diff)

Changed 3 years ago by cdent

  • priority changed from minor to trivial

Changed 3 years ago by cdent

The tws5 plugin has a form of template handling which may be a starting point for a generic template thing.

What's needed is a declared contract for what a template would recieve.

Changed 2 years ago by cdent

  • status changed from new to closed
  • resolution set to duplicate

overridden by the various tiddlytemplating ideas

Note: See TracTickets for help on using tickets.