Module:WikiProject banner
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
WikiProject banners |
---|
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
- Module:Arguments (sandbox)
- Module:Check for unknown parameters (sandbox)
- Module:Message box (sandbox)
- Module:Pagetype (sandbox)
- Module:Template parameter value (sandbox)
- Module:WikiProject banner/config (sandbox)
- Module:WikiProject banner/templatepage (sandbox)
- Module:Wikitext Parsing (sandbox)
- Module:Yesno (sandbox)
Module:WikiProject banner can be used to create WikiProject banners, enabling new projects to easily create a banner to place on article talk pages, ensuring standardisation between projects. A list of all WikiProject banners using this meta-template can be found here.
As this is a meta template, it should not be transcluded directly on to talk pages when you want to tag a page. Instead, use the template provided by the WikiProject.
WikiProject banners are categorised into a subcategory of Category:WikiProject banner templates. It is not necessary to include a category link in the documentation for each project banner. Any project banners with issues are automatically added to Category:WikiProject banners with errors.
Syntax
The template can be used at varying levels of complexity, from the very simple to the extremely complicated. Simple options are listed here first, with complexity increasing down the page.
Two different types of parameters are used: formatting and display:
- Formatting parameters customise the meta-template for a particular project, defining link targets, categories, images, and text. All formatting parameters use UPPERCASE and underscores (_) instead of spaces, for example
|PROJECT=
and|NOTE_1_CAT=
. - Display parameters customise the template output for each individual article that the banner is displayed on. These are the parameters which are entered on the talk page (
|class=
,|importance=
, etc.) and they must be 'passed through' the project banner to the meta-template underneath. To 'pass' the parameterfoo
, you need to include the codefoo={{{foo|}}}
.
Parameters
Common parameters |
---|
{{#invoke:WikiProject banner|main |PROJECT = |substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> |listas={{{listas|}}} |DOC = auto |IMAGE_LEFT = |IMAGE_LEFT_SIZE = <!--|class={{{class|}}}--> <!--|auto={{{auto|}}}--> <!--|importance={{{importance|}}}--> |ASSESSMENT_CAT = |ASSESSMENT_LINK = |MAIN_TEXT = |MAIN_ARTICLE = |PORTAL = |MAIN_CAT = <!--|attention={{{attention|}}}--> |ATTENTION_CAT = <!--|infobox={{{needs-infobox|}}}--> |INFOBOX_CAT = }} |
In the examples below, a WikiProject banner will be constructed for the (currently) nonexistent WikiProject Tulips.
Simple options
PROJECT
(Required) – the name of the project without the word "WikiProject", used in a variety of contexts; first letter should usually be capitalised. Eg:Tulips
– it is assumed that page name of the banner template isBANNER_NAME={{subst:FULLPAGENAME}}
"Template:WikiProject <PROJECT>"
. If this is not the case then define the page name in this parameter. Eg:Template:Tulips project
PROJECT_LINK
– it is assumed that the project is located at"Wikipedia:WikiProject <PROJECT>"
. If this is not the case, then define the full link to the project page in this parameter. Eg:Wikipedia:WikiProject Tulips
PROJECT_NAME
– if your project is not called"WikiProject <PROJECT>"
then define the exact name of the project with this parameter.
substcheck
– this allows the template to detect if it has been substituted instead of transcluded and give an error message.substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly>
listas
(Required) – the 'listas' parameter must be passed through the template. Eg:listas={{{listas|}}}
IMAGE_LEFT
– the location of an image to use in the top-left corner of the banner. Do not include the "File:" prefix. Images used on WikiProject banners must be free images – fair use images are not permitted. Eg:Tulipa suaveolens floriade to Canberra.jpg
IMAGE_LEFT_SIZE
– the size ofIMAGE_LEFT
. Default is 80px. Eg:50px
IMAGE_RIGHT
– the location of an image to use in the top-right corner of the banner. Do not include the "File:" prefix. Images used on WikiProject banners must be free images – fair use images are not permitted. Eg:Tulipa suaveolens floriade to Canberra.jpg
IMAGE_RIGHT_SIZE
– the size ofIMAGE_RIGHT
. Default is 80px. Eg:50px
MAIN_TEXT
– the default text is "This article is within the scope of [[WikiProject {{{PROJECT_LINK}}}]], a collaborative effort to improve the coverage of {{{PROJECT or MAIN_ARTICLE}}} articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the [[Talk:{{{PROJECT_LINK}}}]] discussion and see a list of open tasks." If defined, the alternate message will be displayed.MAIN_ARTICLE
– the default article isPROJECT
; alternatively, the linked article can be changed to either a raw article title or more complicated text. Eg: (default)tulips
→ "...the coverage of tulips on Wikipedia..." or (alternate)[[tulip]]s, [[liliaceae]] and related articles
→ "...the coverage of tulips, liliaceae and related articles on Wikipedia..."
PORTAL
– if the WikiProject maintains a portal, define this parameter with the portal name. The associated image is held centrally at Module:Portal/images. Eg:Tulips
MAIN_CAT
– the default is no main category created; if defined, all pages displaying the template will be sorted into Category:MAIN_CAT
. Eg:WikiProject Tulips articles
→ Category:WikiProject Tulips articlesBOTTOM_TEXT
– if defined, contains text that will appear across the bottom of the banner and above the collapsed section (if one is present).
Example
{{#invoke:WikiProject banner|main |PROJECT = Tulips |substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> |listas={{{listas|}}} |PROJECT_LINK = Wikipedia:Somewhere about tulips |IMAGE_LEFT = Tulipa suaveolens floriade to Canberra.jpg |IMAGE_LEFT_SIZE = 50px |MAIN_ARTICLE = [[tulip]]s, [[liliaceae]] and related articles }}
- Produces:
Assessment
Many projects use the Wikipedia:Content assessment schema to grade their articles by quality and the corresponding importance scale to place their articles in order of priority. In order to implement WP:1.0, which uses a bot to automatically compile its statistics tables, you will need to follow the instructions at /Using the bot , as well as those outlined here.
class
(Required)– the class parameter must be passed through, if the quality scale is used. Eg:class={{{class|}}}
auto
the auto parameter must be passed through, if the auto assess option is needed. Eg:auto={{{auto|}}}
Projects which use bots to automatically categorise articles can have the bot add the following parameter to the project banner, which triggers the display of a small notice that the article was tagged by a bot rather than a human:|auto=stub
, for an article which includes a stub template, to indicate that it has automatically been rated Stub-class;|auto=inherit
, to show that the class has automatically been inherited from other WikiProject's assessments on the same page;|auto=length
, to show that the class has automatically been deduced from the length of the article.
AUTO_ASSESS_CAT
– if defined, all articles with the|auto=
parameter will be categorised into Category:AUTO_ASSESS_CAT
. By default, they are categorised into Category:Automatically assessedPROJECT
articles. Eg:Automatically assessed Tulip and Daffodil articles
→ Category:Automatically assessed Tulip and Daffodil articles
b1
,b2
,b3
,b4
,b5
,b6
– the six B-class criteria parameters.
importance
– if defined, enables the standard importance scale (Top, High, Mid, Low, NA, Unknown). Eg:importance={{{importance|}}}
IMPORTANCE_SCALE
– configures the importance scale, if used. The possible options are:- standard – enables the 'standard' importance scale (Top, High, Mid, Low, NA and Unknown). (This is the default behaviour.)
- inline – allows for a simple custom importance scale to be defined, generally with {{Importance mask }}.
- subpage – allows for a more complex custom importance scale to be used using a subpage called /importance.
ASSESSMENT_LINK
– the link to a WikiProject-specific quality (and/or importance) scale. If there is a page at"Wikipedia:WikiProject <PROJECTLINK>/Assessment"
then this will be used by default. To override this, you can set this parameter to no.ASSESSMENT_CAT
– articles are sorted into categories based on their quality; so "Featured Articles" on Tulips would be categorised by default into Category:FA-Class Tulips articles. To change the default, define this parameter so that featured articles are instead categorised into Category:FA-ClassASSESSMENT_CAT
. Eg:|ASSESSMENT_CAT=Liliaceae articles
→ Category:FA-Class Liliaceae articles
Example
{{#invoke:WikiProject banner|main |PROJECT = Tulips |substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> |listas={{{listas|}}} |IMAGE_LEFT = Tulipa suaveolens floriade to Canberra.jpg |QUALITY_SCALE = extended |class={{{class|}}} |auto={{{auto|}}} |importance={{{importance|}}} |ASSESSMENT_LINK = Wikipedia:WikiProject Tulips/Article grading }}
- Produces:
Alerts and notes
Built into the module is the ability to display a number of other fields that contain useful information about the article. There are also three predefined fields for:
- articles which have been automatically assessed by a bot (see above);
- articles in need of immediate attention;
- articles in need of an infobox.
The parameters are:
attention
– pass this parameter through to enable the use of the attention note. Eg:attention={{{attention|}}}
, then by including|attention=yes
on the talk page.ATTENTION_CAT
– if defined, all articles displaying the attention note will be categorised into Category:ATTENTION_CAT
. By default, they are categorised into Category:PROJECT
articles needing attention. Eg:Floridiae taskforce articles needing attention
→ Category:Floridiae taskforce articles needing attention . A value ofnone
results in no categorisation.
infobox
– pass this parameter through to enable the use of the needs-infobox note. Eg:infobox={{{needs-infobox|}}}
, then by including|needs-infobox=yes
on the talk page.INFOBOX_CAT
– if defined, all articles displaying the needs-infobox note will be categorised into Category:INFOBOX_CAT
. By default, they are categorised into Category:PROJECT
articles needing infoboxes. Eg:Floridiae taskforce articles needing infoboxes
→ Category:Floridiae taskforce articles needing infoboxes . A value ofnone
results in no categorisation.
note 1
– pass this parameter through to trigger any defined note. Eg:note 1={{{needs-photo|}}}
, then by including|needs-photo=yes
on the talk page.NOTE_1_TEXT
– the text of note 1. E.g.: This page has been marked as needing a photograph . If this is left blank there is no visual output.NOTE_1_IMAGE
– an image can be defined for each note. Remember that all images must be free, not fair-use. Eg:Gnome-dev-camera.svg
NOTE_1_CAT
– if defined, all articles displaying note 1 will be categorised into Category:NOTE_1_CAT
. Eg:Wikipedia requested photographs of Floridiae
→ Category:Wikipedia requested photographs of Floridiae
COLLAPSED
– when more than a threshold number of notes and alerts are triggered on a page, they are automagically collapsed into a show/hide box. The threshold number can be customised by setting this parameter to the maximum number of notes on a page that will not trigger the collapse. The default is 2, so if three notes are triggered on a page, they will not be collapsed, but if a fourth is also triggered, the collapse box appears. So setting|COLLAPSED=0
will always create a collapse box (if there are any notes to fill it), while|COLLAPSED=999
will never trigger a collapse box. Eg:6
COLLAPSED_HEAD
– the heading for the collapsed section; the default is More information: Eg:Additional information:
NOTE_SIZE
– the size of the image used for the icons. (It is recommended to precede the size with "x" as this specifies the height of the image instead of the width, which results in a neater banner because all rows have equal height.) The default is a height of 25px. Eg:x30px
Example
{{#invoke:WikiProject banner|main |PROJECT = Tulips |substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> |listas={{{listas|}}} |IMAGE_LEFT = Tulipa suaveolens floriade to Canberra.jpg |QUALITY_SCALE = extended |class={{{class|}}} |ASSESSMENT_LINK = Wikipedia:WikiProject Tulips/Article grading |auto={{{auto|}}} |AUTO_ASSESS_CAT = |attention={{{attention|}}} |ATTENTION_CAT = |infobox={{{needs-infobox|}}} |INFOBOX_CAT = |note 1={{{needs-photo|}}} |NOTE_1_TEXT = This page has been marked as needing a [[photograph]]. |NOTE_1_IMAGE = Gnome-dev-camera.svg |NOTE_1_CAT = Wikipedia requested photographs of Floridiae |note 2 = {{{audio-file|}}} |NOTE_2_TEXT = An [[audio file format|audio file]] has been created of this article. |NOTE_2_IMAGE = Nuvola apps arts.svg |NOTE_2_CAT = Tulips articles with audio files }}
- Produces:
WikiProject icon | Tulips Stub‐class icon icon icon icon icon | |||||||||||||||||||||||||||
|
Task forces
The module can accommodate task forces, each with its own image, links and importance scale, if desired. The following parameters are available:
tf 1
– this parameter must be passed through to enable and trigger the display of the task force section. Eg:tf 1={{{floridiae|}}}
TF_1_LINK
– the full page name of the task force's project page. Eg:Wikipedia:WikiProject Tulips/Task forces/Floridiae
TF_1_NAME
– the name of the task force. This is used as the label for the task force link (unless|TF_1_TEXT=
is used instead). Eg:the Floridiae task force
TF_1_NESTED
– if defined, a link of the form "/ [[{{{TF_1_LINK}}}|{{{TF_1_NESTED}}}]]" is added after the main project's name when the banner is collapsed inside a {{WikiProject banner shell }}. Eg:Floridiae
TF_1_TEXT
– if defined, replaces the default "This page is supported by..." text. E.g.:This page is within the scope of the [[Wikipedia:WikiProject Tulips/Task forces/Floridiae|Floridiae task force]]. New participants are always welcome!
If defined to be "none", then no output will be displayed, although appropriate categories will still be added.TF_1_IMAGE
– an image can be defined for each task force. Remember that all images must be free, not fair-use. Eg:Tulipa florenskyi 4.jpg
TF_1_QUALITY
– if defined, enables the quality categorisations for the main project (e.g.: Category:FA-Class Tulips articles) to be duplicated for the task force. The class arising from|class=
and|QUALITY_SCALE=
will be used; Eg:yes
tf 1 importance
– if defined, enables the use of a separate importance (or priority, if used) scale for the task force.Eg:tf 1 importance={{{floridiae-importance|}}}
TF_1_ASSESSMENT_CAT
(Required if quality or importance assessments are used) – the assessment category to be used for the task force-specific quality and importance assessments. Identical in syntax to|ASSESSMENT_CAT=
. Eg:Floridiae articles
→ Category:FA-Class Floridiae articlesTF_1_MAIN_CAT
– if defined, all pages displaying "tf 1" will be categorised into Category:TF_1_MAIN_CAT
. Eg:Floridiae articles
→ Category:Floridiae articlesTF_1_HOOK
– additional code to "hook" on the template only if this task force is used.
TF_SIZE
– the size of the taskforce icons. (It is recommended to precede the size with "x" as this specifies the height of the image instead of the width, which results in a neater banner because all rows have equal height.) The default is a height of 25px. Eg:x30px
Example
{{#invoke:WikiProject banner|main |PROJECT = Tulips |substcheck=<includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> |listas={{{listas|}}} |IMAGE_LEFT = Tulipa suaveolens floriade to Canberra.jpg |QUALITY_SCALE = standard |class={{{class|}}} |tf 1={{{floridiae|}}} |TF_1_LINK = Wikipedia:WikiProject Tulips/Task forces/Floridiae |TF_1_NAME = the Floridiae task force |TF_1_NESTED = Floridiae |TF_1_TEXT = |TF_1_IMAGE = Tulipa florenskyi 4.jpg |tf 1 importance={{{floridiae-importance}}} |TF_1_ASSESSMENT_CAT = Floridiae articles |TF_1_MAIN_CAT = Floridiae articles }}
- Produces:
Inactive task force
If a task force has been deemed inactive, then the following parameter and text can be used:
|TF_N_TEXT = This _PAGETYPE_ is within the scope of the [[Wikipedia:WikiProject (name of project)/(name of task force)|(name of task force)]], a task force which is currently considered to be '''[[Wikipedia:WikiProject Council/Guide#Dealing with inactive WikiProjects|inactive]]'''.
- where "N " is the number of the task force, and the project and task force names are included where indicated.
Advanced features
B-class checklist
Enables a B-class checklist. There are six official criteria (although some projects use five) that an article needs to satisfy in order to be classified as B-class. A checklist can provide a helpful aid for editors to show where an article needs improvement.
Syntax |
---|
{{#invoke:WikiProject banner|main ... |b1={{{b1|}}} |b2={{{b2|}}} |b3={{{b3|}}} |b4={{{b4|}}} |b5={{{b5|}}} |b6={{{b6|}}} }} |
Required parameters
- The six B-Class criteria:
b1
,b2
,b3
,b4
,b5
,b6
Optional parameters
B_DISPLAY_ON_START
– if set to "yes", the checklist will be displayed on every Start-class article. The default behaviour is to only display on Start-class when one or more of the parameters b1-b6 have been filled in.B_MAIN_CAT
– specifies a category to use when any of the checklist parameters are blank.B1_CAT
toB6_CAT
– specifies individual categories to use when the individual checklist parameters are blank or set to no.
Custom parameter names
The standard parameter names (i.e. b1, b2, etc.) should be passed as an alternative to any custom parameters (e.g. B-Class-1, B-Class-2, etc.). For example:
b1={{{B-Class-1|{{{b1|}}}}}}
If only the standard parameters are used, then eg: b1={{{b1|}}}
, etc. is fine.
Collapsing task forces
By default, the list of task forces will be collapsed into a show/hide box if there are more than 5 task forces. You can configure this behaviour with the following parameters:
TF_COLLAPSE
– the threshold number of task forces for them to collapse, e.g. if|TF_COLLAPSE=3
then they will collapse whenever there are more than 3 task forces.TF_HEADER
– the heading for the collapsed section. The default is Associated task forces:
To-do list
This enables a project to-do list or other similar list to be integrated into a project banner.
Syntax |
---|
|TODO_LINK = |TODO_TEXT = |TODO_TITLE = |TODO_EDITLINKS = |
There are two main parameters, |TODO_LINK=
and |TODO_TEXT=
. Only one should be used at any time. If the to-do list is located on a different page then TODO_LINK
should be used. However, if you've just got some text to include then you can use the TODO_TEXT
option instead.
If you are using |TODO_LINK=
and don't want to see the edit links at the top of the textbox, set TODO_EDITLINKS=no
.
Example
{{#invoke:WikiProject banner|main |PROJECT = Tulips |listas={{{listas|}}} |NAME = The Tulip taskforce |IMAGE_LEFT = Tulipa suaveolens floriade to Canberra.jpg |TODO_LINK = Template:To do/to do |TODO_TITLE = WikiProject Tulips To-do }}
- Produces:
WikiProject icon | Tulips | |||||||
|
Quality/importance category intersection
This feature adds categories which combine quality and importance such as Category:Start-Class High-importance Kent-related articles. It has no visible output.
It takes the following parameters:
Required parameters
QII_FORMAT
– the format of the category names. TheC
,I
andT
are replaced by the class, importance and topic respectively. For example:I C T
, e.g. Category:Mid-importance B-Class Geology articlesC T of I
, e.g. Category:C-Class Andhra Pradesh articles of Low-importanceC I T
, e.g. Category:B-Class High-importance Pornography articlesC, I T
, e.g. Category:Stub-Class, Top-importance Economics articles
Optional parameters
QII_SUPPRESS_NA
– can be set to yes to stop categories being added when either class or importance is "NA". These can also be set individually:QII_SUPPRESS_NA_CLASS
– can be set to yes to stop categories being added when class=NAQII_SUPPRESS_NA_IMPORTANCE
– can be set to yes to stop categories being added when importance=NA
QII_UNASSESSED_APPENDIX
– text to append to the class when it is "Unassessed", e.g.|QII_UNASSESSED_APPENDIX=-Class
Image-needed note
Syntax |
---|
|image-needed={{{needs-image|}}} |IM_IMAGE = |image-details={{{details|}}} |image-location={{{location|}}} |IM_LOCATION_CATEGORY = |image-topic={{{topic|}}} |IM_TOPIC_CATEGORY = |image-type={{{type|}}} |
This feature adds a note than can be used to track when articles needs an image, photograph, diagram, illustration, etc. It will populate various categories such as
It takes the following parameters:
Required parameters
image-needed
– pass through whichever parameter you are using to trigger this note, e.g.|image-needed={{{needs-image|}}}
.
Optional parameters
IM_IMAGE
– specifies the icon to be used (without the File namespace prefix); the default is ([[File:Camera-photo.svg|20px]]
).image-type
– pass through the type which can be used to accommodate other components that are needed, e.g. diagram, equation, map, etc. If this is not specified then "image or photograph" is used. E.g.|image-type={{{type|}}}
.image-details
– to allow an editor to pass more details about the required image, e.g.|image-details={{{details|}}}
.image-location
– pass this parameter through to allow an editor to specify the location of the requested image, e.g.|image-location={{{location|}}}
. This will also populate categories of the form Category:Wikipedia requested photographs in Scotland.IM_LOCATION_CATEGORY
– a default category to use when the location is not specified or leads to a non-existent category.image-topic
– pass this through to allow an editor to specify a topic area that the photograph relates to, e.g.|image-topic={{{topic|}}}
. This will populate categories such as Category:Wikipedia requested photographs of toys.IM_TOPIC_CATEGORY
– a default category in case the topic is not specified or leads to a non-existent category, e.g.|IM_TOPIC_CATEGORY=Wikipedia requested images of politics
.
Collaboration note
Syntax |
---|
|collaboration-candidate={{{**PARAMETER**|}}} |collaboration-current={{{**PARAMETER**|}}} |collaboration-past={{{**PARAMETER**|}}} |COLL_LINK = |COLL_TEXT = |COLL_IMAGE = |COLL_CANDIDATE_CAT = |COLL_CURRENT_CAT = |COLL_PAST_CAT = |
This feature enables a project collaboration system to be integrated into a project banner. The following parameters are used:
Required parameters
collaboration-candidate
– pass the parameter that will trigger the collaboration candidate note, if used, e.g.|collaboration-candidate={{{collaboration-candidate|}}}
collaboration-current
– the parameter that will trigger the current collaboration note, if used. E.g.|collaboration-current={{{collaboration|}}}
collaboration-past
– the parameter that will trigger the past collaboration note, if used. e.g.|collaboration-past={{{past-collaboration|}}}
COLL_LINK
– the full link to where the review for the particular article is held. E.g.|COLL_LINK=Wikipedia:WikiProject Paranormal/Collaboration
Optional parameters
COLL_TEXT
– the text to display in place of the default "project collaboration", e.g.|COLL_TEXT=Collaboration of the Month
COLL_IMAGE
– the name of the image to use. If not specified then is used.COLL_CANDIDATE_CAT
– if defined, pages using|candidate=yes
will be categorised into this category, e.g.|COLL_CANDIDATE_CAT=Paranormal collaboration candidates
→ Category:Paranormal collaboration candidatesCOLL_CURRENT_CAT
– if defined, pages using|current=yes
will be categorised into this category, e.g.|COLL_CURRENT_CAT=Paranormal collaborations
→ Category:Paranormal collaborationsCOLL_PAST_CAT
– if defined, pages using|past=yes
will be categorised into this category, e.g.|COLL_PAST_CAT=Past paranormal collaborations
→ Category:Past paranormal collaborations
A-class review note
Syntax |
---|
|a class={{{**PARAMETER**|}}} |ACR_SUBPAGE_LINK = |ACR_REVIEW_LINK = |ACR_PASS_CAT = |ACR_FAIL_CAT = |ACR_CURRENT_CAT = |ACR_PRELOAD = |
This feature enables an A-Class review process to be integrated into a project banner. The following parameters are used:
Required parameters
a class
– the parameter that will trigger the note. Accepted values are "pass", "fail", "current" (any capitalisation); everything else is treated as null. Eg:a class={{{A-Class|}}}
ACR_SUBPAGE_LINK
– the full link to where the review for this particular article is held. Eg:Wikipedia:WikiProject Tulips/Assessment/{{SUBJECTPAGENAME}}
ACR_REVIEW_LINK
– the full link to the main A-Class review page (where instructions etc. are held). Eg:Wikipedia:WikiProject Tulips/Review#A-Class review
Optional parameters
ACR_PASS_CAT
– pages using|a class=pass
will be categorised into this category. Eg:Successful requests for Tulips A-Class review
→ Category:Successful requests for Tulips A-Class reviewACR_FAIL_CAT
– pages using|a class=fail
will be categorised into this category. Eg:Failed requests for Tulips A-Class review
→ Category:Failed requests for Tulips A-Class reviewACR_CURRENT_CAT
– pages using|a class=current
will be categorised into this category. Eg:Current requests for Tulips A-Class review
→ Category:Current requests for Tulips A-Class reviewACR_IMAGE
– a custom image can be set, using the same syntax as for other note images. Eg:Exquisite-kfind.png
ACR_SIZE
– a custom image size can be set, using the usual note syntax. Eg:20x20px
ACR_INVALID_CAT
– pages specifying the A Class parameter without a valid SUBPAGE_LINK page existing will be categorised into this category.ACR_PRELOAD
– preload template, to be used when creating a new A-class review discussion page (example).
Additional task force categories
Sometimes it is desirable to populate additional categories when certain task forces are used. For example the |attention=
parameter is used to draw attention to articles which need immediate attention in the cycling project. Articles within the scope of the Tour de France task force populate the additional category of Category:Tour de France articles needing attention.
This can be achieved by using the following code:
{{#invoke:WikiProject banner|main ... |tf 2={{{tdf|}}} |TF_2_LINK = Wikipedia:WikiProject Cycling/Tour de France task force ... |tf 2 cat 1={{{attention|}}} |TF_2_CAT_1 = Tour de France articles needing attention |tf 2 cat 2={{{needs-infobox|}}} |TF_2_CAT_2 = Tour de France articles needing infoboxes }}
Peer review note
Syntax |
---|
|peer review={{{**PARAMETER**|}}} |old peer review={{{**PARAMETER**|}}} |peer review title={{{**PARAMETER**|}}} |PR_LINK = |PR_IMAGE = |PR_CAT = |PR_OLD_CAT = |PR_INVALID_CAT = |
This feature enables a peer review process to be integrated into a project banner. The following parameters are used:
Required parameters
peer review
– the parameter that will trigger the active peer review note; should be passed through, e.g.|peer review={{{peer-review|}}}
old peer review
– the parameter that will trigger the old peer review note; should be passed through, e.g.|old peer review={{{old-peer-review|}}}
PR_LINK
– the full link to where the review for this particular article is held, e.g.|PR_LINK=Wikipedia:WikiProject Tulips/Assessment
Optional parameters
PR_IMAGE
– the name of the image to use. If not specified then is used.PR_CAT
– if defined, pages using|peer review=yes
will be categorised into this category, e.g.|PR_CAT=Requests for Tulips peer review
→ Category:Requests for Tulips peer reviewPR_OLD_CAT
– if defined, pages using|old peer review=yes
will be categorised into this category.peer review title
– If the page has been moved since it was reviewed, pass this parameter to specify the old page title (the one the review was archived under) to make the link point correctly to the review.PR_INVALID_CAT
– if defined, pages without a valid existing peer review page will be categorised into this category.
Custom masks
The module uses a mask to normalise the values given to the |class=
parameter, to ensure that invalid inputs are discarded (e.g. |class=cheesecake
) and that equivalent inputs appear the same (e.g. |class=FA
and |class=fA
). This mask effectively controls which extended assessment scale values are accepted by the template (e.g. "Template-Class", "Redirect-Class", etc.). Projects which want to use more obscure assessment classes (e.g. "Future-Class", "Bplus-Class", etc.) or to not use all of the standard classes (e.g. not using "C-Class") can define their own custom mask, which will override the default. To achieve this, create the mask template in the /class subpage of your project banner template and set |QUALITY_CRITERIA=custom
. Note that this will remove the project from project-independent quality assessments, and so no assessments will be inherited from other projects.
Inactive WikiProject banners
A number of WikiProjects have been identified as inactive or defunct (see Category:Inactive WikiProjects). In this case, the project banner can be given a less prominent form. Keeping an inactive project's template on relevant talkpages helps any group of users who later wishes to revive the project. This template will auto-categorize the project banner into Category:Inactive WikiProject banners.
The easiest way to convert a banner template to an inactive state, is to replace main with inactive.
Parameters
- The only required parameter is
|PROJECT=
- the name of the WikiProject (but without the word "WikiProject") - An additional parameter
|PROJECT_STATUS=
can be used to identify the status of the inactive project. Currently recognised values are inactive and defunct. The default is inactive. - All the other parameters can and should be retained, as this will make it easier to "revive" the project in the future.
Examples
{{#invoke:WikiProject banner|inactive |PROJECT = Extreme sports }}
- produces:
- When inside a banner shell the result is:
It is of interest to the following WikiProjects:
{{#invoke:WikiProject banner|inactive |PROJECT = Policy and Guidelines |PROJECT_STATUS = defunct }}
- produces:
- When inside a banner shell the result is:
It is of interest to the following WikiProjects:
See also
- {{WikiProject banner shell }} – template to combine multiple WikiProject Banners
- {{WPBannerDoc }} – convenience template that generates standardised parameter documentation for use on the /doc page
- Wikipedia:WikiProject Council/Guide § Tagging pages with WikiProject banners – guideline about tagging articles for a project
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Subpages of this module.
require('strict') localp={} localsandbox-- = '/sandbox' -- BE SURE TO COMMENT OUT this definition when deploying to live localcfg=mw.loadData('Module:WikiProject banner/config'..(sandboxor'')) localauxiliary=cfg.auxiliary_module..(sandboxor'') localargs_module=require('Module:Arguments') localmbox=require('Module:Message box').main localyesno=require('Module:Yesno') localframe=mw.getCurrentFrame() locallang=mw.getLanguage(cfg.language) localcurrent_title=mw.title.getCurrentTitle() localparameter_format=function(parameter,value) returnframe:expandTemplate{title='para',args={parameter,valueor''}} end localwikilink=function(link,display) iflinkthen returndisplayand'[['..link..'|'..display..']]'or'[['..link..']]' else returndisplayor'' end end localdisplay_error=function(text) localspan=mw.html.create('div') :addClass('error') :wikitext(text) returntostring(span) end localimage=function(image_name,size,alt,position) returnimage_nameand'[[File:' ..image_name ..(sizeand'|'..sizeor'') ..(positionand'|'..positionor'') ..(altand'|alt='..altor'') ..']]' end localif_exists=function(target,fallback)-- function to add wikilink if target exists localtitle=mw.title.new(target) iftitleandtitle.existsthen returnwikilink(target) else returnfallbackortarget end end localimportance_mask=function(raw_importance,scale,banner_name,pagetype,class) --------------------------- -- Importance mask -------- --------------------------- localimportance ifscale=='inline'then-- pass importance without change importance=raw_importance elseifscale=='subpage'then localcustom_mask=banner_name:subPageTitle('importance') ifcustom_mask.existsand#custom_mask:getContent()>1then-- pass to custom importance mask importance=mw.text.trim(frame:expandTemplate{ title=custom_mask.prefixedText, args={ importance=raw_importanceor'¬', class=class, pagetype=pagetype } }) end elseifraw_importancethen-- standard importance scale importance=cfg.importance.na ifpagetype=='article'orpagetype=='set index article'orpagetype=='redirect'orpagetype=='draft'then localmask=cfg.importance.mask ifmask[raw_importance:lower()]then-- valid importance specified importance=mask[raw_importance:lower()] elseifpagetype=='article'orpagetype=='set index article'then-- unspecified or invalid importance, use "Unknown" for articles importance=cfg.importance.unknown end end end returnimportance end --------------------------- -- Quality class mask ----- --------------------------- p.readarticleclass=function(options,page)-- used by _main and also Module:Banner shell page=pageorcurrent_title.prefixedText localget_parameter_value=require('Module:Template parameter value').getParameter localsuccess,result=get_parameter_value(page,cfg.banner_shell.redirects,'class',options) returnsuccessandresult -- returns FALSE if banner shell template does not exist on page -- returns BLANK if class parameter is not defined or is defined blank -- otherwise returns class parameter end p.class_mask=function(class,title,FQS,pagetype,article) localresolveFQSgrade=function(class) returnFQSandlang:ucfirst(class)or'NA' end localout title=titleormw.title.getCurrentTitle() localns=title.namespace class=class:match('^%s*(.-)%s*$'):lower() ifpagetype=='redirect'orpagetype=='soft redirect'then out=resolveFQSgrade('redirect') elseifpagetype=='disambiguation page'then out=resolveFQSgrade('disambig') elseifarticleorpagetype=='article'orpagetype=='set index article'then ifpagetype=='set index article'then out='List' elseifclass=='start'orclass=='stub'then-- Ucfirst out=lang:ucfirst(class) elseifclass=='b'orclass=='c'orclass=='fa'orclass=='fl'orclass=='a'orclass=='ga'then-- Upper-case out=class:upper() elseifclass=='list'orclass=='sia'orclass=='si'orclass=='sl'then-- List out='List' else out=''-- unassessed end elseifns==7orns==711then-- File talk ifclass=='fm'then out='FM' else out=resolveFQSgrade('file') end else localgrade=cfg.quality.ns_to_class[ns]or'NA' out=resolveFQSgrade(grade) end returnout end localpage_assessment=function(project,class,importance)-- add PageAssessments parser function localassessment=table.concat({project,classor'',importanceor''},'|') frame:preprocess('{{#assessment:'..assessment..'}}') end localbubble=function(text,conflict,style) localout=mw.html.create('span') :addClass('wpb-header-bubbles') :addClass(style) :addClass(conflictand'conflict'ornil) :wikitext(text) returntostring(out) end p._main=function(args,raw_args,demo_page,banner_name,inactive) --------------------------- -- Initialise parameters -- --------------------------- localproject=args.PROJECTor'PROJECT' localproject_name=args.PROJECT_NAMEor'WikiProject '..project localproject_link=mw.title.new(args.PROJECT_LINKor'Wikipedia:'..project_name) localpagetype=demo_page==trueand'article'orrequire('Module:Pagetype')._main({ page=demo_page, dab='disambiguation page', sia='set index article', draft='draft' }) localarticle=pagetype=='article'orpagetype=='set index article' localrows,nested_ratings,task_forces,notes,categories,taskforce_categories={},{},{},{},{},{} localadd_category=function(category,key) ifcategoryandcategory~='none'then table.insert(categories,{category=category,key=key}) end end localparse_pt=function(text)-- function to replace _PAGETYPE_ with the actual page type localptype=articleand'article'orpagetype-- display "article" for articles otherwise page type returntextandtext:gsub('_PAGETYPE_',ptype) end forarg_name,arg_valueinpairs(args)do localtf_match=mw.ustring.match(arg_name,'^tf (%d+)$') localnote_match=mw.ustring.match(arg_name,'^note (%d+)$') iftf_matchandyesno(arg_value,true)then table.insert(task_forces,tf_match) elseifnote_matchandyesno(arg_value,true)then table.insert(notes,note_match) else localtf,cat=mw.ustring.match(arg_name,'^tf (%d+) cat (%d+)$') iftfandyesno(arg_value,true)then ifnottaskforce_categories[tf]then-- initialise table taskforce_categories[tf]={} end table.insert(taskforce_categories[tf],cat) end end end table.sort(task_forces,function(x,y)returntonumber(x)<tonumber(y)end) table.sort(notes,function(x,y)returntonumber(x)<tonumber(y)end) localassessment_category=function(cat,name) ifcatthen returncat:gsub(' articles','')-- remove "articles" from category else returnnameor'' end end localassessment_cat=assessment_category(args.ASSESSMENT_CAT,project) --------------------------- -- Location warning ------- --------------------------- localwarning='' ifnotcurrent_title.isTalkPageandnotdemo_pagethen localtext=cfg.namespace_warning.text:format( current_title.talkPageTitle.fullText, parameter_format('category','no') ) localsortkey=current_title.namespace==10andcfg.namespace_warning.sortkey_on_template_pageorcfg.namespace_warning.sortkey ifcurrent_title.namespace==10then-- on the Template namespace text=text..' '..cfg.namespace_warning.on_template_page:format( parameter_format('BANNER_NAME'), current_title.prefixedText ) end warning=mbox('ombox',{ image='[[File:'..cfg.namespace_warning.image..'|40px]]', type=cfg.namespace_warning.type_, text=parse_pt(text) }) ifnotcurrent_title.subjectPageTitle:inNamespace(2)then add_category(cfg.namespace_warning.categories,sortkey) end end --------------------------- -- Substitution warning --- --------------------------- ifargs.substcheck=='SUBST'then localtext=cfg.subst_warning.text:format( project_name, '<code>{{'..banner_name.prefixedText..'}}</code>' ) warning=warning..mbox('ombox',{ image='[[File:'..cfg.subst_warning.image..'|40px]]', type=cfg.subst_warning.type_, text=text, })..cfg.subst_warning.categories end --------------------------- -- Primary image/text ----- --------------------------- localprimary_image=function(image_name,size) localcell=mw.html.create('td') ifimage_nameandimage_name~=''then cell:addClass('mbox-image wpb-image') :wikitext(image(image_name,size,cfg.image.alt)) else cell:addClass('mbox-empty-cell') end returncell end localportal=args.PORTAL localportal_box=portalandframe:expandTemplate{title='Portal',args={portal}}or'' localmain_text=portal_box..parse_pt(args.MAIN_TEXTorcfg.main_text:format( project_link.prefixedText, project_name, args.MAIN_ARTICLEandif_exists(args.MAIN_ARTICLE)orif_exists(project,project..' articles'), project_link.talkPageTitle.prefixedText )) localimage_left_size=args.IMAGE_LEFT_SIZEorcfg.image.default_size localmetadata=function(class,data) returnmw.html.create('span') :addClass(class) :wikitext(data) end localtext_cell=mw.html.create('td') :addClass('mbox-text') :wikitext(main_text) :tag('span') :addClass('metadata wpb-metadata') :node(metadata('wpb-project',project)) :node(metadata('wpb-project_link',project_link.prefixedText)) :node(metadata('wpb-banner_name',banner_name.prefixedText)) :node(metadata('wpb-assessment_cat',assessment_cat)) :done() localprimary_row=mw.html.create('tr') :node(primary_image(args.IMAGE_LEFT,image_left_size)) :node(text_cell) :node(primary_image(args.IMAGE_RIGHT,args.IMAGE_RIGHT_SIZEorcfg.image.default_size)) table.insert(rows,primary_row) --------------------------- -- Banner shell checks ---- --------------------------- localtitle=demo_pageanddemo_page~=trueandmw.title.new(demo_page)orcurrent_title localarticle_class=p.readarticleclass({ignore_subtemplates=true},title.prefixedText) ifarticle_classthen-- banner shell exists localspecial_chars='([%%%(%)%.%+%-%*%?%[%]%^%$])' localbanner_name_escaped=banner_name.text localpage_content=require('Module:Wikitext Parsing').PrepareText(title:getContent())-- get content of current page localcontent_without_shell forcaptureinmw.ustring.gmatch(page_content,'%b{}')do-- look for possible templates on page for_,redirectinipairs(cfg.banner_shell.redirects)do ifmw.ustring.find(capture,'^{{%s*'..redirect..'%s*[|}].*}}$')then-- found a banner shell banner_name_escaped=banner_name_escaped:gsub(special_chars,'%%%1')-- escape each special character capture=capture:gsub(special_chars,'%%%1') content_without_shell=mw.ustring.gsub(page_content,capture,'')-- remove banner shell content from page content end ifcontent_without_shellthenbreakend end ifcontent_without_shellthenbreakend end localtemplate_outside_shell ifcontent_without_shellandmw.ustring.find(content_without_shell,'{{%s*'..banner_name_escaped..'%s*[|}]')then-- found banner template outside of the shell add_category(cfg.banner_shell.category.outside_shell) end else-- no banner shell on page ifarticlethen add_category(cfg.banner_shell.category.no_banner_shell_articles) elseiftitle.namespace==3then--User talk namespace for_,userinipairs(cfg.banner_shell.valid_users)do ifstring.find(title.rootText,user)then add_category(cfg.banner_shell.category.no_banner_shell) end end elseiftitle.namespace~=2then--User namespace add_category(cfg.banner_shell.category.no_banner_shell) end end --------------------------- -- Quality assessment ----- --------------------------- localassessment_link=args.ASSESSMENT_LINK ifnotassessment_linkthen localfallback=mw.title.new(project_link.prefixedText..'/Assessment') assessment_link=fallback.existsandfallback.prefixedText elseifassessment_link=='no'then assessment_link=nil end localcheck_fallbacks=function(class,category) ifarticleorargs.QUALITY_CRITERIA=='custom'then-- no fallbacks for articles or projects with custom quality scales returnclass else-- check fallbacks for non-article classes localnew_class=class localcategory_exists=function(class) localcat=mw.title.new(cfg.quality.assessment_category:format(class,category..' '..(articleand'articles'or'pages'))) returncat.existsand#cat:getContent()>0-- check if category exists and is not blank end ifclass=='FM'andnotcategory_exists('FM')then new_class='File'-- fall back to File-class if FM category does not exist end ifnotcategory_exists(new_class)then new_class='NA'-- use NA for non-article pages if category does not exist end returnnew_class end end localclass=raw_args.class ifclassthen-- banner gives quality ratings article_class=article_classandp.class_mask(article_class,title,false,pagetype,article) ifargs.QUALITY_CRITERIA=='custom'then-- project has opted out of standard assessment scale and uses a custom mask localcustom_mask=banner_name:subPageTitle('class') ifcustom_mask.existsand#custom_mask:getContent()>1then raw_args.demo_page=demo_page-- send demo_page to custom mask class=mw.text.trim(frame:expandTemplate{ title=custom_mask.prefixedText, args=raw_args }) ifclass==''andarticle_classandarticle_class~=''then-- if unassessed and article class exists, check if it can be inherited localnew_arg_table={} forarg,valinpairs(raw_args)do-- construct new argument table to send to custom mask new_arg_table[arg]=val end new_arg_table.class=article_class-- replace class with inherited class localarticle_class_normalised=mw.text.trim(frame:expandTemplate{ title=custom_mask.prefixedText, args=new_arg_table }) ifarticle_class_normalisedandarticle_class_normalised~=''then class=article_class_normalised-- inherit class from article_class normalised by custom mask else article_class=nil-- effectively no article_class for this banner end end end else class=p.class_mask(class,title,true,pagetype,article) end localcheck_redundant=function() ifraw_args.class~=''andargs.QUALITY_CRITERIA~='custom'then-- banner has a non-blank class value which is ignored add_category(cfg.banner_shell.category.redundant_class) end end class=check_fallbacks(class,assessment_cat) localshow=false-- hide quality class in project banner by default ifarticle_classthen-- banner shell exists ifclass==''then-- local class is blank class=check_fallbacks(article_class,assessment_cat)-- check fallbacks again now that class may have changed check_redundant() elseifclass==article_classthen-- local class matches article class check_redundant() elseifarticle_class==''then-- local class defined and no article class defined show=true add_category(cfg.banner_shell.category.no_quality_rating) ifargs.QUALITY_CRITERIA~='custom'then warning=warning..display_error(cfg.banner_shell.piqa_warning) end elseifarticle_class=='FM'andargs.QUALITY_CRITERIA~='custom'then class=check_fallbacks('FM',assessment_cat) check_redundant() elseifnotarticleandclass~='FM'then-- article class and local class are both non-article classes check_redundant() elseifargs.QUALITY_CRITERIA=='custom'then-- project uses custom criteria and class differs show=true-- show quality class in project banner else-- article class exists and differs from local class show='conflict' add_category(cfg.banner_shell.conflict.category2:format(class,article_class)) end else-- banner shell does not exist show=true end localcategory=(class==''and'Unassessed'orclass..'-Class')..' '..assessment_cat..' '..(articleand'articles'or'pages') ifshowthen-- quality rating shown in banner localrating ifarticlethen rating=class==''andcfg.quality.not_yetorcfg.quality.rated:format(class) else rating=cfg.quality.not_required end localscale=args.QUALITY_CRITERIA=='custom' andassessment_link andcfg.quality.project_scale:format(wikilink(assessment_link..'#'..lang:ucfirst(cfg.quality.name),cfg.quality.name)) orcfg.quality.default_scale localquality_rating=show=='conflict' andcfg.banner_shell.conflict.text orcfg.quality.rating:format(rating,scale) localcssClass='class-'..(class==''and'unassessed'orclass:lower()) localclass_row=mw.html.create('tr') :tag('td') :addClass('assess') :addClass(cssClass) :addClass(show=='conflict'and'conflict'ornil) :wikitext(wikilink(':Category:'..category,class==''and'???'orclass)) :done() :tag('td') :addClass('mbox-text') :attr('colspan','2') :wikitext(parse_pt(quality_rating)) :done() table.insert(rows,class_row) table.insert( nested_ratings, 1, bubble(class==''and'Unassessed'or(class..'‐class'),show=='conflict',cssClass) ) end add_category(category) end ifargs.HOOK_ASSESSthen table.insert(rows,args.HOOK_ASSESS) end ifraw_args.b1orraw_args.b2orraw_args.b3orraw_args.b4orraw_args.b5orraw_args.b6then localb_checklist=require(auxiliary).b_checklist(args,raw_args,class,demo_page,assessment_link) table.insert(rows,b_checklist) end --------------------------- -- Importance assessment -- --------------------------- localimportance=importance_mask(raw_args.importanceorraw_args.priority,args.IMPORTANCE_SCALE,banner_name,pagetype,class) localimportance_name=args.IMPNor(raw_args.priorityand'priority'orcfg.importance.default_name) ifimportancethen-- banner gives importance ratings localcategory=importance..'-'..importance_name..' '..assessment_cat..' '..(importance=='NA'and'pages'or'articles') ifimportance~='NA'then-- display importance rating localrating=importance=='Unknown'andcfg.importance.not_yetorcfg.importance.rated:format(importance,importance_name) localscale_name=cfg.importance.scale:format(importance_name) localscale=assessment_link andcfg.importance.project_scale:format(assessment_link..'#'..lang:ucfirst(scale_name),scale_name) orcfg.importance.default_scale localimportance_rating=parse_pt(cfg.importance.rating:format(rating,scale)) localcssClass='import-'..importance:lower() localimportance_row=mw.html.create('tr') :tag('td') :addClass('assess') :addClass(cssClass) :wikitext(wikilink(':Category:'..category,importance=='Unknown'and'???'orimportance)) :done() :tag('td') :addClass('mbox-text') :attr('colspan','2') :wikitext(importance_rating) :done() table.insert(rows,importance_row) ifimportance~='Unknown'then-- importance is not NA or Unknown table.insert( nested_ratings, bubble(importance..'‐'..importance_name,false,cssClass) ) end end add_category(category) end ifclassorimportancethen page_assessment(project,class,importance) end ifargs.HOOK_IMPORTANCEthen table.insert(rows,args.HOOK_IMPORTANCE) end ifargs.QII_FORMATthen add_category(require(auxiliary).quality_importance_insection(args,class,importance,importance_name,assessment_cat,article)) end --------------------------- -- Collapsing sections ---- --------------------------- localcollapse_section=function(collapse,new_rows,header) ifcollapsethen localheader_row=mw.html.create('tr') :tag('th') :attr('colspan','3') :addClass('wpb-collapsed-head') :wikitext(header) :done() localblank_row=mw.html.create('tr') :tag('td') :addClass('mbox-image wpb-gutter') :css('min-width',image_left_size) :tag('span') :addClass('wpb-iefix') :wikitext('/ ') :done()--TO FIX IE :done() :tag('td'):done() :tag('td'):done() localcollapsed_rows=mw.html.create('table') :addClass('mw-collapsible mw-collapsed') :node(header_row) :node(blank_row) for_,rowinipairs(new_rows)do collapsed_rows:node(row) end localcollapsed_section=mw.html.create('tr') :tag('td') :attr('colspan','3') :addClass('wpb-collapsed-notes') :node(collapsed_rows) :done() table.insert(rows,collapsed_section) else for_,rowinipairs(new_rows)do table.insert(rows,row) end end end --------------------------- -- Task forces ------------ --------------------------- localnested_tf,taskforce_output={},{} localtf_default_size=args.TF_SIZEorcfg.task_force.default_size for_,kinipairs(task_forces)do localtf_prefix='TF_'..k..'_' localtf_assessment_cat=assessment_category( args[tf_prefix..'ASSESSMENT_CAT'], args[tf_prefix..'NAME'] ) ifyesno(args[tf_prefix..'QUALITY'])andclassthen localtf_class=check_fallbacks(class,tf_assessment_cat) add_category((tf_class==''and'Unassessed'ortf_class..'-Class')..' '..tf_assessment_cat..' '..(articleand'articles'or'pages')) end localtf_importance,tf_importance_category ifraw_args['tf '..k..' importance']then tf_importance=importance_mask(raw_args['tf '..k..' importance'],args.IMPORTANCE_SCALE,banner_name,pagetype,class) iftf_importance=='Unknown'andyesno(args.INHERIT_IMPORTANCE)then tf_importance=importance end tf_importance_category=tf_importance..'-'..importance_name..' '..tf_assessment_cat..' '..(tf_importance=='NA'and'pages'or'articles') add_category(tf_importance_category) end ifargs[tf_prefix..'TEXT']~='none'then localportal=args[tf_prefix..'PORTAL']andframe:expandTemplate{ title='Portal', args={args[tf_prefix..'PORTAL'],height='15',margin='0'} }or'' localtext='' localtf_text=args[tf_prefix..'TEXT']orargs.TF_TEXT iftf_textthen text=portal..tf_text :gsub('_NAME_',args[tf_prefix..'NAME']or'') :gsub('_LINK_',args[tf_prefix..'LINK']or'') :gsub('_IMPORTANCE_',tf_importanceor'') else localtf_importance_text=tf_importance andtf_importance~='NA' andtf_importance~='Unknown' and' '..cfg.task_force.importance:format( wikilink( ':Category:'..tf_importance_category, tf_importance..'-'..importance_name ) )or'' text=portal..cfg.task_force.text:format( wikilink(args[tf_prefix..'LINK'],args[tf_prefix..'NAME']), tf_importance_text ) end localtf_size=args[tf_prefix..'SIZE']ortf_default_size localtf_image='' ifargs[tf_prefix..'IMAGE']then tf_image=image(args[tf_prefix..'IMAGE'],tf_size,cfg.task_force.icon_alt,'center') end localtaskforce=mw.html.create('tr') :tag('td') :wikitext(tf_image) :done() :tag('td') :addClass('mbox-text') :attr('colspan','2') :wikitext(parse_pt(text)) :done() table.insert(taskforce_output,taskforce) end ifargs[tf_prefix..'HOOK']then table.insert(taskforce_output,args[tf_prefix..'HOOK']) end ifargs[tf_prefix..'QII_FORMAT']then add_category(require(auxiliary).quality_importance_insection(args,class,tf_importance,importance_name,tf_assessment_cat,article,tf_prefix)) end ifargs[tf_prefix..'NAME']then page_assessment(project..'/'..args[tf_prefix..'NAME'],class,tf_importance) end ifargs[tf_prefix..'MAIN_CAT']then add_category(args[tf_prefix..'MAIN_CAT']) end ifargs[tf_prefix..'NESTED']then table.insert(nested_tf,wikilink(args[tf_prefix..'LINK'],args[tf_prefix..'NESTED'])) end for_,cinipairs(taskforce_categories[k]or{})do-- add additional taskforce categories add_category(args[tf_prefix..'CAT_'..c]) end end ifargs.HOOK_TFthen table.insert(taskforce_output,args.HOOK_TF) end localthreshold=tonumber(args.TF_COLLAPSE)or(args.TF_HEADERandcfg.task_force.lower_threshold)orcfg.task_force.upper_threshold collapse_section( #taskforce_output>threshold, taskforce_output, args.TF_HEADERorcfg.task_force.header ) --------------------------- -- Notes ------------------ --------------------------- localnote_output={} localnote_default_size=args.NOTE_SIZEorargs.NOTE_1_SIZEorcfg.note.default_size localrender_note=function(note_args)--text, image_name, size, category, sort_prefix localsort=note_args.sort_prefixandnote_args.sort_prefix..current_title.text add_category(note_args.category,sort) add_category(note_args.category2,sort) ifnote_args.textthen localnote_image=image( note_args.image_name, note_args.sizeornote_default_size, cfg.note.icon_alt, 'center' ) localnew_note=mw.html.create('tr') :tag('td') :css('background',note_args.background) :wikitext(note_image) :done() :tag('td') :addClass('mbox-text') :attr('colspan','2') :wikitext(parse_pt(note_args.text)) :done() table.insert(note_output,new_note) ifnote_imagethen localicon=mw.html.create('span') :addClass('wpb-header-bubbles') :wikitext('[[File:'..note_args.image_name..'|'..cfg.note.header_icon..'|'..parse_pt(note_args.text)..'|alt=icon]]') table.insert(nested_ratings,tostring(icon)) end end end localauto=false localauto_arg=args.autoandargs.auto:lower() if(auto_arg=='yes'orauto_arg=='stub')andclass=='Stub'then auto='stub' elseif(auto_arg=='inherit'orauto_arg=='length')andclassandclass~=''then auto=auto_arg end ifautothen localauto_cat=args.AUTO_ASSESS_CATorcfg.auto.default_cat:format(project) localauto_text=cfg.auto.assessed:format( cfg.auto[auto],-- method of automatic assessment parameter_format('auto') ) localsort_prefix ifauto=='stub'then sort_prefix='S' elseifauto=='length'then sort_prefix='L' elseifauto=='inherit'then localsort_codes=cfg.auto.sort_codes sort_prefix=sort_codes[class]orcfg.auto.default_sort_code end render_note{ text=auto_text, image_name=cfg.auto.icon, category=auto_cat, sort_prefix=sort_prefix } end ifyesno(args.attention,true)then localattention_cat=args.ATTENTION_CATorcfg.attention.default_cat:format(project) render_note{ text=cfg.attention.text, image_name=cfg.attention.icon, category=attention_cat } end ifyesno(args.infobox,true)then localinfobox_cat=args.INFOBOX_CATorcfg.infobox.default_cat:format(project) render_note{ text=cfg.infobox.text, image_name=cfg.infobox.icon, category=infobox_cat } end for_,kinipairs(notes)do localnote_prefix='NOTE_'..k..'_' render_note{ text=parse_pt(args[note_prefix..'TEXT']), image_name=args[note_prefix..'IMAGE'], size=args[note_prefix..'SIZE'], category=args[note_prefix..'CAT'] } end ifyesno(args['image-needed'],true)then localimage_needed_args=require(auxiliary).image_needed(args) render_note(image_needed_args) end ifyesno(args['collaboration-candidate'],true)oryesno(args['collaboration-current'],true)oryesno(args['collaboration-past'],true)then localcollaboration_args=require(auxiliary).collaboration(args,current_title) render_note(collaboration_args.candidate) render_note(collaboration_args.current) render_note(collaboration_args.past) end ifyesno(args['a class'],true)then locala_class_args=require(auxiliary).a_class(args,lang) render_note(a_class_args) end ifyesno(args['peer review'],true)oryesno(args['old peer review'],true)then localpeer_review_args=require(auxiliary).peer_review(args,current_title) render_note(peer_review_args.current) render_note(peer_review_args.past) end localnote_count=#note_output ifargs.HOOK_NOTEthen table.insert(note_output,args.HOOK_NOTE) localhook_collapsed=0 ifargs.HOOK_COLLAPSEDthen localsuccess,result=pcall(mw.ext.ParserFunctions.expr,args.HOOK_COLLAPSED) hook_collapsed=successandtonumber(result)or0 ifargs.HOOK_COLLAPSED=='auto'then hook_collapsed=1 end end note_count=note_count+hook_collapsed end collapse_section( note_count>(tonumber(args.COLLAPSED)orcfg.note.threshold), note_output, args.COLLAPSED_HEADorcfg.note.header ) --------------------------- -- Bottom text ------------ --------------------------- ifargs.HOOK_BOTTOMthen table.insert(rows,args.HOOK_BOTTOM) end ifargs.TODO_LINKorargs.TODO_TEXTthen localtodolist=require(auxiliary).todo_list(args,frame) table.insert(rows,todolist) end ifargs.BOTTOM_TEXTthen localbottom_text=mw.html.create('tr') :tag('td') :attr('colspan','3') :wikitext(parse_pt(args.BOTTOM_TEXT)) :done() table.insert(rows,bottom_text) end ifargs.MAIN_CATthen add_category(args.MAIN_CAT) end --------------------------- -- Nested display --------- --------------------------- ifargs.HOOK_NESTEDthen localhook_nested=args.HOOK_NESTED:gsub('^ / ','')-- remove initial slash, will be added later table.insert(nested_tf,hook_nested) end localnested_tf_str='' if#nested_tf>0then nested_tf_str=tostring(mw.html.create('span') :addClass('wpb-nested-task-force') :wikitext(': '..table.concat(nested_tf,' / ')) ) end localnested_ratings_str=#nested_ratings>0andtable.concat(nested_ratings,' ')or'' ifargs.HOOK_NESTED_ASSESSthen nested_ratings_str=nested_ratings_str..tostring(mw.html.create('span') :addClass('wpb-header-bubbles') :wikitext(args.HOOK_NESTED_ASSESS) ) end localheader_row=mw.html.create('tr') :addClass('wpb-header') :tag('td') :addClass('wpb-header-icon') :wikitext(image(args.IMAGE_LEFT,cfg.image.header_size,cfg.image.alt)) :done() :tag('td') :addClass('wpb-header-combined') :wikitext(wikilink(project_link.prefixedText,project)..nested_tf_str..' '..nested_ratings_str) :done() --------------------------- -- Prepare categories ----- --------------------------- localcategories_formatted='' ifdemo_pageanddemo_page~=truethen-- for testing purposes localcategory_list=mw.html.create('ul') for_,catinipairs(categories)do localitem=mw.html.create('li') :wikitext(wikilink(':Category:'..cat.category,cat.category)) category_list:node(item) end localcategory_box=mw.html.create('div') :addClass('wpb-category-box') :wikitext('Categories:') :node(category_list) categories_formatted=tostring(category_box) elseifnotdemo_pagethen localcategories_linked={} for_,catinipairs(categories)do localcat_link=wikilink('Category:'..cat.category,cat.key) table.insert(categories_linked,cat_link) end categories_formatted=table.concat(categories_linked) end --------------------------- -- Make banner ------------ --------------------------- localbanner_rows=mw.html.create('table') for_,rowinipairs(rows)do banner_rows:node(row) end localbanner=mw.html.create('table') :addClass('tmbox tmbox-notice mw-collapsible innercollapse wpb wpb-table') :addClass(inactiveandcfg.inactive.classornil) :node(header_row) :tag('tr') :tag('td') :addClass('mbox-text wpb-main') :attr('colspan','2') :node(banner_rows) :allDone() localtstyle=frame:extensionTag('templatestyles','',{src='Module:Message box/tmbox.css'}).. frame:extensionTag('templatestyles','',{src='Module:WikiProject banner'..(sandboxor'')..'/styles.css'}) returnwarning..tstyle..tostring(banner)..categories_formatted,note_count,#taskforce_output,assessment_link end localinitialise=function(args,raw_args,inactive_status) --------------------------- -- Initialise arguments --- --------------------------- localparent_args=args_module.getArgs(frame,{parentOnly=true}) localcategory=parent_args.categoryorargs.categoryortrue localdemo_page=parent_args.demo_page localconfig,project ifargs.projectthen-- check for config page project=args.project localconfig_file=mw.title.new('Template:WikiProject '..args.project..'/config') ifconfig_file.existsthen config=mw.loadJsonData(config_file.fullText) else returnnil end end ifconfigthen-- use config file ifparent_args.taskforcethen-- split comma-separated list fortaskforceinmw.text.gsplit(parent_args.taskforce,',%s*')do parent_args[taskforce]='yes' end end args,raw_args=require(auxiliary).map_config(config,parent_args)-- map parameters from config page args.PROJECT=project end localon_template_page=false localbanner_name=mw.title.new(args.BANNER_NAMEor'Template:WikiProject '..(args.PROJECTor'PROJECT')) ifnotdemo_pagethen ifyesno(category,true)then on_template_page=current_title.rootPageTitle==banner_name.rootPageTitle else demo_page=true end end localproject_name=args.PROJECT_NAMEor'WikiProject '..(args.PROJECTor'PROJECT') localunknown_parameters='' ifbanner_name.existsandnotdemo_pagethen-- check for unknown parameters localparameters={} forparameterinbanner_name:getContent():gmatch('{{{([^|}]+)')do table.insert(parameters,parameter) end parameters.showblankpositional="1" localcheck_for_unknown=require('Module:Check for unknown parameters')._check localunknowns=check_for_unknown(parameters,parent_args) ifunknownsandunknowns~=''then-- there are some unknown parameters parameters.preview=cfg.unknown_parameters.preview:format(wikilink(banner_name.fullText)) localunknown_category=cfg.unknown_parameters.tracking:format(project_name) ifnotmw.title.new(unknown_category).existsthen unknown_category=cfg.unknown_parameters.default end parameters.unknown=unknown_categoryand'[['..unknown_category..'|_VALUE_]]'or'' unknown_parameters=check_for_unknown(parameters,parent_args) end end ifon_template_pagethen localtemplatepage=require('Module:WikiProject banner/templatepage'..(sandboxor'')).templatepage returntemplatepage(args,raw_args,inactive_status,config) else returnunknown_parameters ..p._main(args,raw_args,demo_page,banner_name,inactive_statusandtrueorfalse),nil-- nil to disregard subsequent returned values end end p.main=function(frame) localargs=args_module.getArgs(frame,{frameOnly=true}) localraw_args=args_module.getArgs(frame,{frameOnly=true,removeBlanks=false}) returninitialise(args,raw_args) end --------------------------- -- Inactive projects ------ --------------------------- p.inactive=function(frame) localargs=args_module.getArgs(frame,{frameOnly=true}) localproject_name=args.PROJECT_NAMEor'WikiProject '..(args.PROJECTor'PROJECT') localproject_link=mw.title.new(args.PROJECT_LINKor'Wikipedia:'..project_name) local_status=cfg.inactive.status[args.PROJECT_STATUS]orcfg.inactive.default localmain_text=cfg.inactive.text:format( project_link.prefixedText, project_name, _status ) returninitialise( { PROJECT=args.PROJECT, BANNER_NAME=args.BANNER_NAME, IMAGE_LEFT=cfg.inactive.image, IMAGE_LEFT_SIZE=cfg.inactive.image_size, MAIN_TEXT=main_text, HOOK_NESTED_ASSESS=' '..cfg.inactive.nested:format(_status), substcheck=args.substcheck, category=args.category },{ substcheck=''-- to prevent warning on templatepage },_status ) end returnp