Template:CatWeight/doc: Difference between revisions

From AniDB
Jump to navigation Jump to search
mNo edit summary
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{todo}}
{{TOCright}}
{{TOCright}}
 
This template creates an ''category weight bar'' that can be indented up to six times via parameter value. It can also be colour coded, a weight can be defined, and you can add a message describing the weight choice.
==Experimental Weight Boxes==
{{eyecatch|1|Features|Indentation of up to 6 levels, colours, and weight ranges.}}
 
<!--
 
        BG Frame Grey Frame
s6 b100 s38 b100 s20 b80
h240 blue #efefff #9F9FFF #A3A3CC
h0 light red #ffefef #FF9F9F #CCA3A3
h60 yellow #ffffef #FFFF9E        #CCCCA3
h120 green #efffef #9EFF9E        #A3CCA3
-->
 
 
===Detailed weighing of Category with explicit descriptions===
:{| style="background:#FAF0FF; border:1px solid #DFC8EC; font-size: 90%;"
| style="background:black; padding:2px;"    | <span style="color:white; font-weight:bold;">Category&nbsp;Weight</span>
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&nbsp;&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 0 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>+&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 1 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 2 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;+&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 3 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 4 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;+</tt></span>
| style="padding:2px;"                      | ''Level 5 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;&#42;</tt></span>
| style="padding:2px;"                      | ''Level 6 does this and that.''
|-
|}
 
 
:{| style="background:#efefff; border:1px solid #A3A3CC; font-size: 90%;"
| style="background:black; padding:2px;"    | <span style="color:white; font-weight:bold;">Category&nbsp;Weight</span>
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&nbsp;&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 0 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>+&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 1 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&nbsp;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 2 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;+&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 3 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;&nbsp;</tt></span>
| style="padding:2px;"                      | ''Level 4 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;+</tt></span>
| style="padding:2px;"                      | ''Level 5 does this and that.''
|-
| style=""                                  | &nbsp;
| style="background:#A3A3CC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&#42;&#42;&#42;</tt></span>
| style="padding:2px;"                      | ''Level 6 does this and that.''
|-
|}
 
 
 
===Case: on/off only===
Certain categories will either be set to <tt>***</tt> or not set at all. There are no intermediate weights!
 
:{| style="background:#FAF0FF; border:1px solid #DFC8EC; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&nbsp;<br>or ***</tt></span>
| style="padding:2px;"                      | ''If applicable this category should be weighted with '''<tt>***</tt>''' (on). Otherwise do '''not''' set it at all!''
|}
 
Probably better alternative table layout:
 
:{| style="background:#ffefef; border:1px solid #CCA3A3; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#CCA3A3; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>&nbsp; or ***</tt></span>
|-
| style="padding:2px;" colspan="2" | ''If applicable this category should be weighted with '''<tt>***</tt>''' (on). Otherwise do '''not''' set it at all!''
|}
 
===Case: + to *** range dependant on occurrence amount===
Most categories are weighted <tt>+</tt> to <tt>***</tt>. This solely depends on '''how often''' the category occurs in the anime.
 
:{| style="background:#FAF0FF; border:1px solid #DFC8EC; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#DFC8EC; padding:2px;"  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
| style="padding:2px;"                      | ''If applicable, choose a weight between '''<tt>+</tt>''' (seldom) to '''<tt>***</tt>''' (abundant) denoting '''how often''' the category occurs in the anime.''
|}
 
Probably better alternative table layout:
 
:{| style="background:#efffef; border:1px solid #A3CCA3; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#A3CCA3; padding:2px; text-align:center;"  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
|-
| style="padding:2px;" colspan="2" | ''If applicable, choose a weight between '''<tt>+</tt>''' (seldom) to '''<tt>***</tt>''' (abundant) denoting '''how often''' the category occurs in the anime.''
|}
 
 
:{| style="background:#efffef; border:1px solid #A3CCA3; width:180px; font-size:90%;"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#A3CCA3; padding:2px; text-align:center;"  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
|-
| style="padding:2px;" colspan="2" | ''If applicable, choose a weight between '''<tt>+</tt>''' (seldom) to '''<tt>***</tt>''' (abundant) denoting '''how often''' the category occurs in the anime.''
|}
 
