Difference between revisions of "Template:Mouse"

From MHWiki
m (Testing out auto-tracker for image links to external sites)
m (Added iTunes Mouse image links exclusion, editor comments to explain all coding, cleared up spacing issues)
Line 55: Line 55:
 
</noinclude>
 
</noinclude>
  
<!-- On article namespace, add categories and remove TOC -->
+
<!-- Automated stuff: the code -->
{{if| {{NAMESPACE}}
+
{{if|{{NAMESPACE}} <!-- The template checks what the namespace of the page is -->
     | <!-- Not article namespace, do not do anything -->
+
     |             <!-- Since the automation should only be done on the main namespace, if the namespace has text, nothing is done -->
     |
+
     |             <!-- Here, the namespace has been confirmed as the main one, hence the following 4 things... -->
        {{if| {{{mgroup|}}}
+
    <!-- 1) Auto-categorisation for Mouse Groups -->
            | [[Category:Mice]] [[Category:{{{mgroup}}}]]
+
    {{if|{{{mgroup|}}}                                   <!-- Categoriser looks for "mgroup" parameter, if it doesn't exist then default value is no text -->
                <!-- Nested condition, check subgroup if mgroup is present -->
+
        |[[Category:Mice]] [[Category:{{{mgroup}}}]]     <!-- If there is text in the "mgroup" parameter, then "mice" and "mgroup" category tags -->
                {{if| {{{subgroup|}}} | [[Category:{{{mgroup}}} ({{{subgroup}}})]] }}
+
          {{if|{{{subgroup|}}}                           <!-- Categoriser also looks for "subgroup" parameter if "mgroup" has text -->
        }}
+
              |[[Category:{{{mgroup}}} ({{{subgroup}}})]] <!-- If there is text in the "subgroup" parameter, then "mgroup (subgroup)" category tag) -->
        {{if|{{{image|}}}|{{ifeq|{{MHdomain}}|{{padleft:|29|{{{image|}}}}}||[[Category:Missing Image]]}}|[[Category:Missing Image]]}}
+
              |                                          <!-- If there is no text in the "subgroup" parameter, then nothing more is done -->
        {{if|{{{id|}}}||[[Category:Missing ID]]}}
+
          }}
        __NOTOC__
+
        |                                                <!-- If there is no text in the "mgroup" parameter, nothing is done -->
 +
    }}
 +
    <!-- 2) Auto-tracker for the "Missing Image" category: iTunes Mouse exclusion included in 3RD LEVEL -->
 +
    {{if|{{{image|}}}               <!-- 1ST LEVEL: The tracker looks for the "image" parameter, if it doesn't exist then the default value is no text -->
 +
        |                           <!-- 1ST LEVEL: If there is text in the "image" parameter, then proceed to 2ND LEVEL -->
 +
          {{ifeq|{{MHdomain}}                 <!-- 2nd LEVEL: The tracker now looks for two things, first, the {{MHdomain}} template -->
 +
                |{{padleft:|29|{{{image|}}}}} <!-- 2nd LEVEL: Second, the first 29 characters from the "image" parameter -->
 +
                |                             <!-- 2nd LEVEL: If {{MHdomain}} and 29 characters are the same, then nothing is done -->
 +
                |                            <!-- 2nd LEVEL: If {{MHdomain}} and 29 characters are different, then proceed to 3RD LEVEL -->
 +
                {{ifeq|https://i.imgur.com/Km26rS2.jpg <!-- 3rd LEVEL: The tracker now looks for two things, first, the iTunes Mouse image link -->             
 +
                      |{{padleft:|31|{{{image|}}}}}    <!-- 3rd LEVEL: Second, the first 31 characters from the "image" parameter -->
 +
                      |                                <!-- 3rd LEVEL: If image link and 31 characters are the same, then nothing is done -->
 +
                      |[[Category:Missing Image]]     <!-- 3rd LEVEL: If image link and 31 characters are different, "Missing Image" category tag -->
 +
                }}
 +
          }}
 +
        |[[Category:Missing Image]] <!-- 1ST LEVEL: If there is no text in the "id" parameter, the page is tagged with the "Missing ID" category -->
 +
    }}
 +
    <!-- 3) Auto-tracker for the "Missing ID" category -->
 +
    {{if|{{{id|}}}               <!-- The tracker looks for the "id" parameter, if it doesn't exist then the default value is no text -->
 +
        |                       <!-- If there is text in the "id" parameter, nothing is done -->
 +
        |[[Category:Missing ID]] <!-- If there is no text in the "id" parameter, "Missing ID" category tag -->
 +
    }}
 +
    <!-- 4) Automatically remove TOC from Mouse pages -->
 +
    __NOTOC__
 
}}
 
}}
  
 
{{-}}
 
{{-}}

Revision as of 19:05, 23 July 2021

Sample

Mouse
Mouse Group: ??
Mouse Statistics
Points: ?? Gold: ??
Location & Attraction Info
Required Power Types: ?? Other Requirements: ??
Cheese: ?? Charm: ??
Locations: ?? Loot: ??
Links
Larry's Loot Lexicon: ?? Image: ??
Mouse ID#:



Usage

Simple table template to maintain consistency between mice pages. All fields shown here are required:

{{Mouse
 | mgroup    = 
 | subgroup  = 
 | maxpoints = 
 | mingold   = 
 | traptype  = 
 | other     = 
 | bait      =  
 | charm     = 
 | habitat   = 
 | loot      = 
 | mhinfo    = 
 | image     = 
 | desc      = 
 | id        = 
}}

Additionally, there is an optional parameter:

  • "title" to change the title of the infobox when needed to be modified.

Notes

The traptype attribute refers to the mouse's weaknesses to various power types.

  • If there are trap power type(s) which are Very Effective against the mouse, list those.
  • If there are no Very Effective types, list the Effective types instead.
  • If there are no Very Effective or Effective types, list the Less Effective types.
  • If the Effective types are, in fact, all types except the one-off Parental trap, enter "All types" (this applies to Indigenous Mice, for example).

Many mice have a subgroup. An example of one with a subgroup is Eclipse, which would be listed with:

 | mgroup   = Gauntlet Gladiators
 | subgroup = Tier Eight: The Eclipse

See more notes in the Manual of Style.