Template:CheckGenus
From Pestinfo-Wiki
This template is currently not used. It has been used in the also obsolete Template:GetCategories.
The template takes one string parameter and analyzes it as follows:
- Does the string contain "(genus)"?
- If not, does it contain more than one word and does "<first word> (genus)" exist as a category. If yes it returns this genus category.
The template has the following structure:
1. Determine if "(genus)" does NOT exist (note "||" in if condition) {{#if:{{#pos:{{{1}}}|(genus)}}|| 2. Check for space {{#if:{{#pos:{{{1}}}| }}| 3. Construct "<first word> (genus)" and define it as variable "Genus" {{#vardefine:Genus|{{#sub:{{{1}}}|0|{{#pos:{{{1}}}| }} }} (genus)}} 4. Check if this page exists as a category and return it if it does {{#ifexist:Category:{{#var:Genus}}|{{#var:Genus}} }} }} }}