Module:Demo/doc

&#x3c;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikidata) --&#x3e;

Usage via templates
This module supports Demo

&#x3c;nowiki&#x3e;

and Demo inline

&#x3c;nowiki&#x3e;

The input must be wrapped in  tags or else it may be processed before the module can read it.

Usage in a module
If you want to use this in another module (such as to make the output prettier), you can get values like so: &#x3c;pre&#x3e;require('Module:demo').get(frame)&#x3c;/pre&#x3e;

Function get returns a table containing:
 * &#x3c;code&#x3e;source&#x3c;/code&#x3e; = the source code (without  wrappers, characters substituted with html entities)
 * &#x3c;code&#x3e;output&#x3c;/code&#x3e; = the execution result of the source.
 * &#x3c;code&#x3e;frame&#x3c;/code&#x3e; = the frame from which this template took the parameter.

By default, get takes the first parameter of frame. If the frame uses a different parameter name for the nowiki-wrapped source, then place that name (as a string) as the second parameter, like so &#x3c;code&#x3e;require('Module:demo').get(frame, 'alternate_name')&#x3c;/code&#x3e;

Example: &#x3c;nowiki&#x3e;p = {}

function p.main(frame) local parts = require('Module:demo').get(frame) return '&#x3c;Pretty html&#x3e;&#x3c;pre&#x3e;' .. parts.source .. '&#x3c;/pre&#x3e;&#x3c;more pretty html&#x3e;' .. parts.output .. '&#x3c;even more pretty html&#x3e;' end

return p&#x3c;/nowiki&#x3e;