Frå GeoGebra Manual
Gå til: navigering, søk
[edit] [purge] Template documentation

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

{{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 Merk:
{{xpd|CURRENTDAY}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} gives 12
{{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

{{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 12
{{xpd|1=#expr:2+2|s==}} {{{{{1}}}{{#if:|{{{{{1n}}}}}}}}} = 4
© 2022 International GeoGebra Institute