Difference between revisions of "Template:Hid/doc"

From blackwiki
Jump to navigation Jump to search
imported>SporkBot
m (Remove template per TFD outcome)
imported>Colonies Chris
m (minor fixes)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
 +
{{Lua|Module:Sortkey}}
 +
{{Ombox|type=content|text=This template is '''deprecated'''. Table sort keys should now be defined using the <code>data-sort-value</code> attribute, like so: <code><nowiki>| data-sort-value="Doe, John" | John Doe</nowiki></code>. Please see {{Section link|WP:SORT|Specifying a sort key for a cell}} for details.}}
 +
 
 
===Use===
 
===Use===
 
This template hides a [[String (computer science)|string of text]].  If the contents of a [[Table cell|cell]] of a [[Help:Sorting|sortable table]] are prefixed with a [[Help:Sorting#Sorting with a hidden key|hidden string]], the cell will [[Help:Sorting|sort]] using the hidden string.
 
This template hides a [[String (computer science)|string of text]].  If the contents of a [[Table cell|cell]] of a [[Help:Sorting|sortable table]] are prefixed with a [[Help:Sorting#Sorting with a hidden key|hidden string]], the cell will [[Help:Sorting|sort]] using the hidden string.
Line 10: Line 13:
 
The use of this template is illustrated by the following sortable table:
 
The use of this template is illustrated by the following sortable table:
 
{|class="wikitable sortable"
 
{|class="wikitable sortable"
|+[[House of Windsor]]
+
|+ [[House of Windsor]]
!class=unsortable|[[Wikitext]]
+
!class=unsortable| [[Wikitext]]
!class=unsortable|[[Help:Sorting#Sorting with a hidden key|Hidden prefix]]
+
!class=unsortable| [[Help:Sorting#Sorting with a hidden key|Hidden prefix]]
!sort without key
+
! Sort without key
!sort with key
+
! Sort with key
 
|-
 
|-
|<nowiki>{{hid|A}}[[Edward VII of the United Kingdom]]</nowiki>
+
|<nowiki>{{hid|A}}[[Edward VII]]</nowiki>
|<nowiki><span class="sortkey">A</span></nowiki>
+
|<nowiki><span data-sort-value="A"></span></nowiki>
|[[Edward VII of the United Kingdom]]
+
|[[Edward VII]]
|{{hid|A}}[[Edward VII of the United Kingdom]]
+
|{{hid|A}}[[Edward VII]]
 
|-
 
|-
|<nowiki>{{hid|B}}[[George V of the United Kingdom]]</nowiki>
+
|<nowiki>{{hid|B}}[[George V]]</nowiki>
|<nowiki><span class="sortkey">B</span></nowiki>
+
|<nowiki><span data-sort-value="B"></span></nowiki>
|[[George V of the United Kingdom]]
+
|[[George V]]
|{{hid|B}}[[George V of the United Kingdom]]
+
|{{hid|B}}[[George V]]
 
|-
 
|-
|<nowiki>{{hid|C}}[[Edward VIII of the United Kingdom]]</nowiki>
+
|<nowiki>{{hid|C}}[[Edward VIII]]</nowiki>
|<nowiki><span class="sortkey">C</span></nowiki>
+
|<nowiki><span data-sort-value="C"></span></nowiki>
|[[Edward VIII of the United Kingdom]]
+
|[[Edward VIII]]
|{{hid|C}}[[Edward VIII of the United Kingdom]]
+
|{{hid|C}}[[Edward VIII]]
 
|-
 
|-
|<nowiki>{{hid|D}}[[George VI of the United Kingdom]]</nowiki>
+
|<nowiki>{{hid|D}}[[George VI]]</nowiki>
|<nowiki><span class="sortkey">D</span></nowiki>
+
|<nowiki><span data-sort-value="D"></span></nowiki>
|[[George VI of the United Kingdom]]
+
|[[George VI]]
|{{hid|D}}[[George VI of the United Kingdom]]
+
|{{hid|D}}[[George VI]]
|-
 
|<nowiki>{{hid|E}}[[Elizabeth II of the United Kingdom]]</nowiki>
 
|<nowiki><span class="sortkey">E</span></nowiki>
 
|[[Elizabeth II of the United Kingdom]]
 
|{{hid|E}}[[Elizabeth II of the United Kingdom]]
 
 
|-
 
|-
 +
|<nowiki>{{hid|E}}[[Elizabeth II]]</nowiki>
 +
|<nowiki><span data-sort-value="E"></span></nowiki>
 +
|[[Elizabeth II]]
 +
|{{hid|E}}[[Elizabeth II]]
 
|}
 
|}
  
 
===See also===
 
===See also===
*This template functions like [[Template:Hs]], except this template returns an empty result if var1 is empty.
+
*This template functions like [[Template:Hidden sort key]], except this template returns an empty result if var1 is empty.
<includeonly>
+
 
 +
<includeonly>{{sandbox other||
 
[[Category:Hidden text templates]]
 
[[Category:Hidden text templates]]
 
[[Category:Sorting templates]]
 
[[Category:Sorting templates]]
 
[[Category:Typing-aid templates]]
 
[[Category:Typing-aid templates]]
</includeonly>
+
}}</includeonly>

Latest revision as of 13:10, 31 August 2020

Use

This template hides a string of text. If the contents of a cell of a sortable table are prefixed with a hidden string, the cell will sort using the hidden string.

The syntax for this template is:

{{hid|var1}}

where var1 is a string of text.

The use of this template is illustrated by the following sortable table:

House of Windsor
Wikitext Hidden prefix Sort without key Sort with key
{{hid|A}}[[Edward VII]] <span data-sort-value="A"></span> Edward VII Edward VII
{{hid|B}}[[George V]] <span data-sort-value="B"></span> George V George V
{{hid|C}}[[Edward VIII]] <span data-sort-value="C"></span> Edward VIII Edward VIII
{{hid|D}}[[George VI]] <span data-sort-value="D"></span> George VI George VI
{{hid|E}}[[Elizabeth II]] <span data-sort-value="E"></span> Elizabeth II Elizabeth II

See also