Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
use article boolean
use single variable "show" to determine how to show quality
Line 196:
table.sort(task_forces, function (x, y) return tonumber(x) < tonumber(y) end)
table.sort(notes, function (x, y) return tonumber(x) < tonumber(y) end)
local assessment_category = function(cat, name)
if cat then
return cat:gsub(' articles', '') -- remove "articles" from category
else
return name or ''
end
end
local assessment_cat = assessment_category(args.ASSESSMENT_CAT, project)
---------------------------
-- Location warning -------
Line 239 ⟶ 247:
-- Primary image/text -----
---------------------------
local assessment_category = function(cat, name)
if cat then
return cat:gsub(' articles', '') -- remove "articles" from category
else
return name or ''
end
end
local assessment_cat = assessment_category(args.ASSESSMENT_CAT, project)
local primary_image = function(image_name, size)
local cell = mw.html.create('td')
Line 345:
if class then -- banner gives quality ratings
article_class = article_class and p.class_mask(article_class, title, false, pagetype, article)
local show_quality, conflict = true, false
if args.QUALITY_CRITERIA=='custom' then -- project has opted out of standard assessment scale and uses a custom mask
local custom_mask = banner_name:subPageTitle('class')
Line 391 ⟶ 390:
end
end
show_quality local show = false -- hide quality class in project banner by default
if article_class then -- banner shell exists
if class=='' or class==article_class then -- local class matches article class or is blank
show_quality = false -- hide quality class in project banner
class = article_class
check_redundant()
Line 402 ⟶ 401:
end
elseif not article and not isarticle(class) and class~='FM' then -- article class and local class are both non-article classes
show_quality = false
check_redundant()
elseif args.QUALITY_CRITERIA~=='custom' then -- articleproject classuses existscustom criteria and differs from local class differs
show = true -- show quality class in project banner
conflict = true
else -- article class exists and differs from local class
show = 'conflict'
add_category(class .. cfg.banner_shell.conflict.category)
end
else -- banner shell does not exist
conflictshow = true
end
local category = (class=='' and 'Unassessed' or class..'-Class') .. ' ' .. assessment_cat .. ' ' .. (article and 'articles' or 'pages')
if show_qualityshow then -- quality rating shown in banner
local rating
if article then
Line 421 ⟶ 423:
and cfg.quality.project_scale:format(wikilink(assessment_link..'#'..lang:ucfirst(cfg.quality.name), cfg.quality.name))
or cfg.quality.default_scale
local quality_rating = show=='conflict'
and cfg.banner_shell.conflict.text
or cfg.quality.rating:format(rating, scale)
Line 429 ⟶ 431:
:addClass('assess')
:addClass(cssClass)
:addClass(show=='conflict' and 'conflict' or nil)
:wikitext(wikilink(':Category:' .. category, class=='' and '???' or class))
:done()
Line 441 ⟶ 443:
nested_ratings,
1,
bubble(class=='' and 'Unassessed' or (class..'‑class'), show=='conflict', cssClass)
)
end