Jump to content

Module:Sort title/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 22:21, 5 July 2019 (created doc). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Module:Sort title is used to create sortkeys for pages. 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 Avengers will have a sortkey of Avengers, 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 of Pilot (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 of End, The (Series of Unfortunate Events, A).

Usage

  • From a template, returns a sortkey: {{#invoke:Sort title|getSortKey}}
  • From a template, returns a DEFAULTSORT string: {{#invoke:Sort title|getDefaultSort}}
  • From a module, returns a sortkey:
    local sortkeyModule = require('Module:Sort title')
    local sortkey = sortkeyModule._getSortKey()