Redigerer
Mal:Nowiki template demo/dok
Hopp til navigering
Hopp til søk
Advarsel:
Du er ikke innlogget. IP-adressen din vil bli vist offentlig om du redigerer. Hvis du
logger inn
eller
oppretter en konto
vil redigeringene dine tilskrives brukernavnet ditt, og du vil få flere andre fordeler.
Antispamsjekk.
Ikke
fyll inn dette feltet!
{{Documentation subpage}} {{lua|Module:Template test case}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> This template shows a template invocation together with a demonstration of that template's output. The template arguments are passed in once, inside {{tag|nowiki}} tags, and are used to generate both the template invocation and the template output. The demonstration can be displayed in various different formats. This template is identical to {{tl|test case nowiki}} with the {{para|showtemplate2}} and {{para|showheader}} parameters both set to "no". To see the full range of options available, please see the [[Template:Test case nowiki/dok|test case nowiki documentation]]. == Usage == ===Basic syntax=== <pre style="overflow:auto;"> {{nowiki template demo|<nowiki>{{[template name] | [param1] = [value1] | [param2] = [value2] | [param3] = [value3] ... }}</nowiki>}} Or {{nowiki template demo|<nowiki>{{<!-- template name with parameters -->}}</nowiki>}} </pre> ===Common syntax=== The following options will work with all different test case formats. <pre style="overflow:auto;"> {{nowiki template demo | format = | collapsible = | resetRefs = | showcode = | showheader = | code = <nowiki>{{[template name] | [param1] = [value1] | [param2] = [value2] | [param3] = [value3] ... }}</nowiki> }} </pre> Some test case formats accept additional parameters as well. See their sections for documentation. == Parameters == {| class="wikitable" |+ Common parameters |- ! Parameter !! Description |- | <code>code</code> or <code>1</code> || The template code, inside {{tag|nowiki}} tags. You must use the magic word "__TEMPLATENAME__" instead of the template name. For example: <code><nowiki>| code = <nowiki>{{__TEMPLATENAME__|first|second|foo=bar}}</nowiki></nowiki></code>. <p>Note: due to the way nowiki tags work, the template treats the [[HTML entities]] &lt;, &gt; and &quot; as if they were the literal characters <, > and " when used with this parameter.</p> |- | <code>format</code> || The format to display the test cases in. This can be "default", "inline", "columns" or "rows". The inline format is for templates that can be displayed entirely on one line. If used with templates that display on multiple lines it may produce unexpected results. The "columns" and "rows" formats are intended for displaying multiple templates in a table, so they are not of much use here. See the [[Template:Test case nowiki/dok|test case nowiki documentation]] for more information about them. |- | <code>heading1</code> || A custom heading for the template. |- | <code>showheader</code> || If this is set to "no", then no headers are shown. |- | <code>collapsible</code> || If set to "yes", the demonstration is made collapsible. It is collapsed by default. |- | <code>resetRefs</code> || If set to "yes", any references generated by the templates tested are reset after each template is expanded. |- | <code>showcode</code> || Set this to "no" to disable display of the template invocation. |} You can use {{para|collapsible|yes}} with any format to collapse it. You can set a custom title for collapsible test cases with the {{para|title}} parameter. == Examples == === Default === ====Usage==== <pre style="white-space:pre-wrap; overflow:auto; background-color:#eee;"> {{nowiki template demo|code=<nowiki>{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}</nowiki>}} </pre> ====Output==== {{nowiki template demo|code=<nowiki>{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}</nowiki>}} === Default, collapsible === ====Usage==== <pre style="white-space:pre-wrap; overflow:auto; background-color:#eee;"> {{nowiki template demo|collapsible=yes|<nowiki>{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}</nowiki>}} </pre> ====Output==== {{nowiki template demo|collapsible=yes|<nowiki>{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}</nowiki>}} === Inline === using [[Template:3x]] ====Usage==== <pre style="white-space:pre-wrap; overflow:auto; background-color:#eee;"> {{nowiki template demo|format=inline|code=<nowiki>{{3x|Lorem ipsum}}</nowiki>}} </pre> ====Output==== {{nowiki template demo|format=inline|code=<nowiki>{{3x|Lorem ipsum}}</nowiki>}} Note: As this format starts with a bullet, a newline will always be inserted at the start of the template output due to [[phab:T14974|bug 14974]]. === Inline with nowiki output === using [[Template:URL]] ====Usage==== <pre style="white-space:pre-wrap; overflow:auto; background-color:#eee;"> {{nowiki template demo|format=inline|output=nowiki+|code=<nowiki>{{URL | 1= http://www.example.com/path?section=17 }}</nowiki>}} </pre> ====Output==== {{nowiki template demo|format=inline|output=nowiki+|code=<nowiki>{{URL | 1= http://www.example.com/path?section=17 }}</nowiki>}} == Technical limitations == The template has the following known technical limitations: * An error will be generated if processing the entire page takes more than 10 seconds. This is an intentional limit in the [[mw:Extension:Scribunto|Scribunto]] extension that runs [[Module:Template test case]], on which this template is based. If a test cases page takes more than 10 seconds to load, you may need to split it up into different pages. * The template converts the [[HTML entities]] &lt;, &gt; and &quot; inside template invocations to the literal characters <, > and ". This is due to the way nowiki tags work. == See also == Similar templates: * [[Template:Demo]] and [[Template:Demo-inline]] which use [[Module:Demo]] * [[Template:Automarkup]] which uses [[Module:Automarkup]] Templates invoking [[Module:Template test case]]: * [[Template:Test case]] – a generalised test case template * [[Template:Testcase rows]] – for a table of test cases arranged in rows * [[Template:Testcase table]] – for a table of test cases arranged in columns * [[Template:Inline test case]] – for test cases with small invocations and small output * [[Template:Collapsible test case]] – for test cases collapsed by default if the results are the same <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Documentation assistance templates]] [[Category:Programming typing-aid templates]] [[Category:Template test cases| ]] [[Category:Wikipedia utility templates]] [[Category:Wikitext processing templates]] }}</includeonly>
Redigeringsforklaring:
Merk at alle bidrag til Wikisida.no anses som frigitt under Creative Commons Navngivelse-DelPåSammeVilkår (se
Wikisida.no:Opphavsrett
for detaljer). Om du ikke vil at ditt materiale skal kunne redigeres og distribueres fritt må du ikke lagre det her.
Du lover oss også at du har skrevet teksten selv, eller kopiert den fra en kilde i offentlig eie eller en annen fri ressurs.
Ikke lagre opphavsrettsbeskyttet materiale uten tillatelse!
Avbryt
Redigeringshjelp
(åpnes i et nytt vindu)
Forhåndsvis en side som bruker denne malen
Denne siden er medlem av 1 skjult kategori:
Kategori:Sider hvor ekspansjonsdybden er overskredet
Navigasjonsmeny
Personlige verktøy
Ikke logget inn
Brukerdiskusjon
Bidrag
Opprett konto
Logg inn
Navnerom
Mal
Diskusjon
norsk bokmål
Visninger
Les
Rediger kilde
Vis historikk
Mer
Navigasjon
Forside
Siste endringer
Tilfeldig side
Hjelp til MediaWiki
Verktøy
Lenker hit
Relaterte endringer
Spesialsider
Sideinformasjon