Template:Quality mask/doc/custom
This template subpage contains a mask which normalizes the input passed to |quality=
. This can be thought of as the 'default' mask, but it is possible for banners to define their own individual masks with wider or fewer choices of acceptable inputs.
If the page corresponding to {{{BANNER_NAME}}}/quality
exists and QUALITY_SCALE=subpage
is set in the banner, then control is passed to the code on that page to normalize the input, and no modification is performed by the WPBannerMeta itself. The following parameter is available to be used:
|quality=
Some caveats:
- {{WPBannerMeta/qualityscale}} treats a null output from the mask as "unassessed"
- {{WPBannerMeta/importancescale}} handles importance ratings differently when the mask outputs "NB"
Any alternative mask needs to be carefully designed to handle all inputs correctly, with care given to case-insentivity, etc.
Please do not just copy the contents of this subpage to create a custom mask. If the banner does not need to have a significantly different handling of the |quality=
inputs, then leave the default mask in place.
Examples
[edit source]The following code accepts only the standard assessment scale with a few extras:
{{#switch:{{lc:{{{quality|}}}}} |fb = FB |a = A |b = B |c = C |start = Start |stub = Stub |template = Template |subject = Subject |category = Category |project = Project }}
An example using all classifications and namespace detection:
{{#switch: {{lc:{{{quality}}}}} |fb = FB |a = A |b = B |c = C |start= Start |stub = Stub |nb = NB |category|cat|categ = Category |template|temp|templ = Template |project = Project |#default={{#switch:{{NAMESPACE}} |Category talk = Category |Wikibooks talk = Project |Subject talk = Subject |Template talk = Template }} }}
Generic self-documentation
[edit source]A minor problem with the examples above is that someone clicking the link from the banner template to see the custom mask will be presented with a blank page (you have to edit the page to see there's actually code). A simple solution is to add a local wrapper to your code, replacing the basic structure:
{{#switch: {{lc:{{{quality}}}}} ... }}
with this one:
<noinclude>:''[[Template:WPBannerMeta#Custom masks|Custom mask]] used by {{tl|{{BASEPAGENAME}}}}:'' <pre></noinclude>{{#switch: {{lc:{{{quality}}}}} ... }}<noinclude></pre></noinclude>