Jump to content

Template:Sad/doc

From Wikipedia, the free encyclopedia

sad (sort and display) can be used in sortable tables (when using wikicode pipe table syntax; see Help:Table § Other table syntax) to sort by a text and also display it, with options to display more before and after without including it in sorting.

Usage
{{sad|text}}

Makes code to sort a table cell by text while also displaying text in the cell. Other content, for example a reference, can be written after the template without affecting sorting.

There are two optional parameters:

{{sad|text|before=|after=}}

The value of before and after will be displayed respectively before and after text without affecting sorting. Whitespace is stripped from the start and end of before and after but not from text.

Content written right before the template but not before a pipe will be interpreted as cell formatting code and not be displayed. before must therefore always be used for content to be displayed before text. Content to be displayed after text can be written either after the template or by using after. It is not recommended to use after for references.

The source code of the template as of October 2016 is:

data-sort-value="{{{1|}}}" | {{{before|}}}{{{1|}}}{{{after|}}}

The default behaviour of sorting without a data-sort-value or a sorting template is to use the whole text of the cell for sorting. This means that if before and after are not used and there is no text after the template then there is no reason to use the template.

See also[edit]