帮助:有序列表格式

From semantic-mediawiki.org
< Help:Ol format
Ol format帮助:有序列表格式
有序列表格式
以有序列表的形式输出结果,额外输出在括号内展示。
更多信息
提供者: 语义MediaWiki
添加版本: 0.7
移除版本: 仍支持
需求:
格式名称: ol
启用?表明安装相应扩展时是否默认启用该结果格式。
作者: Markus Krötzsch
分类: 杂项
目录

结果格式ol(有序列表)用于把查询结果以有序列表格式展示。它与结果格式“Plainlist”未提供描述。结果格式“List”逗号分隔型列表,且带有括在英文圆括号当中的额外输出结果格式“Ul”项目符号列表,且带有括在英文圆括号当中的额外输出非常相似。

参数[edit]

格式特有
参数 别名 类型 默认 说明
propsep - 文本 , 结果记录的属性之间的分隔符
valuesep - 文本 , 用于结果属性值之间的分隔符
template - 文本 空白 输出显示模板的名称
named args namedargs 布尔值 no 请指定传递给该模板的变量
userparam - 文本 空白 使用模板时,向模板调用所传递的取值
class - 文本 空白 为列表设置的额外CSS类
introtemplate - 文本 空白 用于在查询结果前显示内容的模板的名称
outrotemplate - 文本 空白 用于在查询结果后显示内容的模板的名称
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.

示例[edit]

标准输出[edit]

查询
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population=人口
 |?Area#km²=面积(km²)
 |format=ol
}}
结果
  1. Berlin (人口The number of inhabitants of some geographical place.: 3,520,061, 面积(km²): 891.85 km²344.34 sqmi <br />)
  2. Cologne (人口The number of inhabitants of some geographical place.: 1,080,394, 面积(km²): 405.02 km²156.38 sqmi <br />)
  3. Frankfurt (人口The number of inhabitants of some geographical place.: 679,664, 面积(km²): 248.31 km²95.87 sqmi <br />)
  4. Munich (人口The number of inhabitants of some geographical place.: 1,353,186, 面积(km²): 310.43 km²119.86 sqmi <br />)
  5. Stuttgart (人口The number of inhabitants of some geographical place.: 606,588, 面积(km²): 207.35 km²80.06 sqmi <br />)
  6. Würzburg (人口The number of inhabitants of some geographical place.: 126,635, 面积(km²): 87.63 km²33.83 sqmi <br />)

多栏输出[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.

语义MediaWiki版本 ≥ 3.0.0[edit]

独立查询(推荐)
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |format=ol
 |class=exampleclass
}}
独立CSS(推荐)
ol.smw-format.ol-format.exampleclass {
    column-count: 2;
}
结果
  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.
全局查询
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |format=ol
}}
全局CSS
ol.smw-format.ol-format {
    column-count: 2;
}
结果
  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.

语义MediaWiki版本 < 3.0.0[edit]

查询
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |format=ol
 |columns=2
}}
结果
  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