Teamplaid:Demo/documentation
This is a documentation subpage for Teamplaid:Demo. It contains usage information, categories and other content that is not part of the original teamplaid page. |
Uses Lua: |
Ùsaid - Usage
[deasaich]This template simply places template code in a <pre>...</pre>
Tag and then places the template below the pre Tag.
{{Demo |br = |demo_kill_categories = |<nowiki>{{your template}}</nowiki> }}
IMPORTANT: You must wrap include <nowiki>...</nowiki>
tags around the source to be demonstrated (or use {{Escape}}, which has a Demo-escape example), like so:
{{Demo|<nowiki>[template source]</nowiki>}}
- Failure to wrap
<nowiki>...</nowiki>
tags around the source may cause the source to be executed before it reaches this template:✗ Fail
✗ Fail
Pre style
[deasaich]Set style=
to add any CSS text to the <Pre>...</Pre>
Tag.
For example, {{Demo|style=display:inline|<nowiki>{{Done}}</nowiki>}}
, would result in:
{{Done}}
Obair chrìochnaichte
Line breaks
[deasaich]You can change the number of line breaks between the pre Tag and the template by setting br=
to a number. The default is 1.
{{Demo|br=3|<nowiki>{{Done}}</nowiki>}}
{{Done}}
Obair chrìochnaichte
Alternative separator
[deasaich]You may also include an alternative separator by setting |br=
to something other than a number and it will take the place of the br tags. For example, |br=<td>
can make Demo fit in a table:
{{Done}} | Obair chrìochnaichte |
Category removal
[deasaich]For templates that add categories (e.g. {{Asbox}}), set |demo_kill_categories=
(or |nocat=
) to anything to prevent them from showing up in the output:
{{Asbox | image = Østfold_våpen.svg | pix = 30 | subject = [[Østfold]] location | name = Template:Østfold-geo-stub | category = Østfold geography stubs | tempsort = * }}
produces:Teamplaid:Asbox
Mòideal - Module
[deasaich]If the template used is based on Lua, you can pass args directly to the demonstrated module by invoking Mòideal:Demo like so: (this would reduce server stress)
{{#invoke:Demo|module|demo_br=0| demo_module=RoundN | demo_module_func = N2|demo_template = Round2 |bold_winner=high |May 1|Team A|1|Team B|2 }}
{{Round2 |bold_winner=high |May 1|Team A|1|Team B|2 }}
Final | ||
May 1 | ||
Team A | 1 | |
Team B | 2 | |
Note: It will attempt to preserve line breaks for unnamed params, but such is impossible for named params since those are stripped of whitespace/order before being passed to the module. Also note, you should use |demo_br=
instead of |br=
(all args you don't want being passed should be prefixed with 'demo_' if not already)
Ath-stiùiridhean - Redirects
[deasaich]- {{Template Pre}}
- {{Tpre}}
- {{Doc pre}}
Faic cuideachd - Also see
- {{Demo-inline}}, for an inline version of this template
- {{Escape}} - which has an example of this template without nowiki tags
- {{Nowiki template Demo}} which uses Mòideal:Template test case
- {{Automarkup}} which uses Mòideal:Automarkup
Other formatting templates
[deasaich]Code example | Effect | Notes |
---|---|---|
{{Tl2|Hatnote|lang=fr}} | {{Hatnote}} | Supports linking to sister projects (e.g., fr:Hatnote) |
{{Tlu|User:Ahunt/SSHFS}} | {{User:Ahunt/SSHFS}} | Supports linking to any namespace |
{{Demo|<nowiki> </nowiki>}} | {{Hatnote|lang=fr|Some text}} |
Shows code and example |
{{Xpd|Hatnote|Some Hatnote text}} | "{{Hatnote|Some Hatnote text}}" gives " " [1] |
Shows code, example and a link to expand the template code |
{{Tln|Hatnote}} | Template:Hatnote | Produces a normal link to the template |
{{Elc|Template:Hatnote}} {{Elc|Template:Hatnote|Hatnote}} |
[[Template:Hatnote]] [[Template:Hatnote|Hatnote]] |
Formats wikilink, with optional piped link text and blended suffix |
{{Ml|Example|hello}} | {{#invoke:Example|hello}} | Counterpart to {{Tl}} for linking to Lua modules |
{{Mlx|Example|hello}} | {{#invoke:Example|hello}} |
Counterpart to {{Tlx}} for linking to Lua modules |
{{Para|title|<var>book title</var>}} | title=book title | Formats template parameters for display, with or without values |
{{Sclx|LASTING}} | [[w:en:WP:LASTING]] |
Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a <code>...</code> Tag.
|
{{Tag|ref}} {{Xtag|templatedata}} |
<ref>...</ref> <templatedata> |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{Dtl|Ping project}} | {{d:Ping project}} | Wikidata counterpart to {{Tl}} |
{{Pf|If}} {{Pf|If|Other formatting templates|true|false}} |
{{#If}} {{#If:{{{1}}}|true|false}} |
Parser function equivalent to {{Tl}} |