Modul:Genitiv: Forskjell mellom sideversjoner
Hopp til navigering
Hopp til søk
Ingen redigeringsforklaring |
(bugs) |
||
Linje 2: | Linje 2: | ||
function p.genitiv(frame) |
function p.genitiv(frame) |
||
local |
local ord = frame.args[1] |
||
if ord == nil then |
|||
local args = pframe.args |
|||
ord = frame:getParent().args[1] |
|||
end |
|||
if ord == nil then |
if ord == nil then |
||
return "<strong class='error'>Malen «genitiv» må ha ett argument</strong>" |
return "<strong class='error'>Malen «genitiv» må ha ett argument</strong>" |
||
else |
|||
⚫ | |||
return pcall(function(ord) str = p._genetiv(ord) end) and str or ord |
|||
end |
end |
||
local status, str = pcall(function() return p._genitiv(ord) end) |
|||
if status == true then |
|||
⚫ | |||
end |
|||
return ord |
|||
end |
end |
||
function p._genitiv(ord) |
function p._genitiv(ord) |
||
local sv = "sxzşŝșšśßžżź" |
local sv = "sxzşŝșšśßžżź" |
Sideversjonen fra 8. okt. 2016 kl. 00:38
Formål
Denne modulen returnerer et ord i riktig genitivsform, avhengig av hvilken bokstav ordet slutter på. Se Mal:Genitiv for nærmere dokumentasjon.
Funksjoner
genitiv
: Brukes i {{genitiv}}_genitiv
: For bruk i andre moduler.
Brukes av
local p = {} function p.genitiv(frame) local ord = frame.args[1] if ord == nil then ord = frame:getParent().args[1] end if ord == nil then return "<strong class='error'>Malen «genitiv» må ha ett argument</strong>" end local status, str = pcall(function() return p._genitiv(ord) end) if status == true then return str end return ord end function p._genitiv(ord) local sv = "sxzşŝșšśßžżź" local sb = mw.ustring.toNFC(mw.ustring.lower(mw.ustring.sub(ord, -1))) if mw.ustring.find(sb, '%W') then return ord .. " sin" end if mw.ustring.find(sv, sb, nil, true) then return ord .. "ʼ" -- modifier letter apostrophe else return ord .. "s" end end return p