Module:Verify

local p = {} local com = require('Module:Util') local nsm = require('Module:Namespace') local statusList = { ['verified'] = { ['text'] = '[verified]', ['category'] = 'Articles with verified bugs' },	['patched'] = { ['text'] = ' [patched] ', ['category'] = 'Articles with patched bugs' } }

local vTypes ={ bug = 'Bug verification', cite = 'Citation verification', loc = 'Location verification', det = 'Detail verification', dial = 'Dialogue verification', default = 'Verification' }

function p.verify(frame) local vStatus = string.gsub(string.lower(frame.args[1]), '\n', '') vStatus = statusList[vStatus] -- Need to check if this ended up being set, if it didn't then there should	be a date in frame.args[1] mw.log(com.exists(vStatus)) if com.exists(vStatus) == false then local vDiff = string.gsub(frame.args['days diff'], '\n', '') --This could have a random string of text in it so need to catch that. vDiff = tonumber(vDiff) -- Personally I would bind the number of days to the vTypes array		to allow each type to have its own independent time limit before going 		overdue left as a fixed value per the original template local wDays = 60 * 60 * 24 * 28 if vDiff ~= false then if vDiff > wDays then overdue = true end end end local vType = frame.args['type'], '\n', '' --Check if this was even passed through mw.log(com.exists(vType)) if com.exists(vType) then vType = vTypes[string.lower(vType)] end mw.log(vType) --Set to default if type is empty or invalid if com.exists(vType) == nil then vType = vTypes['default'] end local vNamespace = string.gsub(string.upper(frame.args['namespace']), '\n', '') local vNamespaceState = nsm.articleManagementInternal(vNamespace)

--Create text label result = mw.html.create('sup') --Confirmed statuses use a slightly different path to unverified if vStatus then result:wikitext(vStatus.text) else --Check if the verification is overdue if overdue then result:tag('span') :css('color', 'red') :wikitext('[verification overdue]') else result:wikitext('[verification needed]') end end --Convert to string as we may be attaching categories to the result result = tostring(result) --Add categories if allowed in that namespace if vNamespaceState == 'true' then result = result .. '[[Category:'		if vStatus then			result = result .. vStatus.category		else			result = result .. vType			if overdue then				result = result .. ' overdue'			else				result = result .. ' needed'			end		end		result = result .. ']]' end return result end

function p.test(frame) for k,v in pairs(frame) do mw.log('k: ' .. k .. ' v: ' .. v ..'\n') end end

return p