novalis: (Default)
([personal profile] novalis Jan. 21st, 2009 02:01 pm)
We use Mediawiki to manage our recipes, and we highly recommend it. As we've cooked increasingly complicated dishes, we've started to change the way we organize our wiki. We now have recipes which are composed of subrecipes using a template that some people on #mediawiki helped me put together. When I was putting together the prep list for this Saturday's dinner, I noticed that I couldn't do this recursively. A bit of googling later, and I came to the solution:


You'll need the ParserFunctions extension. You may need to copy in a bunch of subsidiary templates from wikipedia.

Create a template called Template:Component1 with the following content:
<div><!--

-->{{#ifeq:μ|<!--**DEFINED BUT EMPTY**-->
|<!--**NOTHING**-->
|
}}<!--

--><div id="template_doc_page_transcluded" class="dablink plainlinks"><!--
-->{{#ifexist: {{{1}}}
|<!--**/doc EXISTS**-->This component is [[Wikipedia:Transclusion|transcluded]] from [[{{{1}}}]]. <small style="font-style: normal">([{{fullurl:{{{1}}}|action=edit}} edit])</small><br />
}}<!--

-->
</div>
{{#if:|{{{content}}}|{{#ifexist:{{{1}}} | {{ :{{{1}}} }} }}}}
<div style="clear: both;"></div>
</div>



Then create a template called Template:Component, which just redirects to Component1.
#redirect [[Template:Component1]]

Then, to include a recipe in another recipe, say: {{Component|subrecipe page name}}.
.

Profile

novalis: (Default)
novalis
Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags