• Home
  • Random
  • Nearby
  • Log in
  • Settings
  • Give to Wikipedia
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Demo

  • Language
  • Watch
  • Edit


Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Demo

Contents

  • 1 Usage
    • 1.1 Pre style
    • 1.2 Line breaks
      • 1.2.1 Alternative separator
    • 1.3 Category removal
    • 1.4 Module
  • 2 Redirects
  • 3 Related pages
    • 3.1 Other formatting templates

Usage Edit

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 Edit

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}}

 Done

Line breaks Edit

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}}





 Done


Alternative separator Edit

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}}
 Done


Category removal Edit

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:
This short article about [[:Category:Østfold geography stubs|Østfold location]] can be made longer. You can help Wikipedia by adding to it.


Module Edit

If the template used is based on Lua, you can pass args directly to the demonstrated module by invoking Module: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 A1
 
 
Team B2
 

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)

Redirects Edit

  • {{Template Pre}}
  • {{Tpre}}
  • {{Doc pre}}

Related pages Edit

  • {{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 Module:Template test case
  • {{Automarkup}} which uses Module:Automarkup

Other formatting templates Edit

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>{{Hatnote|lang=fr|Some text}}</nowiki>}}
{{hatnote|lang=fr|Some text}}

Some text
Shows code and example
{{xpd|Hatnote|Some hatnote text}} "{{hatnote|Some hatnote text}}" gives "
Some hatnote text
" [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}} [[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|{{{1}}}|true|false}}
{{#if}}
{{#if:{{{1}}}|true|false}}
Parser function equivalent to {{tl}}

No description.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Content1

must be wrapped in <nowiki>

Unknownoptional
br br

Number of line breaks, or wikitext to fill in as the linebreak

Unknownoptional
demo_kill_categoriesdemo_kill_categories nocat

no description

Booleanoptional
result_argresult_arg

no description

Unknownoptional
<pre> stylestyle

no description

Unknownoptional
The documentation on top is transcluded from Template:Demo/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://simple.wikipedia.org/w/index.php?title=Template:Demo&oldid=6508040"
Last edited on 22 April 2019, at 12:17

Languages

    • Аԥсшәа
    • العربية
    • Asturianu
    • Azərbaycanca
    • تۆرکجه
    • Bân-lâm-gú
    • Беларуская
    • Беларуская (тарашкевіца)
    • भोजपुरी
    • Dansk
    • English
    • فارسی
    • Føroyskt
    • ГӀалгӀай
    • 客家語/Hak-kâ-ngî
    • 한국어
    • Ilokano
    • Bahasa Indonesia
    • Ladin
    • मैथिली
    • മലയാളം
    • Bahasa Melayu
    • 閩東語 / Mìng-dĕ̤ng-ngṳ̄
    • Мокшень
    • Nederlands
    • 日本語
    • Нохчийн
    • ଓଡ଼ିଆ
    • Oʻzbekcha / ўзбекча
    • ਪੰਜਾਬੀ
    • Português
    • Română
    • Русский
    • සිංහල
    • Slovenščina
    • Српски / srpski
    • Татарча / tatarça
    • ၽႃႇသႃႇတႆး
    • తెలుగు
    • ไทย
    • Türkçe
    • Українська
    • Tiếng Việt
    • 粵語
    • 中文
    Wikipedia
    • This page was last changed on 22 April 2019, at 12:17.
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Code of Conduct
    • Terms of Use
    • Desktop
    • Developers
    • Statistics
    • Cookie statement