Template:Defaultsort builder/doc
Template page
More actions
| This is a documentation subpage for Template:Defaultsort builder. It contains usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
This template is called by infoboxes, such as {{Infobox Ross ancestor}}, to generate a properly formatted and standardized `DEFAULTSORT` value for use in MediaWiki pages.
It constructs a default sort key based on:
|given_name=|middle_name=|surname=|title_ordinal=|title_role=|title_object=|birth=|death=
Features
- Standardizes `surname` using {{Surname sort standardization switch}}
- Standardizes `title_ordinal` using {{Ordinal numbers switch}}
- Excludes `title_role` if it is "laird"
- Adds commas and spaces only where appropriate
- Trims all input fields
Usage
Use in a template with `#invoke` like this:
{{Defaultsort builder
|given_name=John
|middle_name=Alexander
|surname=MacLeod
|title_ordinal=5th
|title_role=Chief
|title_object=Clan MacLeod
|birth=1543
|death=1616
}}Example Output
{{Surname sort standardization switch|MacLeod}}, John Alexander, Clan MacLeod Chief {{Ordinal numbers switch|5th}}→ Would expand to:
MacLeod, John Alexander, Clan MacLeod Chief 5 1543–1616
See Also