Help:Ul format

From semantic-mediawiki.org
Help:Ul formatUl format/zh-hans
Ul format
Outputs results as a bulleted list, with additional outputs shown in parentheses.
Further Information
Provided by: Semantic MediaWiki
Added: 0.7
Removed: still supported
Requirements: none
Format name: ul
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Markus Krötzsch
Categories: misc
Keywords
list · template
Table of Contents

The result format ul is used to format query results as bulleted lists. 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 "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. and result format "Ol"Outputs results as a numbered list, with additional outputs shown in parentheses..

Parameters[edit]

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
Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. this result format was overhauled and the following changes were made to the parameters provided:1
  • The "columns" parameter was removed. Use the "class" parameter and CSS instead.
  • 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.
See the help page on 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). (formerly result format "Template"Uses a specified template to format and display the results) in case a template is used for formatting the query output.

Examples[edit]

Standard output[edit]

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

Multi-column output[edit]

Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. the "columns" parameter is no longer available.1 Instead the "class" parameter and CSS have to be used to generate two or more columns. CSS in turn allows for even more formatting options.2 The examples shown below provide examples for a two column layout.

Semantic MediaWiki ≥ 3.0.0[edit]

Query / individually (preferred)
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |format=ul
 |class=exampleclass
}}
CSS / individually (preferred)
ul.smw-format.ul-format.exampleclass {
    column-count: 2;
}
Result
It is preferred to use the "class" parameter to allow for a fine-grained control of the columns appearance for individual queries.
Query / globally
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |format=ul
}}
CSS / globally
ul.smw-format.ul-format {
    column-count: 2;
}
Result
This is discouraged since it does not allow for fine-grained control of the appearance of individual queries using this result format. All queries would be affected by the CSS.

Semantic MediaWiki < 3.0.0[edit]

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


References

  1. a b  Semantic MediaWiki: GitHub pull request gh:smw:3130
  2. ^  |  CSS Multiple Columns