Module:Navseasoncats/var lasthalf

local p = {}

function p.var_lasthalf(frame) --Extracts the part of the string after the word with the year local arg, pagename, titleyear = nil if frame.args[1] then arg = mw.text.trim(frame.args[1]) end if arg and arg ~= '' then pagename = arg titleyear = frame:expandTemplate{ title = 'Title year', args = { page = pagename } } else pagename = mw.title.getCurrentTitle.text titleyear = frame:expandTemplate{ title = 'Title year', args = { pagename } } end local pos = mw.ustring.find( pagename, titleyear, 1, true ) or 0 local posm1 = pos - 1 local strright = frame:expandTemplate{ title = 'Str right', args = { pagename, posm1 } } local removefirstword = frame:expandTemplate{ title = 'Remove first word', args = { strright } } return removefirstword end

return p