imported>Nardog
No edit summary
 
(No difference)

Latest revision as of 14:57, 14 May 2020

Documentation for this module may be created at Module:Sandbox/Nardog/11/doc

local p = {}

function p.main(frame)
	local s = frame.args[1]
	s = mw.text.trim(s)
	if s and s ~= '' then
		local date = s:match('%d%d:%d%d, %d%d? %u%l+ %d%d%d%d')
		if date then
			local tempName = 'unsigned'
			local user = s:match('%x+:%x+:%x+:%x+:%x+:%x+:%x+:%x+')
			user = user and user:upper() or s:match('%d+%.%d+%.%d+%.%d+')
			if user then
				tempName = tempName .. ' IP'
			else
				user = mw.ustring.match(s, '[\n' .. mw.ustring.char(0x200E) .. ']%s*(.+) %(?talk')
			end
			if user then
				return frame:expandTemplate{
					title = tempName,
					args = { user, date }
				}
			end
		end
	end
end

return p