local p =
function p.review(frame) page = frame.args['page'] or frame.args[1] article = mw.title.new(page,) content = article:getContent result = issues = critique(content) if frame.args['plain'] then for issue, details in pairs(issues) do result = result..'# '..issue..' = '..details..'\n' end return result else for issue, details in pairs(issues) do result = result..text(issue, details) end if result
function critique(content) issues =
prose = content prose = string.gsub(prose, '
--infobox if not string.match(content, '
') Then Issues['Infobox']: | 'none' end --categories if not string.match(content, '%[%[Category:') then issues['category'] = 'none' elseif not string.match(content, '%[%[Category:.+%[%[Category:') then issues['category'] = 'one' end --length length = #prose if length > 100000 then issues['length'] = 'too long' elseif length < 10000 then issues['length'] = 'too short' end return issuesend function text(issue, details) if issue 'infobox' and details'none' then return '* There is no infobox.\n' end if issue 'category' then if details'none' then return '* There are no categories.\n' elseif details 'one' then return '* There is only one category.\n' end endif issue 'length' then if details'too long' then return '* The article is very long.\n' elseif details 'too short' then return '* The article is very short.\n' end endreturn ' Error: text not found! '..issue..' = '..details..'\n'endreturn p |