[Moin-user] Variable replacement based templates

Darren S. phatbuckett at gmail.com
Wed Mar 23 13:34:06 EDT 2016


MoinMoin supports traditional page templates (page name: FooTemplate),
which is useful for including boilerplate text in other pages. It also
supports page-render time content inclusion style templates via the
<<Include()>> macro. Someone please stop me if the below is noise
because there's support in MoinMoin I couldn't identify.


There is some confusing discussion of an alternate style of templates
based on "variable replacement" here:

https://moinmo.in/FeatureRequests/Templates

The feature request author is describing functionality like
MediaWiki's support for very flexible templates based on parameter
substitution, in which values for variables in the template are passed
in to the template and rendered in the output at the time of page
rendering. This is described here:

https://www.mediawiki.org/wiki/Help:Templates

The difference between MoinMoin's Include-based templates and
MediaWiki's parameter substitution based templates can be significant
in use cases where one wants to create page or content block templates
that can provide a basic structure for a page, but pages using those
templates only have to pass a list of parameters to the template to
render entire pages or content blocks with different
values/information on the page when displayed. The latter is similar
to template engines like Jinja and allows for very flexible sets of
pages in a wiki created from a core template but with user-specified
values from templates pages passed to the included template.

If it doesn't make sense, you kind of have to see how it works in
MediaWiki to appreciate it. One possible implementation in MoinMoin
would be to extend the Include() macro to accept either a list of
parameter values or (the useful one I think) parameter names and
values so that they can be substituted into variables in the included
page.

-- 
Darren Spruell
phatbuckett at gmail.com




More information about the Moin-user mailing list