Help:Plainlist format

From semantic-mediawiki.org
Plainlist format
Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements).
Further Information
Provided by: Semantic MediaWiki
Added: 3.0.0
Removed: still supported
Requirements: none
Format name: plainlist
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Stephan Gambke
Categories: misc
Keywords
list · template
Table of Contents

The result format plainlist is used to format query results as comma separated lists. It was introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.1 and is the default result format for all queries without additional printout statements. It replaces result format "Template"Uses a specified template to format and display the results which is now deprecated. Similar formats are result format "List"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output introduces class attributes to HTML elements to facilitate easy individual styling., result format "Ol"Outputs results as a numbered list, with additional outputs shown in parentheses. and result format "Ul"Outputs results as a bulleted list, with additional outputs shown in parentheses..

If the output should include class attributes to HTML elements then result format "List"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output introduces class attributes to HTML elements to facilitate easy individual styling. needs to be used.

See also the migration guide if you are upgrading from versions prior to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..

Parameters[edit]

General
Parameter Type Default Description
source text empty Alternative query source
limit whole number 50 The maximum number of results to return
offset whole number 0 The offset of the first result
link text all Show values as links
sort list of texts empty Property to sort the query by
order list of texts empty Order of the query sort
headers text show Display the headers/property names
mainlabel text no The label to give to the main page name
intro text empty The text to display before the query results, if there are any
outro text empty The text to display after the query results, if there are any
searchlabel text ... further results Text for continuing the search
default text empty The text to display if there are no query results
import-annotation yes/no no Additional annotated data are to be copied during the parsing of a subject
Format specific
Parameter Aliases Type Default Description
propsep - text , The separator between the properties of a result entry
valuesep - text , The separator between the values for a property of a result
template - text empty The name of a template with which to display the printouts
named args namedargs yes/no no Name the arguments passed to the template
userparam - text empty A value passed into each template call, if a template is used
class - text empty An additional CSS class to set for the list
introtemplate - text empty The name of a template to display before the query results, if there are any
outrotemplate - text empty The name of a template to display after the query results, if there are any
sep - text , The separator between results
Detailed documentation and examples
  • Parameter class – This help page explains how to add a custom CSS class to the output display of the query.
  • Parameter import-annotation – This help page explains how to import an annotation from the template used to display the output of the query to the page holding the query.
  • Parameter introtemplate – This help page explains how to specify a template that should be rendered once before the template used to display the output of the query.
  • Parameter named args – This help page explains the usage of named arguments when using a template to display the output of the query.
  • Parameter outrotemplate – This help page explains how to specify a template that should be rendered once after the template used to display the output of the query.
  • Parameter propsep – This help page explains how to specify a separator between the properties from different printout statements to display the output of the query.
  • Parameter sep – This help page explains how to specify a separator between the results displayed with the output of the query.
  • Parameter template – This help page explains how to specify a template that should be used to display the output of the query.
  • Parameter userparam – This help page explains how to pass a custom extra parameter to the template used to display the output of the query.
  • Parameter valuesep – This help page explains how to specify a separator between the values for properties from different printout statements to display the output of the query.
Most parameters can be combined to create the desired display of the output to a query.
Detailed documentation and examples for the template parameters

Moreover the template parameters (template, introtemplate and outrotemplate) allow for using variables in the templates used to display the output of the query:

All variables can be combined to create the desired display of the output to a query when using a template.

Examples[edit]

Standard output[edit]

Query
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
}}
Result

Berlin, Cologne, Frankfurt, Munich, Stuttgart, Würzburg

Extended output[edit]

If more printouts are requested, then the format must be requested explicitly. Otherwise result format "Table"Outputs the results in a table (default for queries with printout statements). would be used.

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Area
 |format=plainlist
}}
Result

Berlin (PopulationThe number of inhabitants of some geographical place.: 3,520,061, Area: 891.85 km²344.34 sqmi <br />), Cologne (PopulationThe number of inhabitants of some geographical place.: 1,080,394, Area: 405.02 km²156.38 sqmi <br />), Frankfurt (PopulationThe number of inhabitants of some geographical place.: 679,664, Area: 248.31 km²95.87 sqmi <br />), Munich (PopulationThe number of inhabitants of some geographical place.: 1,353,186, Area: 310.43 km²119.86 sqmi <br />), Stuttgart (PopulationThe number of inhabitants of some geographical place.: 606,588, Area: 207.35 km²80.06 sqmi <br />), Würzburg (PopulationThe number of inhabitants of some geographical place.: 126,635, Area: 87.63 km²33.83 sqmi <br />)

Hidden headers[edit]

The headers can be hidden by giving them empty labels:

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population=
 |?Area#km²= 
 |format=plainlist
}}
Result

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 same effect is achieved by using headers=hide:

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²
 |format=plainlist
 |headers=hide
}}
Result

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 />)

Tips[edit]

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub issue gh:smw:2488