Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
use cfg
attempt to simplify logic for quality class
Line 91:
:addClass('wpb-header-bubbles')
:css('background', colour)
:css('border', conflict=='X' and cfg.quality.conflict_border or (cfg.quality.bubble_border..' '..colour))
:wikitext(text)
return tostring(out)
Line 226:
assessment_link = nil
end
 
local class_mask = require('Module:Class mask' .. (sandbox or ''))._main
local check_exists = function(class, assessment_cat) -- check if category exists and is not blank
Line 235 ⟶ 236:
end
end
local class = raw_args.class
if args.QUALITY_CRITERIA=='custom' then
local custom_mask = banner_name:subPageTitle('class')
if custom_mask.exists and #custom_mask:getContent()>1 then
class = mw.text.trim(frame:expandTemplate{
title = custom_mask.prefixedText,
args = raw_args
})
end
else
local classmask_args = {
FQS = 'yes',
[1] = raw_args.class
}
class = class_mask(classmask_args, current_title)
end
local show_quality = true
if class=='¬' then
class = nil
end
if class then -- banner gives quality ratings
local show_quality, conflict = true, false
if args.QUALITY_CRITERIA~=='custom' then -- project useshas opted out of standard assessment scale and willuses inherita article class ifcustom neededmask
local custom_mask = banner_name:subPageTitle('class')
if custom_mask.exists and #custom_mask:getContent()>1 then
class = mw.text.trim(frame:expandTemplate{
title = custom_mask.prefixedText,
args = raw_args
})
end
else
local classmask_args = {FQS = 'yes', [1] = raw_args.class}
class = class_mask(classmask_args, current_title)
local article_class = p.readarticleclass({ignore_subtemplates=true}, current_title.prefixedText)
article_class = article_class and class_mask({article_class}, current_title)
Line 273 ⟶ 266:
show_quality = false
else -- article class exists and differs from local class
show_qualityconflict = 'X'true
add_category('Articles with conflicting quality ratings')
end
Line 307 ⟶ 300:
class,
frame:expandTemplate{ title = 'Class/colour', args = {class} },
show_qualityconflict
)
table.insert(nested_ratings, 1, new_bubble)