===Case: + to *** range dependant worst case===
Some categories like the Content Indicators are weighted not by the occurrence amount, but by the '''worst case''' in the anime, e.g. the most violent scene defined the weight. Range of weights is <tt>+</tt> to <tt>***</tt>.
 
:{| style="background:#FAF0FF; border:1px solid #DFC8EC; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#DFC8EC; padding:2px; "  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
| style="padding:2px;"                      | ''If applicable, choose a weight between '''<tt>+</tt>''' (slight) to '''<tt>***</tt>''' (excessive) describing the '''worst case''' of category occurrence in the anime.''
|}
 
Probably better alternative table layout:
 
:{| style="background:#ffffef; border:1px solid #CCCCA3; width:300px"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#CCCCA3; padding:2px; text-align:center;"  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
|-
| style="padding:2px;" colspan="2"          | ''If applicable, choose a weight between '''<tt>+</tt>''' (slight) to '''<tt>***</tt>''' (excessive) describing the '''worst case''' of category occurrence in the anime.''
|}
 
:{| style="background:#ffffef; border:1px solid #CCCCA3; width:180px; font-size:90%;"
| style="background:black; padding:2px; text-align:center;"    | <span style="color:white; font-weight:bold;">Category Weight</span>
| style="background:#CCCCA3; padding:2px; text-align:center;"  | <span style="color:black; font-weight:bold;"><tt>+ to ***</tt></span>
|-
| style="padding:2px;" colspan="2"          | ''If applicable, choose a weight between '''<tt>+</tt>''' (slight) to '''<tt>***</tt>''' (exces- sive) describing the '''worst case''' of category occurrence in the anime.''
|}
 
==Documentation for this template==
This template creates an ''eye-catcher bar'' that can be indented up to '''6 times''' via parameter value, letting the user better customize his "Note"s. The code is backwards compatible, letting the user keep on using the old 2 parameter version as well.
{{eyecatch|1|New|Subtle one-pixel border added, padding improved, <weight> is not word-wrapped.}}
 
