Help:Category format

From semantic-mediawiki.org
Jump to: navigation, search
Category format
List in columns, with first letters as section headers, in the style of MediaWiki category pages
Available languages
deenzh-hans
Further Information
Provided by: Semantic MediaWiki
Added: 1.4.3
Removed: still supported
Requirements: none
Format name: category
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
yes
Authors: David Loomer , Yaron Koren
Categories: misc
Group:
Table of Contents

↓ INFO ↓

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 $wgCategoryCollation configuration paramter 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.4

Format specific parameters

Parameter Type Default Description
columns whole number 3 The number of columns in which to display results (default is $1)
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 yes/no no Name the arguments passed to the template
import-annotation yes/no no Additional annotated data are to be copied during the parsing of a subject

Example

{{#ask: 
 [[Category:City]]
 [[located in::Germany]] 
 |format=category
}}
This produces the following output



This documentation page applies to all SMW versions from 1.4.3 to the most current version.
      Other languages: defrzh-hans

Help:Category format en 1.4.3


References

  1. ^  Semantic MediaWiki: GitHub issue gh:smw:783
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:974
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:1147
  4. ^  Semantic MediaWiki: GitHub issue gh:smw:699