Difference between revisions of "Template:Xpd/doc"

From GeoGebra Manual
Jump to: navigation, search
 
Line 1: Line 1:
<noinclude><div class="messagebox" id="template_doc_page_viewed_directly" style="text-align: center">
+
{{Documentation subpage}}
This subpage contains [[w:Wikipedia:Template documentation|documentation]], [[Wikipedia:Categories|categories]] and other content that is not part of the template.<br /><span style="font-size:0.9em;">To view the {{lc:{{NAMESPACE}}}} page itself, see [[Template:Xpd]].</span></div>
 
{{DEFAULTSORT:{{PAGENAME}}}}{{#if:{{{inhibit|}}}|<!-- skip -->|[[Category:Documentation subpages]]}}</noinclude>
 
<!--
 
    PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE
 
-->
 
  
 
This {{timw|xpd}} (expansion demo) shows the call of a variable, parser function or template and its result, for documentation.
 
This {{timw|xpd}} (expansion demo) shows the call of a variable, parser function or template and its result, for documentation.
Line 70: Line 65:
  
 
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Handbook templates|{{PAGENAME}}]]
+
[[Category:Template documentation|{{PAGENAME}}]]
  
 
</includeonly>
 
</includeonly>

Latest revision as of 03:56, 6 January 2011

This Template:xpd (expansion demo) shows the call of a variable, parser function or template and its result, for documentation.

Usage:
{{xpd|left side|up to 3 additional parameters}}

Please note that for parser functions the first parameter belongs to the left side before "|".

Examples without additional parameters:

{{xpd|Note}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives Note:
{{xpd|CURRENTDAY}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives 18
{{xpd|#expr:2*3}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives 6
{{xpd|1=#expr:2+2=5}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives 0
{{xpd|1=#expr:2+2=4}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives 1
{{xpd|urlencode:!}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives %21
{{xpd|uc:abc}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives ABC

{{subst:xpd|uc:Upper Case|subst=subst:}} substitutes {{ subst:uc:Upper Case}} gives UPPER CASE

See Manual:Substitution for several caveats wrt subst=subst:.

Note that, as always, a parameter containing "=" has to be explicitly named by putting, in this case, "1=" in front.

Examples with additional parameters (no nesting possible):

{{xpd|#ifeq: 1.00|+1|okay}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives okay
{{xpd|#ifeq: this|that||false|s=is}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} is false
{{xpd|KeyCode|b}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives b
{{xpd|mediawiki|b|c}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives c

In the case of one or more named parameters, write all parameter definitions from that as value of the appropriate parameter number, e.g.:

{{xpd|mediawiki|2=wikt=abc|3=}} gives "{{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives [1]"

Optional substitution with subst=subst: is not supported. The demo template shows what another template actually does, and not what it did some time ago.

Separator parameter

Usage:
{{xpd|left side|up to 3 additional parameters|s=separator}}
The default separator is "gives", use s== or similar to get "=" etc.

Examples with separator parameter:

{{xpd|CURRENTDAY|s=is}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} is 18
{{xpd|1=#expr:2+2|s==}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} = 4


© 2024 International GeoGebra Institute