User:Sarri.greek (CAT) » Module:User:Sarri.greek/recognizeaffix doc » Template:User:Sarri.greek/recognizeaffix
-- ] wrote this, in 2019, for our use at el.wikt. Thank you!!
-- 2024.03.12. ]
-- ]
-- Used at ]
-- it cuts off the first character, if at 1 i put {{PAGENAME}} I added ...or PAGENAME
local p = {}
function p.affix(frame)
local term = frame.args or frame:getParent().args -- {{#invoke:recognizeaffix|affix|<a word>}}
PAGENAME = mw.title.getCurrentTitle().text
-- (1, 1) start at 1st character, stop at 1st character
-- when param 1 is empty, see PAGENAME
if term:sub(1, 1) == '-' or PAGENAME:sub(1, 1) == "-" then
-- (-1) is the last letter (1st from the end)
if term:sub(-1) == '-' then
return 'infix'
else
return 'suffix'
end
elseif term:sub(-1) == '-' then
return 'prefix'
else
return 'combining form'
end
end
return p