Help:Plainlist format – parameter named args

From Linux Web Expert

Revision as of 16:29, 7 January 2021 by >Kghbln (typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Parameter named argsProperty "Has name" (as page type) with input value "Parameter named args" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.
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 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 with "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

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?=city 
 |?Population=population
 |?Area=area
 |format=plainlist
 |introtemplate=TableNamedArgsHeader
 |template=TableNamedArgsBody
 |outrotemplate=TableFooter
 |named args=yes
}}
Result

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 an unknown date unknown versions of MediaWiki 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

#scite could not render a citation text for reference "gh:smw:4655" because type "pullrequest" was not assigned to a template.

References

  1. ^ gh:smw:4655