Help:List format

From Linux Web Expert

Revision as of 12:19, 13 April 2020 by >Jaideraf (typo?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

List format
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.
Further Information
Provided by: Semantic MediaWiki
Added: 0.7
Removed: still supported
Requirements: none
Format name: list
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Markus Krötzsch , Stephan Gambke
Categories: misc
Keywords
list · template
Table of Contents

The result format list is used to format query results as comma separated lists. The output induces class attributes to HTML elements like <span class="smw-format list-format"> since Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki to facilitate easy individual styling. It is very similar to result format "Plainlist"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)., 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 not include class attributes to HTML elements then result format "Plainlist"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). needs to be used which is also the default result format of Semantic MediaWiki if no result format was specified.

Wikis that were using this result format prior to Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki and are relying on it not to provide HTML elements should migrate the respective queries to result format "Plainlist"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).. See also configuration parameter $smwgPlainListSets whether the list format should provide class attributes to HTML elements.

Parameters

Format specific
⧼validator-describe-header-parameter⧽ ⧼validator-describe-header-aliases⧽ ⧼validator-describe-header-type⧽ ⧼validator-describe-header-default⧽ ⧼validator-describe-header-description⧽
propsep - ⧼validator-type-string⧽ , The separator between the properties of a result entry
valuesep - ⧼validator-type-string⧽ , The separator between the values for a property of a result
template - ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a template with which to display the printouts
named args namedargs ⧼validator-type-boolean⧽ no Name the arguments passed to the template
userparam - ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ A value passed into each template call, if a template is used
class - ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ An additional CSS class to set for the list
introtemplate - ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a template to display before the query results, if there are any
outrotemplate - ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a template to display after the query results, if there are any
sep - ⧼validator-type-string⧽ , The separator between results
prefix - ⧼validator-type-string⧽ none Control display of namespace in printouts
Starting with Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki this result format was overhauled and the following changes were made to the parameters provided:1
  • The "class" parameter was introduced to allow setting an additional CSS class for the output.
  • The "template arguments" parameter was removed. It served no longer any purpose since the "?" prefix for arguments was removed, too.
  • The "propsep" and the "valuesep" parameter were introduced to supplement the "sep" parameter.

Examples

Standard output

The format must be requested explicitly. Otherwise result format "Plainlist"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). would be used.

Query
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |format=list
}}
Result


Extended output

If more printouts are requested the format must be requested explicitly, too. 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=list
}}
Result


Hidden headers

The headers can be hidden by giving them empty labels:

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


The same effect is achieved by using headers=hide:

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


Changed separator

Between results

Another separator between results than "," e.g. "and" can be used if specified by the sep parameter:

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |sep=&thinsp;and&thinsp;
}}
Result


Between properties

Another separator between results than "," e.g. ";" can be used if specified by the propsep parameter:

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?Population
 |?Area#km²=Area
 |format=list
 |propsep=;&thinsp;
}}
Result


Between property values

Another separator between results than "," e.g. "and" can be used if specified by the valuesep parameter:

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?Population
 |?Area#km²=Area
 |?Has zoo=Zoo
 |format=list
 |valuesep=&thinsp;and&thinsp;
}}
Result


The HTML character entities &thinsp;, &ensp; and &emsp; denote a thin space, an en space and an em space respectively, where a thin space is a quarter of the point size, an en space is half the point size and an em space is equal to the point size of the current font. If the output should not be broken at spaces &nbsp; (non-breaking space) is used.

References

  1. ^ gh:smw:3130