diet-ng icon indicating copy to clipboard operation
diet-ng copied to clipboard

support runtime diet traits

Open MartinNowak opened this issue 8 years ago • 2 comments

Right now usage of dietTraits requires either different template codepaths (if (dice) compile!TraitsA else compile!TraitsB) or global variables. This is a bit unfortunate since most mechanisms in the traits could work with a runtime value, e.g. htmlOutputStyle. Would also be nice for stateful (cache) filters.

Might become a bit tricky with the different contexts (nested templates).

MartinNowak avatar Aug 09 '17 16:08 MartinNowak

Actually, having htmlOutputStyle can have a considerable performance impact, because, instead of one large string with indentation and line endings, each bit of the output HTML would have to be output individually. Or, alternatively, every template would have to be rendered once for each possible setting.

s-ludwig avatar Aug 10 '17 16:08 s-ludwig

Using the system in #70, this might be more feasible. Because the strings to output are generated once (when a file is updated) and cached. Something like changing the HTML output style at runtime could re-generate the strings to output and then each subsequent page load could use the cache.

schveiguy avatar Oct 26 '19 13:10 schveiguy