Setting values with the display parameter

De Semantic MediaWiki - Sandbox

This page demonstrates the +display parameter of the #set parser function, added in Semantic MediaWiki 7.2.0. It stores a value and shows it in the same call. Documentation: Help:Setting values/Working with the display parameter.

Link mode

+display without a mode, or +display=link, shows the value the way the in-text annotation would, here as a link to the page.

Syntax
{{#set:
 |Has page=Berlin|+display
}}
Result

Berlin

Text mode

+display=text shows the value without a link.

Syntax
{{#set:
 |Has page=Berlin|+display=text
}}
Result

Berlin

Several values with a separator

Values assigned at once with +sep are shown separated by commas. The order of +sep and +display does not matter.

Syntax
{{#set:
 |Has number=1;2;3|+sep=;|+display
}}
Result

1, 2, 3

Per assignment

Only the assignment carrying +display is shown. The other assignment in the same call is stored silently.

Syntax
{{#set:
 |Has text=Stored but not shown
 |Has page=Berlin|+display
}}
Result

Berlin

Invalid value

A value that cannot be assigned to the property is not shown; the usual error message appears instead.

Syntax
{{#set:
 |Has number=12abc|+display
}}
Result

« abc » ne peut pas être affecté à un type de nombre déclaré avec la valeur 12.

Unknown mode

A mode other than link and text produces a warning. The value is stored but not shown.

Syntax
{{#set:
 |Has text=Stored, warning shown instead|+display=bold
}}
Result

"bold" is not a supported "+display" mode (supported modes are "link" and "text"). The value was annotated but is not shown.

Verification

All values assigned by the examples above, shown or silent, are listed on Special:Browse for this page.

Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.