Moduł:Wikisłownikarz:Xoristzatziki:klucz/pl
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Wikisłownikarz:Xoristzatziki:klucz/pl/opis
export = {}
local Lf = {} --
local Ld = {} --
export['odpowiedniość']= function(c)
local lc = {}
lc['odpowiedniki'] = {
['ą'] = 'aα', ['ć'] = 'cα', ['ę'] = 'eα', ['ł'] = 'lα',
['ń'] = 'nα', ['ó'] = 'oα', ['ś'] = 'sα', ['ź'] = 'zα', ['ż'] = 'zε'}
return (lc['odpowiedniki'][mw.ustring.char(c)] or '')
end
export['klucz'] = function (thetext)
--jeśli tylko «-»
if mw.ustring.len(thetext) < 2 then
if thetext == '-' then
return thetext
end
end
local lc = {}
lc['klucz'] = ''
--na małe
lc['małe'] = mw.ustring.lower(thetext)
for c in mw.ustring.gcodepoint( lc['małe'] ) do
local tmpok, tmpthemapped = pcall(export['odpowiedniość'], c)
if tmpok then
if tmpthemapped == '' then
--bez odpowiednika
--jeśli mała litera ASCII
if c>96 and c < 123 then
--string.char bo ASCII (0-128)
lc['klucz'] = lc['klucz'] .. string.char(c)
end
else
--odpowiednik istnieje
if lc['klucz'] == '' then
--jeśli to pierwsza litera
--trzymaj (litera alfabetu)
lc['klucz'] = mw.ustring.char(c)
else
lc['klucz'] = lc['klucz'] .. tmpthemapped
end
end
end
end
--
--
return lc['klucz']
end
--[==[próby:
=p['klucz']("błękitna krew")
daje: blαeαkitnakrew
=p['klucz']("ładunek")
daje: ładunek
=p['klucz']("łabędź")
daje: łabeαdzα
]==]
return export