Modul:AutoDefaultsort
Utseende
Moduldokumentasjon
[opprett]
local p = {}
function p.autoDefaultSort(frame)
local title = mw.title.getCurrentTitle().text -- Get the page title
local words = mw.text.split(title, " ") -- Split into words
if #words > 1 then
local lastname = words[#words] -- Last word as last name
local firstname = table.concat(words, " ", 1, #words - 1) -- Rest as first name
return "{{safesubst:DEFAULTSORT:" .. lastname .. ", " .. firstname .. "}}"
else
return "{{safesubst:DEFAULTSORT:" .. title .. "}}"
end
end
return p