Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Ypnypn/Review
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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 == '' then result = 'The article is perfect!' else result = "The article '''[["..page.."]]''' has some problems:\n"..result end return result end end function critique(content) issues = {} prose = content prose = string.gsub(prose, '{|.-|}', '') prose = string.gsub(prose, '<ref>.-</ref>', '') prose = string.gsub(prose, '%[%[Category:.-%]%]', '') prose = string.gsub(prose, '%[%[File:.-%]%]', '') prose = string.gsub(prose, '%b{}', '') --infobox if not string.match(content, '{{Infobox') 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 issues end 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 end if 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 end return '<strong><span style="color:red">Error: text not found!</span> '..issue..' = '..details..'</strong>\n' end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Sandbox/Ypnypn/Review/doc
(
edit
)
Module:Yesno
(
edit
)