Modul:Sort: Unterschied zwischen den Versionen
2018-03-22
w>PerfektesChaos (2018-03-16) |
w>PerfektesChaos (2018-03-22) |
||
| Zeile 1: | Zeile 1: | ||
local Sort = { suite = "Sort", | local Sort = { suite = "Sort", | ||
serial = "2018-03- | serial = "2018-03-22", | ||
item = 24205172 } | item = 24205172 } | ||
--[=[ | --[=[ | ||
| Zeile 13: | Zeile 13: | ||
-- Precondition: | -- Precondition: | ||
-- adjust -- string to be aligned | -- adjust -- string to be aligned | ||
-- apply -- string with base | -- apply -- string or table, with base | ||
-- "latin" | -- "latin" | ||
-- adapt -- variation, or false | -- adapt -- string or table, with variation, or false | ||
-- "DIN5007m2" -- DIN 5007 mode "2" | -- "DIN5007m2" -- DIN 5007 mode "2" | ||
local r = adjust | local r = adjust | ||
if adapt or not r:match( "^[ -~]*$" ) then | if adapt or not r:match( "^[ -~]*$" ) then | ||
local storage = "Module: | local storage = string.format( "Module:%s/", Sort.suite ) | ||
local collate, lucky, post, pre | local collate, lucky, post, pre | ||
if apply then | if apply then | ||
| Zeile 26: | Zeile 26: | ||
collate = "uni" | collate = "uni" | ||
end | end | ||
lucky, collate = pcall( mw.loadData, storage .. collate ) | if type( collate ) == "string" then | ||
lucky, collate = pcall( mw.loadData, storage .. collate ) | |||
end | |||
if adapt and type( collate ) == "table" then | if adapt and type( collate ) == "table" then | ||
local variants = type( adapt ) | local variants = type( adapt ) | ||
| Zeile 128: | Zeile 130: | ||
else | else | ||
r = "**ERROR** Sort.lex ** Submodule unavailable " .. collate | r = "**ERROR** Sort.lex ** Submodule unavailable " .. collate | ||
end | end | ||
end | end | ||