Задать вопрос

Тел: +7 965 3737 888





Wiki-like markup for sub templates

<p>I wanted to have the possibility to use a wiki-like markup style in my flatpages for various purposes (embedding images, quoting, etc.)</p>
<p>After a few dead ends I came up with this, which is quite nice I think.</p>
<p>It basically takes a named tag, loads the corresponding template, passes in all arguments, renders the template and replaces the named tag with the result.</p>
<p><em>The markup looks like this:</em></p>
<p>[[example:value to pass|option1=somevalue option2=values can have spaces too! without having to put them in quotes option3=some other value]]</p>
<p><em>This results in:</em></p>
<ul><li>Filter tries to load wiki/wiki_example.html</li>
<li>If it is loaded, it passes an WikiElement containing the value and the options to the template, renders it and replaces the tag with the rendered template</li>
</ul><p><em>In the "wiki/wiki_example.html" template you can use it like this:</em></p>

<p>Or loop over param.opts.iteritems.</p>

Вопрос полезен? Да0/Нет0