Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Articles by importance
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
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!
require('strict') local p = {} local importances = {'Top', 'High', 'Mid', 'Low', 'Bottom', 'NA', 'Unknown'} p.main = function(frame) local args = require('Module:Arguments').getArgs(frame) local title = args.page and mw.title.new(page) or mw.title.getCurrentTitle() local imp, topic, typ = title.text:match('^(%a+)-importance (.+) (%a+)$') local out, exist, cats = '', {}, {} local add_category = function(cat, sort) local link = '[[Category:' .. cat .. (sort and ('|' .. sort) or '') .. ']]' table.insert(cats, link) end if args.importance and imp and args.topic and topic and (args.importance:lower()~=imp:lower() or args.topic~=topic) then add_category('WikiProject assessment categories needing attention') end topic = args.topic or topic or '' imp = args.imp or imp or '' typ = typ or 'articles' if title.namespace==14 then out = frame:expandTemplate{title='Possibly empty category'} end local cat_in_use = function(cat) local cat_title = mw.title.new('Category:' .. cat) return cat_title and cat_title.exists or mw.site.stats.pagesInCategory(cat, 'pages')>0 end for _, importance in ipairs(importances) do if cat_in_use(importance .. '-importance' .. ' ' .. topic .. ' pages') then exist[importance] = 'pages' elseif cat_in_use(importance .. '-importance' .. ' ' .. topic .. ' articles') then exist[importance] = 'articles' else exist[importance] = false end end local imp_template = function(importance, page) return frame:expandTemplate{ title = 'importance', args = { [1] = importance, topic = topic, category = topic .. ' ' .. page, bold = 'no' } } end local header_row = mw.html.create('tr') for _, importance in ipairs(importances) do if exist[importance] then header_row:node(imp_template(importance, exist[importance])) end end if args.custom1 then header_row:node(imp_template(args.custom1, 'articles')) end if args.custom2 then header_row:node(imp_template(args.custom2, 'articles')) end local pages_in_cat = function(cat) local pages = mw.site.stats.pagesInCategory(cat, 'pages') local col = mw.html.create('td') :attr('align', 'right') :wikitext(mw.language.getContentLanguage():formatNum(pages)) return col end local second_row = mw.html.create('tr') for _, importance in ipairs(importances) do if exist[importance] then second_row:node(pages_in_cat(importance .. '-importance' .. ' ' .. topic .. ' ' .. exist[importance])) end end if args.custom1 then second_row:node(pages_in_cat(args.custom1 .. '-importance' .. ' ' .. topic .. ' articles')) end if args.custom2 then second_row:node(pages_in_cat(args.custom2 .. '-importance' .. ' ' .. topic .. ' articles')) end local tab = mw.html.create('table') :addClass('toccolours'):addClass('nomobile') :css('table-layout', 'fixed') :css('margin', '1em auto') :node(header_row) :node(second_row) if imp and imp~='' and imp~='nocat' then add_category(args.parent or (topic .. ' articles by importance'), imp) add_category(imp .. '-importance ' .. typ, args.sort or topic) end return out .. tostring(tab) .. table.concat(cats) end return p
Summary:
Please note that all contributions to Humanipedia 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
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Error
(
edit
)
Template:Lua
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Pp
(
edit
)
Template:Protection padlock
(
edit
)
Template:Sandbox other
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Module:Articles by importance/doc
(
edit
)
Module:Error
(
edit
)
Module:File link
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Protection banner
(
edit
)
Module:String
(
edit
)