Module:WikiProject banner/templatepage and Module:WikiProject banner/templatepage/sandbox: Difference between pages
Appearance
(Difference between pages)
Tungstenchan (talk | contribs) m Text replacement - "BattleTechWiki" to "BattleIntelligence" |
imported>Deadfire Created page with "require('strict') local p = {} local sandbox = '/sandbox' local template_page_cfg = { info = 'This WikiProject banner template uses Module:WikiProject banner, a meta-temp..." |
||
| Line 1: | Line 1: | ||
require('strict') | require('strict') | ||
local p = {} | local p = {} | ||
local sandbox | local sandbox = '/sandbox' | ||
local template_page_cfg = { | local template_page_cfg = { | ||
info = 'This WikiProject banner template uses [[Module:WikiProject banner]], a meta-template for easily creating and maintaining project banners. Please report any errors or feature requests to [[Module talk:WikiProject banner]].', | info = 'This WikiProject banner template uses [[Module:WikiProject banner]], a meta-template for easily creating and maintaining project banners. Please report any errors or feature requests to [[Module talk:WikiProject banner]].', | ||
| Line 35: | Line 35: | ||
}, | }, | ||
substcheck = { | substcheck = { | ||
text = 'A feature for detecting incorrectly [[ | text = 'A feature for detecting incorrectly [[Wikipedia:Template substitution|substituted]] project banners has not yet been implemented on this template. Please see the [[Template:WPBannerMeta/doc#Simple options|documentation]] for how to set the %s parameter.', | ||
tracking = {sort_key = 'Check'}, | tracking = {sort_key = 'Check'}, | ||
}, | }, | ||
| Line 57: | Line 57: | ||
text = 'Some of the assessment categories required for %s do not currently exist, and should to be created to avoid redlinks appearing on talk pages. Alternatively, you may need to set or update the %s parameter in this template.', | text = 'Some of the assessment categories required for %s do not currently exist, and should to be created to avoid redlinks appearing on talk pages. Alternatively, you may need to set or update the %s parameter in this template.', | ||
icon = 'Nuvola apps kfig.svg', | icon = 'Nuvola apps kfig.svg', | ||
create_summary = 'Creating category for [[ | create_summary = 'Creating category for [[WP:1.0/A|1.0 Assessment scheme]]', | ||
quality_preload = 'Template:WPBannerMeta/templatepage/preloadqual', | quality_preload = 'Template:WPBannerMeta/templatepage/preloadqual', | ||
importance_preload = 'Template:WPBannerMeta/templatepage/preloadimp', | importance_preload = 'Template:WPBannerMeta/templatepage/preloadimp', | ||
| Line 137: | Line 137: | ||
{ | { | ||
trigger = 'a class', | trigger = 'a class', | ||
parameters = {'ACR_SUBPAGE_LINK', 'ACR_REVIEW_LINK', 'ACR_IMAGE', 'ACR_SIZE'}, | parameters = {'ACR_SUBPAGE_LINK', 'ACR_REVIEW_LINK', 'ACR_IMAGE', 'ACR_SIZE', 'ACR_PRELOAD'}, | ||
categories = {'ACR_PASS_CAT', 'ACR_FAIL_CAT', 'ACR_CURRENT_CAT', 'ACR_INVALID_CAT'} | categories = {'ACR_PASS_CAT', 'ACR_FAIL_CAT', 'ACR_CURRENT_CAT', 'ACR_INVALID_CAT'} | ||
}, | }, | ||
| Line 157: | Line 157: | ||
create = 'Automatic parameter checking is enabled. Create the [[%s|tracking category]] to track invalid parameters.', | create = 'Automatic parameter checking is enabled. Create the [[%s|tracking category]] to track invalid parameters.', | ||
}, | }, | ||
inactive = 'This project has been identified as %s. Please see [[ | inactive = 'This project has been identified as %s. Please see [[WP:INACTIVEWP]] for more information. To reactivate this project, change <code>inactive</code> on the first line to <code>main</code>.' | ||
} | } | ||
local auto_doc_cfg = { | local auto_doc_cfg = { | ||
lead = 'This is the WikiProject banner template used by %s to keep track of articles within its scope.', | |||
main_cat = 'All articles are categorised into [[:Category:%s]].', | |||
attention = 'set _PARAMETER|yes_ if the article needs immediate attention from experienced editors. Use only if another parameter does not cover the need for attention; this should be used sparingly. It is strongly encouraged to also add a section to the talk page explaining what needs attention. This parameter populates [[:Category:%s]].', | attention = 'set _PARAMETER|yes_ if the article needs immediate attention from experienced editors. Use only if another parameter does not cover the need for attention; this should be used sparingly. It is strongly encouraged to also add a section to the talk page explaining what needs attention. This parameter populates [[:Category:%s]].', | ||
auto = 'this parameter is for the use of [[ | auto = 'this parameter is for the use of [[Wikipedia:Bots|bots]] and indicates that the article has been [[Wikipedia:Types of bots#WikiProject tagging and auto-assessment bots|automatically rated]]:\n' | ||
.. '*length – based on the length of the article;\n' | .. '*length – based on the length of the article;\n' | ||
.. '*inherit – because one or more other projects use this class;\n' | .. '*inherit – because one or more other projects use this class;\n' | ||
.. '*yes or stub (in conjunction with <code>|class=stub</code>) – as Stub-Class because it uses a [[ | .. '*yes or stub (in conjunction with <code>|class=stub</code>) – as Stub-Class because it uses a [[Wikipedia:Stub|stub template]].\n' | ||
.. 'Use of the above values with this parameter populates [[:Category:%s]].', | .. 'Use of the above values with this parameter populates [[:Category:%s]].', | ||
category = 'set _PARAMETER|no_ if, and only if, a banner is being used for demonstration or testing purposes, to prevent unnecessary or undesirable categorization. Otherwise, omit this parameter.', | category = 'set _PARAMETER|no_ if, and only if, a banner is being used for demonstration or testing purposes, to prevent unnecessary or undesirable categorization. Otherwise, omit this parameter.', | ||
image_needed = { | image_needed = { | ||
text = 'to request that %s be [[ | text = 'to request that %s be [[Wikipedia:Uploading images|added]] to the page.', | ||
location = 'specify the location of the requested image. Will be categorised into Category: | location = 'specify the location of the requested image. Will be categorised into Category:Wikipedia requested %ss in LOCATION, where LOCATION is the value of the _PARAMETER_ paramater.', | ||
details = 'additional text to insert before the words \"be [[ | details = 'additional text to insert before the words \"be [[Wikipedia:Uploading images|added]] to this article\" to describe the subject or type of image that is requested.', | ||
topic = 'specify the topic of the requested image. Will be categorised into Category: | topic = 'specify the topic of the requested image. Will be categorised into Category:Wikipedia requested %ss of TOPIC, where TOPIC is the value of the _PARAMETER_ parameter.', | ||
_type = 'overrides the default text (%s); also used to categorise the request.', | _type = 'overrides the default text (%s); also used to categorise the request.', | ||
default = 'If no %s is specified then [[:Category:%s]] is used by default.' | default = 'If no %s is specified then [[:Category:%s]] is used by default.' | ||
| Line 187: | Line 189: | ||
classes = {'Top', 'High', 'Mid', 'Low', 'NA'} | classes = {'Top', 'High', 'Mid', 'Low', 'NA'} | ||
}, | }, | ||
infobox = 'set _PARAMETER|yes_ if the article needs an [[ | infobox = 'set _PARAMETER|yes_ if the article needs an [[Wikipedia:Manual of Style/Infoboxes|infobox]]. Remember that infoboxes are not suitable for all articles, and can overwhelm short articles. This parameter populates [[:Category:%s]].', | ||
listas = 'this parameter, which is the equivalent of the [[Help:Category#Default sort key|DEFAULTSORT sortkey]] that should be placed on all biographical articles, is a sortkey for the article talk page (e.g. for %s, use %s so that the talk page will show up in the %s\'s and not the %s\'s of the various assessment and administrative categories. Similarly, for topics with titles beginning with an [[article (grammar)|article]] such as "the" or "a" - e.g. for %s, use %s so that the talk page will show up in the %s\'s. This is important because it is one source used by those who set DEFAULTSORT on the article; consider also setting the DEFAULTSORT for the article when setting this parameter. For more information about this, please see [[Wikipedia:Categorization of people#Ordering names in a category]]. It is not required if another WikiProject template on the same page has its own {{para|listas}} set, since it affects the sortkey of all banners and templates.', | |||
listas = 'this parameter, which is the equivalent of the [[Help:Category#Default sort key|DEFAULTSORT sortkey]] that should be placed on all biographical articles, is a sortkey for the article talk page (e.g. for %s, use %s so that the talk page will show up in the %s\'s and not the %s\'s of the various assessment and administrative categories. Similarly, for topics with titles beginning with an [[article (grammar)|article]] such as "the" or "a" - e.g. for %s, use %s so that the talk page will show up in the %s\'s. This is important because it is one source used by those who set DEFAULTSORT on the article; consider also setting the DEFAULTSORT for the article when setting this parameter. For more information about this, please see [[ | |||
note = { | note = { | ||
yes_no = 'set _PARAMETER|yes_ or any non-blank value other than "no", "n" or "0". ', | yes_no = 'set _PARAMETER|yes_ or any non-blank value other than "no", "n" or "0". ', | ||
| Line 274: | Line 275: | ||
end | end | ||
end | end | ||
local project_link = args.PROJECT_LINK or ' | local project_link = args.PROJECT_LINK or 'Wikipedia:WikiProject ' .. project | ||
--------------------------- | --------------------------- | ||
-- Count notes/taskforces - | -- Count notes/taskforces - | ||
| Line 338: | Line 339: | ||
end | end | ||
if not assessment_link then | if not assessment_link then | ||
local project_link = mw.title.new(args.PROJECT_LINK or ' | local project_link = mw.title.new(args.PROJECT_LINK or 'Wikipedia:' .. project_name) | ||
local fallback = mw.title.new(project_link.prefixedText .. '/Assessment') | local fallback = mw.title.new(project_link.prefixedText .. '/Assessment') | ||
assessment_link = fallback.exists and fallback.prefixedText | assessment_link = fallback.exists and fallback.prefixedText | ||
| Line 529: | Line 530: | ||
local importance_name = args.IMPN or (raw_args.priority and 'priority' or cfg.importance.default_name) | local importance_name = args.IMPN or (raw_args.priority and 'priority' or cfg.importance.default_name) | ||
local check_assessment_categories = function(project, assessment_cat, quality, importance_scale, prefix, tf_name) | local check_assessment_categories = function(project, assessment_cat, quality, importance_scale, prefix, tf_name) | ||
assessment_cat | local cat = (assessment_cat and assessment_cat:gsub(' articles', '') or project or '') .. ' articles' | ||
local missing_cats = {} | local missing_cats = {} | ||
local red_cats_in_use = false | local red_cats_in_use = false | ||
| Line 542: | Line 543: | ||
summary = cfg_tp.check_assessment.create_summary, | summary = cfg_tp.check_assessment.create_summary, | ||
['preloadparams[1]'] = project, | ['preloadparams[1]'] = project, | ||
['preloadparams[2]'] = mw.ustring.gsub( | ['preloadparams[2]'] = mw.ustring.gsub(cat, ' articles', '') -- needs simplifying | ||
}) | }) | ||
local pages_in_category = mw.site.stats.pagesInCategory(cat_name, 'pages') | local pages_in_category = mw.site.stats.pagesInCategory(cat_name, 'pages') | ||
| Line 554: | Line 555: | ||
end | end | ||
if quality then | if quality then | ||
check_cat(lang:ucfirst( | check_cat(lang:ucfirst(cat) .. ' by quality', cfg_tp.check_assessment.meta_preload) | ||
for _, class in ipairs(cfg_tp.check_assessment.classes) do | for _, class in ipairs(cfg_tp.check_assessment.classes) do | ||
local cat_name = (class=='Unassessed' and 'Unassessed' or class..'-Class') .. ' ' .. | local cat_name = (class=='Unassessed' and 'Unassessed' or class..'-Class') .. ' ' .. cat | ||
check_cat(cat_name, cfg_tp.check_assessment.quality_preload) | check_cat(cat_name, cfg_tp.check_assessment.quality_preload) | ||
end | end | ||
end | end | ||
if importance_scale and importance_scale~='inline' and importance_scale~='subpage' then | if importance_scale and importance_scale~='inline' and importance_scale~='subpage' then | ||
check_cat(lang:ucfirst( | check_cat(lang:ucfirst(cat) .. ' by ' .. importance_name, cfg_tp.check_assessment.meta_preload) | ||
for _, importance in ipairs(cfg_tp.check_assessment.importances) do | for _, importance in ipairs(cfg_tp.check_assessment.importances) do | ||
local cat_name = importance .. '-' .. importance_name .. ' ' .. | local cat_name = importance .. '-' .. importance_name .. ' ' .. cat | ||
check_cat(cat_name, cfg_tp.check_assessment.importance_preload) | check_cat(cat_name, cfg_tp.check_assessment.importance_preload) | ||
end | end | ||
| Line 668: | Line 669: | ||
local category_suffixes = { | local category_suffixes = { | ||
project_name .. "-related templates", | project_name .. "-related templates", | ||
' | 'Wikipedia-' .. project_name .. ' collaboration templates', | ||
' | 'Wikipedia-' .. project_name .. ' collaboration', | ||
project_name .. ' templates', | project_name .. ' templates', | ||
project_name, | project_name, | ||
| Line 802: | Line 803: | ||
local class_module = require('Module:Class') | local class_module = require('Module:Class') | ||
local template_code = mw.title.getCurrentTitle():getContent() | local template_code = mw.title.getCurrentTitle():getContent() | ||
local transclusion_count = require('Module:Transclusion count').fetch{args={}} | |||
if transclusion_count and transclusion_count~='' then | |||
local high_use = frame:expandTemplate{title='Template:High-use'} | |||
table.insert(auto_doc, high_use) | |||
end | |||
for _, parameter in pairs(parameters) do | for _, parameter in pairs(parameters) do | ||
parameter_name[parameter] = string.match( | parameter_name[parameter] = string.match( | ||
| Line 925: | Line 931: | ||
and (' ' .. ad_cfg.image_needed.default:format('topic', args.IM_TOPIC_CATEGORY)) | and (' ' .. ad_cfg.image_needed.default:format('topic', args.IM_TOPIC_CATEGORY)) | ||
or '' | or '' | ||
parameter_description('image-topic', | parameter_description('image-topic', ad_cfg.image_needed.topic:format(args['image-type'] or 'photograph') .. topic_cat, 'notes') | ||
end | end | ||
for _, k in ipairs(notes) do | for _, k in ipairs(notes) do | ||
| Line 1,176: | Line 1,182: | ||
table.insert(auto_doc, string.format(ad_cfg.lead, wikilink(project_link, project_name))) | table.insert(auto_doc, string.format(ad_cfg.lead, wikilink(project_link, project_name))) | ||
if args.MAIN_CAT then | if args.MAIN_CAT then | ||
table.insert(auto_doc, ' | table.insert(auto_doc, ' ' .. ad_cfg.main_cat:format(args.MAIN_CAT)) | ||
end | end | ||
addTitle('Basic usage', 3) | addTitle('Basic usage', 3) | ||