Help:Ol format

From semantic-mediawiki.org
(Redirected from Help:Ol format)
Ol format
Outputs results as a numbered list, with additional outputs shown in parentheses.
Further Information
Provided by: Semantic MediaWiki
Added: 0.7
Removed: still supported
Requirements: none
Format name: ol
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 ol is used to format query results as numbered 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 "Ul"Outputs results as a bulleted 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=ol
}}
Result
  1. Berlin (PopulationThe number of inhabitants of some geographical place.: 3,520,061, Size in km²: 891.85 km²344.34 sqmi <br />)
  2. Cologne (PopulationThe number of inhabitants of some geographical place.: 1,080,394, Size in km²: 405.02 km²156.38 sqmi <br />)
  3. Frankfurt (PopulationThe number of inhabitants of some geographical place.: 679,664, Size in km²: 248.31 km²95.87 sqmi <br />)
  4. Munich (PopulationThe number of inhabitants of some geographical place.: 1,353,186, Size in km²: 310.43 km²119.86 sqmi <br />)
  5. Stuttgart (PopulationThe number of inhabitants of some geographical place.: 606,588, Size in km²: 207.35 km²80.06 sqmi <br />)
  6. Würzburg (PopulationThe number of inhabitants of some geographical place.: 126,635, Size in km²: 87.63 km²33.83 sqmi <br />)

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=ol
 |class=exampleclass
}}
CSS / individually (preferred)
ol.smw-format.ol-format.exampleclass {
    column-count: 2;
}
Result
  1. Berlin
  2. Cologne
  3. Frankfurt
  4. Munich
  5. Stuttgart
  6. Würzburg
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=ol
}}
CSS / globally
ol.smw-format.ol-format {
    column-count: 2;
}
Result
  1. Berlin
  2. Cologne
  3. Frankfurt
  4. Munich
  5. Stuttgart
  6. Würzburg
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=ol
 |columns=2
}}
Result
  1. Berlin
  2. Cologne
  3. Frankfurt
  4. Munich
  5. Stuttgart
  6. Würzburg

References

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