Forum:Example Template for Documentation

The idea is to create a template that first shows the template's wiki code and then shows the output that code is generating. That should help adding examples to a documentation page. Here is what I got so far...

Template:

Use of the Template (on a documentation Page/doc):

But it's evil to have to write the same template call twice. So I am looking for something like this: or or (but don't like using | ...)

Any help is welcome on this :) Vanesyra 22:05, September 4, 2011 (UTC)

Maybe I misunderstood what you want, but I don't see the point of a template like that. Usually the documentation is handled like this, by putting the documentation in a subpage and showing it in the template page through this template. This way the template page isn't overloaded with the documentation. This template is also used to write the code in the examples, or you can always use the tags &lt;pre> Code &lt;/pre> for more complex codes. Feel fre to copy the whole template documentation system, but keep sure to have every templates listed in "dependencies", the categories used and the preloaded pages.


 * Some wikis use also a template like this one which display a notice (only) in the subpage documentation, also it will automatically add the category to the documentation page, so you will not have to add  at the end of the page. If you'll use this template, add it to the preload page.

Here is an example where I wanna use this and for what. Template:Charge and Template:Proc. It's just for adding examples on a documentation page and make sure that this examples get the same layout. Vanesyra 00:21, September 5, 2011 (UTC)


 * As long as you're properly using,  , or  , you can put example uses of your template on the template page itself. It just isn't a good idea to put so much documentation on the template page itself for performance purposes (aka it makes the wiki-engine do alot more work).
 * Is there a reason you don't want to use a subpage for your docs? -- Fandyllic (talk &middot; contr) 4 Sep 2011 5:34 PM Pacific

(edit conflict) Those template make a simply list of feature, they use a switch so you cannot use a template like that for "every template" since there are setted values. Tell me if I got iy right: by writing this, for example:

You want to get something like this:

gives:

am I correct?

For this kind of template, maybe try this code: gives:

With 1= the name of the template. 2=/3=...N= the parameters (use 2=parameter=value for named parameters). I don't know if it will works and I'm pretty sure that there are some bugs, but it's a start.