Module:utilities: Difference between revisions
No edit summary |
m 1 revision imported |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 146: | Line 146: | ||
-- Generate the automatic sort key. | -- Generate the automatic sort key. | ||
local auto = lang:makeSortKey(sort_base or pagename or get_pagename(), sc) | local auto = lang:makeSortKey(sort_base or pagename or get_pagename(), sc) | ||
-- Use the page defaultsort if necessary. | -- Use the page defaultsort if necessary. Try hard to avoid empty sort key, which causes categories to be | ||
-- displayed as raw text; fall back to pagename if necessary. | |||
if not auto or auto == "" then | if not auto or auto == "" then | ||
auto = defaultsort or get_defaultsort() | auto = defaultsort or get_defaultsort() | ||
end | |||
if not auto or auto == "" then | |||
auto = sort_base | |||
end | |||
if not auto or auto == "" then | |||
auto = pagename or get_pagename() | |||
end | end | ||
-- If not sort key specified, use the automatic one. | -- If not sort key specified, use the automatic one. | ||