Jump to content

Template:demo

From Wiktionary, the free dictionary

This template displays Wikicode followed by the output of the Wikicode below it. It is similar to but more powerful than {{temp demo}}.

Examples

[edit]

1. A simple example:

{{demo|<nowiki>{{l|grc|δῆμος|g=m}}</nowiki>}}

results in the following (not including the horizontal separators):


{{l|grc|δῆμος|g=m}}
which produces
δῆμος m (dêmos)


2. A simple example using |fmt=i (inline):

{{demo|fmt=i|<nowiki>{{l|grc|δῆμος|g=m}}</nowiki>}}

results in the following (not including the horizontal separators):


{{l|grc|δῆμος|g=m}}δῆμος m (dêmos)


3. A more complex example:

{{demo|fmt=multiline|sep=producing<br />|<nowiki>{{quote-book|en
|author=w:William Shakespeare
|title=[[w:First Folio|Mr. William Shakespeares Comedies, Histories, & Tragedies: Published According to the True Originall Copies]]
|location=London
|publisher=Printed by [[w:William Jaggard|Isaac Iaggard]], and [[w:Edward Blount|Ed[ward] Blount]]
|year=c. 1601–1602
|year_published=1623
|page=255
|pageurl=https://books.google.com/books?id=uNtBAQAAMAAJ&pg=PA255
|oclc=606515358
|text='''Twelfe Night''', Or vvhat you vvill. [title of play]
}}</nowiki>}}

results in the following (not including the horizontal separators):


{{quote-book|en
|author=w:William Shakespeare
|title=[[w:First Folio|Mr. William Shakespeares Comedies, Histories, & Tragedies: Published According to the True Originall Copies]]
|location=London
|publisher=Printed by [[w:William Jaggard|Isaac Iaggard]], and [[w:Edward Blount|Ed[ward] Blount]]
|year=c. 1601–1602
|year_published=1623
|page=255
|pageurl=https://books.google.com/books?id=uNtBAQAAMAAJ&pg=PA255
|oclc=606515358
|text='''Twelfe Night''', Or vvhat you vvill. [title of play]
}}
producing

4. For reference, the same template call in compact format (which renders the template Wikicode inline):

{{demo|<nowiki>{{quote-book|en
|author=w:William Shakespeare
|title=[[w:First Folio|Mr. William Shakespeares Comedies, Histories, & Tragedies: Published According to the True Originall Copies]]
|location=London
|publisher=Printed by [[w:William Jaggard|Isaac Iaggard]], and [[w:Edward Blount|Ed[ward] Blount]]
|year=c. 1601–1602
|year_published=1623
|page=255
|pageurl=https://books.google.com/books?id=uNtBAQAAMAAJ&pg=PA255
|oclc=606515358
|text='''Twelfe Night''', Or vvhat you vvill. [title of play]
}}</nowiki>}}

looks like this (not including the horizontal separators):


{{quote-book|en |author=w:William Shakespeare |title=[[w:First Folio|Mr. William Shakespeares Comedies, Histories, & Tragedies: Published According to the True Originall Copies]] |location=London |publisher=Printed by [[w:William Jaggard|Isaac Iaggard]], and [[w:Edward Blount|Ed[ward] Blount]] |year=c. 1601–1602 |year_published=1623 |page=255 |pageurl=https://books.google.com/books?id=uNtBAQAAMAAJ&pg=PA255 |oclc=606515358 |text='''Twelfe Night''', Or vvhat you vvill. [title of play] }}
which produces


Parameters

[edit]
|1= (required)
The Wikicode, which must be wrapped in <nowiki>...</nowiki>.
|fmt=
Output format. Possible values are:
inline, i or 1: Render the Wikicode in inline format and put the output on the same line, separated by default by ⇒.
twoline or 2: Like inline but puts a newline after the right arrow. This is useful when the output is a full line.
compact or c (the default): Render the Wikicode in inline format but put the output on its own line; between then is the text which produces, on its own line. This is useful when the output is multiline or a table.
multiline or m: Like compact but render the Wikicode in full format. See the examples above for comparison between the two rendering formats. Full format puts the template Wikicode on its own line and respects newlines in the Wikicode, and is useful for long, multiline template invocations.
raw: Like multiline but just put a blank line between the Wikicode and the output, with no intervening text. When using this, you should set |sep= to some value to make it clearer where the separation between input and output is.
|sep=
The text separating the Wikicode and its output (default is blank if |fmt=raw, otherwise it depends on the format). Use <br /> to force extra blank lines.
|br=
The number of blank lines separating the Wikicode from its output, if |sep= is not supplied.
|reverse=1
If specified, place the output above the Wikicode.
|nocat=1
If specified, remove categories output by the Wikicode, to avoid the documentation page containing the demo from being put in a category.
|style=
The syntax highlighting style; passed directly to the syntaxhighlight extension tag.

See also

[edit]
  • {{demoi}} (defaults to |fmt=i)
  • {{demo2}} (defaults to |fmt=2)