v3.2.0+
| Status: | effective |
| Progress: | 95% |
| Version: | 3.2.0+ |
Help:Category format
From semantic-mediawiki.org
| Category format | |
|---|---|
| Outputs the results in columns, with first letters as section headers, in the style of MediaWiki category pages. | |
| Further Information | |
| Provided by: | Semantic MediaWiki |
| Added: | 1.4.3 |
| Removed: | still supported |
| Requirements: | none |
| Format name: | category |
| Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. | yes |
| Authors: | David Loomer , Yaron Koren |
| Categories: | misc |
| Table of Contents | |
Contents | |
The result format category is used to format query results in the manner of MediaWiki's category pages.
Semantic MediaWiki 2.2.0Released on 9 May 2015 and compatible with MW 1.19.0 - 1.24.x. brought several improvements to this result format:
- It now adheres to MediaWiki's
$wgCategoryCollationconfiguration parameter meaning that the sorting of the pages will be done according to the collation set for the wiki.1 - Also when adding the page's group headers the previously used "h3" element was replaced with a "div" element utilizing the same CSS properties. Thus these headers do no longer interfere with generation or suppression of tables of content e.g. with the
__TOC__or__NOTOC__behavior switches.2 - The "
named args" parameter was introduced allowing e.g. to change formatting
Semantic MediaWiki 2.3.0Released on 29 October 2015 and compatible with MW 1.19.0 - 1.25.x. introduced the ability for a responsive view, i.e. a view catering for mobile devices.3 To get the responsive view you have to set the "columns" parameter to "0". e.g. |columns=0.
The page sorting behavior of SMW and MW differ when it comes to pages containing the "
DEFAULTSORT" magic word ({{DEFAULTSORT:sortkey}}) or not. When using this result format a page containing the mentioned magic word takes precedence when sorting before a page not containing it.4Format specific parameters[edit]
| Parameter | Aliases | Type | Default | Description |
|---|---|---|---|---|
| columns | - | whole number | 3 | The number of columns in which to display results |
| delim | - | text | empty | The delimiter |
| template | - | text | empty | A template to format the items with |
| userparam | - | text | empty | A parameter to pass to the template |
| named args | namedargs | yes/no | no | Name the arguments passed to the template |
Since Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x. it is also possible to use namedargs as an alias of named args as a parameter to enable named arguments.5
Example[edit]
{{#ask:
[[Category:City]]
[[Located in::Germany]]
|format=category
}}
- This produces the following output
References
- ^ Semantic MediaWiki: GitHub issue gh:smw:783
- ^ Semantic MediaWiki: GitHub issue gh:smw:974
- ^ Semantic MediaWiki: GitHub pull request gh:smw:1147
- ^ Semantic MediaWiki: GitHub issue gh:smw:699
- ^ Semantic MediaWiki: GitHub pull request gh:smw:4665