Module:Sort title/doc: Difference between revisions
Appearance
Orangestar (talk | contribs) m 1 revision imported: More leftover templating |
Orangestar (talk | contribs) m Text replacement - "[[WP:" to "[[wikipedia:WP:" |
||
| Line 3: | Line 3: | ||
{{Lua|Module:Arguments|Module:String}} | {{Lua|Module:Arguments|Module:String}} | ||
'''Module:Sort title''' is used to create [[WP:SORTKEY|sortkeys]] for pages. | '''Module:Sort title''' is used to create [[wikipedia:WP:SORTKEY|sortkeys]] for pages. | ||
== What it does == | == What it does == | ||
| Line 32: | Line 32: | ||
|- | |- | ||
! scope="row" | <code>getDefaultSort</code> | ! scope="row" | <code>getDefaultSort</code> | ||
| Returns a [[WP:DEFAULTSORT|DEFAULTSORT]] string | | Returns a [[wikipedia:WP:DEFAULTSORT|DEFAULTSORT]] string | ||
|} | |} | ||
Latest revision as of 17:53, 13 June 2024
| This Lua module is used on approximately 20,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
| This module depends on the following other modules: |
Module:Sort title is used to create sortkeys for pages.
What it does
[edit source]The module preforms the following checks:
- If the first word of the title is an article, it moves it to the end of the title. For example:
The Avengerswill have a sortkey ofAvengers, The. - If the title is disambiguated and the first word of the disambiguation is an article, it moves it to the end of the disambiguation. For example:
Pilot (The Flash)will have a sortkey ofPilot (Flash, The). - If the title is disambiguated and the first word of the title and the disambiguation is an article, both of the above changes will occur. For example:
The End (A Series of Unfortunate Events)will have a sortkey ofEnd, The (Series of Unfortunate Events, A). - If the title is a number which is separated by a commas, it removes the commas. For example:
4,722 Hourswill have a sortkey of4722 Hours.
Usage
[edit source]From template:
{{#invoke:Sort title|getSortKey}}{{#invoke:Sort title|getDefaultSort}}
From module: <syntaxhighlight lang="lua">local sortkeyModule = require('Module:Sort title') local sortkey = sortkeyModule._getSortKey() </syntaxhighlight>
Function list
[edit source]| Function | Explanation |
|---|---|
getSortKey
|
Returns a sortkey |
getDefaultSort
|
Returns a DEFAULTSORT string |