==Alternative names==
* <tt><nowiki>{{catWeight|<weight>|<text>}}</nowiki></tt>
* <tt><nowiki>{{CatWeight|<weight>|<text>}}</nowiki></tt>  - alternate spelling of template
* <tt><nowiki>{{catWeight|<#>|<weight>|<text>}}</nowiki></tt> 
* <tt><nowiki>{{CatWeight|<#>|<weight>|<text>}}</nowiki></tt> - alternate spelling of template
 


==Syntax==
==Syntax==
The template can have '''2''' or '''3 parameters''':
The template can have '''3''' or '''4 parameters''':
#'''<tt><nowiki>{{catWeight|<weight>|<text>}}</nowiki></tt>''' - Default mode, no indentation.
#{{m|catWeight|<colour>|<weight>|<text>}} - Default mode, no indentation.
#'''<tt><nowiki>{{catWeight|<#>|<weight>|<text>}}</nowiki></tt>''' - Define indentation via <#> parameter.
#{{m|catWeight|<#>|<colour>|<weight>|<text>}} - Define indentation via <#> parameter.
         '''<#>''' =  Number '''0''' (min) to '''6''' (max), defines indentation level.
         '''<#>''' =  Number '''0''' (min) to '''6''' (max), defines indentation level.
   '''<weight>''' =  The category weight denominator (not word-wrapped), range '''1''' (+) to '''6''' (***).
  '''<colour>''' =  Define the colour type of the info box:
                  '''onoff'''      = yellow-ish... use to match <nowiki>{{catWeightInfo|onoff}}</nowiki>
                  '''worstcase'''  = red-ish... use to match <nowiki>{{catWeightInfo|worstcase}}</nowiki>
                  '''amount'''    = green-ish... use to match <nowiki>{{catWeightInfo|amount}}</nowiki>
                  '''misc'''      = purple-ish... (fun, testing), the '''default''' colour!
              For the most current list of available <colour>s, see [[Template:CatWcolBackground|CatWcolBackground]]
              or [[Template:CatWcolFrame|CatWcolFrame]] template. 
   '''<weight>''' =  The category weight denominator (not word-wrapped), range:
                  '''1''' for "+"  to  '''6''' for "***"
                  '''1-5''' for "+ to **+"
                  '''1-6''' for "+ to ***"
              For a complete list of available <weight>s (and ranges), see the '''[[Template:CatWweight|CatWweight]]''' template.
     '''<text>''' =  The descriptive text for that weight level.
     '''<text>''' =  The descriptive text for that weight level.
{{eyecatch|1|Note|Only the '''<#>''' values '''1''' to '''6''' are actually checked, any '''other values''' (e.g. 0 or abc) yield '''no indentation''' at all, and are treated the same as <tt><nowiki>{{eyecatch|info|text}}</nowiki></tt>!}}
  '''<weight>''' =  The category weight denominator (not word-wrapped), range:
    '''<w>'''         '''1''' for "+"  to '''6''' for "***"
                '''1-5''' for "+ to **+"
                '''1-6''' for "+ to ***"


==Examples==
==Examples==
===The Weights===
===The Weights===
{{catWeight|1|1| Weight <tt>+  </tt> means this and that.}}
{{catWeight|misc|0|Weight <tt>"emtpy"</tt> for <tt><nowiki><color> = misc, <weight> = 0</nowiki></tt>.}}
{{catWeight|1|2| Weight <tt>*  </tt> means this and that.}}
{{catWeight|amount|1|Weight <tt>+  </tt> for <tt><nowiki><color> = amount, <weight> = 1</nowiki></tt>.}}
{{catWeight|1|3| Weight <tt>*+ </tt> means this and that.}}
{{catWeight|worstcase|2|Weight <tt>*  </tt> for <tt><nowiki><color> = worstcase, <weight> = 2</nowiki></tt>.}}
{{catWeight|1|4| Weight <tt>** </tt> means this and that.}}
{{catWeight|onoff|3|Weight <tt>*+ </tt> for <tt><nowiki><color> = onoff, <weight> = 3</nowiki></tt>.}}
{{catWeight|1|5| Weight <tt>**+</tt> means this and that.}}
{{catWeight|blue|4|Weight <tt>** </tt> for <tt><nowiki><color> = blue, <weight> = 4</nowiki></tt>.}}
{{catWeight|1|6| Weight <tt>***</tt> means this and that.}}
{{catWeight|misc|5|Weight <tt>**+</tt> for <tt><nowiki><color> = misc, <weight> = 5</nowiki></tt>.}}
{{catWeight|misc|6|Weight <tt>***</tt> for <tt><nowiki><weight> = 6</nowiki></tt>.}}
{{catWeight|misc|1-5|Weight <tt>+ to **+</tt> for <tt><nowiki><weight> = 1-5</nowiki></tt>.}}
{{catWeight|misc|1-6|Weight <tt>+ to ***</tt> for <tt><nowiki><weight> = 1-6</nowiki></tt>.}}


There is an issue when using '''*''' as argument in <tt>catWeight</tt>, using "x" for now.
===Indentation===
<nowiki>{{catWeight|0|onoff|0|'''No''' indentation or weight.}}</nowiki>  
{{catWeight|0|onoff|0|'''No''' indentation or weight.}}


===Indentation===
  <nowiki>{{catWeight|1|worstcase|1|'''One''' indentation and weight.}}</nowiki>  
  <nowiki>{{catWeight|0|Note|'''No''' indentation, just like the normal <tt>catWeight</tt>.}}</nowiki>
{{catWeight|1|worstcase|1|'''One''' indentation and weight.}}
<nowiki>{{catWeight|abc|Note|'''No''' indentation, just like the normal <tt>catWeight</tt>.}}</nowiki>  
<nowiki>{{catWeight||Note|'''No''' indentation, just like the normal <tt>catWeight</tt>.}}</nowiki>
{{catWeight|0|Note|'''No''' indentation, just like the normal <tt>catWeight</tt>.}}


  <nowiki>{{catWeight|1|Another note|'''One''' indentation, just like <tt>catWeight2</tt>.}}</nowiki>  
  <nowiki>{{catWeight|2|amount|2|Level '''two''' indentation and weight!}}</nowiki>  
{{catWeight|1|Another note|'''One''' indentation, just like <tt>catWeight2</tt>.}}
{{catWeight|2|amount|2|Level '''two''' indentation and weight!}}


  <nowiki>{{catWeight|2|Important|Level '''two''' indentation!}}</nowiki>  
  <nowiki>{{catWeight|6|misc|6|Maximum indentation level of '''six''', same weight!}}</nowiki>  
{{catWeight|2|Important|Level '''two''' indentation!}}
{{catWeight|6|misc|6|Maximum indentation level of '''six''', same weight!}}


<nowiki>{{catWeight|6|Very important|Maximum indentation level of '''six'''! "Very important" is ...}}</nowiki>
==Test the Code==
{{catWeight|6|Very important|Maximum indentation level of '''six'''! "Very important" is '''not''' word-wrapped.}}
Should more code testing be required see the [[Template:CatWeight/Test Code]] page.

Latest revision as of 23:02, 6 May 2009

This template creates an category weight bar that can be indented up to six times via parameter value. It can also be colour coded, a weight can be defined, and you can add a message describing the weight choice.

Features Indentation of up to 6 levels, colours, and weight ranges.

Syntax

The template can have 3 or 4 parameters:

  1. {{catWeight|<colour>|<weight>|<text>}} - Default mode, no indentation.
  2. {{catWeight|<#>|<colour>|<weight>|<text>}} - Define indentation via <#> parameter.
       <#> =  Number 0 (min) to 6 (max), defines indentation level.

  <colour> =  Define the colour type of the info box:
                 onoff      = yellow-ish... use to match {{catWeightInfo|onoff}}
                 worstcase  = red-ish... use to match {{catWeightInfo|worstcase}}
                 amount     = green-ish... use to match {{catWeightInfo|amount}}
                 misc       = purple-ish... (fun, testing), the default colour!
              For the most current list of available <colour>s, see CatWcolBackground 
              or CatWcolFrame template.  

  <weight> =  The category weight denominator (not word-wrapped), range:
                 1 for "+"  to  6 for "***"
                 1-5 for "+ to **+"
                 1-6 for "+ to ***"
              For a complete list of available <weight>s (and ranges), see the CatWweight template.

    <text> =  The descriptive text for that weight level.

  <weight> =  The category weight denominator (not word-wrapped), range:
   <w>          1 for "+"  to  6 for "***"
                1-5 for "+ to **+"
                1-6 for "+ to ***"

Examples

The Weights

Category Weight     Weight "emtpy" for <color> = misc, <weight> = 0.
Category Weight +   Weight + for <color> = amount, <weight> = 1.
Category Weight *   Weight * for <color> = worstcase, <weight> = 2.
Category Weight *+  Weight *+ for <color> = onoff, <weight> = 3.
Category Weight **  Weight ** for <color> = blue, <weight> = 4.
Category Weight **+ Weight **+ for <color> = misc, <weight> = 5.
Category Weight *** Weight *** for <weight> = 6.
Category Weight + to **+ Weight + to **+ for <weight> = 1-5.
Category Weight + to *** Weight + to *** for <weight> = 1-6.

Indentation

{{catWeight|0|onoff|0|'''No''' indentation or weight.}} 
Category Weight     No indentation or weight.
{{catWeight|1|worstcase|1|'''One''' indentation and weight.}} 
Category Weight +   One indentation and weight.
{{catWeight|2|amount|2|Level '''two''' indentation and weight!}} 
Category Weight *   Level two indentation and weight!
{{catWeight|6|misc|6|Maximum indentation level of '''six''', same weight!}} 
Category Weight *** Maximum indentation level of six, same weight!

Test the Code

Should more code testing be required see the Template:CatWeight/Test Code page.