Help:Plainlist format – parameter named args

From semantic-mediawiki.org
< Help:Plainlist format
Plainlist formatHelp:Plainlist format – parameter named args
Parameter named args
This help page explains the usage of named arguments when using a template to display the output of the query.
Keywords

This help page explains the usage of named arguments when using templates to display the output of your queries. Since Semantic MediaWiki 3.2.0Released on an unknown date and compatible with unknown versions of MediaWiki. you may also use namedargs as the name of the parameter.1

The default value to this parameter is "no" meaning that the arguments for templates are unnamed arguments (also known as anonymous or numerical arguments). Named arguments can be enabled bwith "yes".

Named arguments via the named args parameter are used to make the connection between the printout statement and the respective template argument easier to comprehend. They are used for convenience and increased wikitext transparency.

Example[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?=city 
 |?Population=population
 |?Area=area
 |format=plainlist
 |introtemplate=TableNamedArgsHeader
 |template=TableNamedArgsBody
 |outrotemplate=TableFooter
 |named args=yes
}}
Result
City Population Area
Berlin 3,520,061 891.85 km²344.34 sqmi <br />
Cologne 1,080,394 405.02 km²156.38 sqmi <br />
Frankfurt 679,664 248.31 km²95.87 sqmi <br />
Munich 1,353,186 310.43 km²119.86 sqmi <br />
Stuttgart 606,588 207.35 km²80.06 sqmi <br />
Würzburg 126,635 87.63 km²33.83 sqmi <br />

The templates used to create this example: TableNamedArgsHeader, TableNamedArgsBody and TableFooter.

Notes
  • The argument names are case-sensitive.
  • The "labels" to the printout statements specify the argument names used.
  • To add an argument name to the resulting page you have to use |?=somename. To get a plain output (not linked) additionally use |link=none.
  • The named argument is added to the template like, e.g. {{{somename}}}. Prior to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. like, e.g. {{{?somename}}}.
  • To hide the named argument if the result does not have a value for the respective printout statement use, e.g. {{{somename|}}}.
  • To fill the named argument if the result does not have a value for the respective printout statement use, e.g. {{{somename|sometext}}}.
  • If clicking on the "further results" yields an empty query because the named args parameter is not reproduced here, you may have to remove the searchlabel parameter.

See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:4655