Template:GetSpecies

From Pestinfo-Wiki
Jump to: navigation, search

Extracting the name of a species from a page name which contains a text in brackets after the species name. The species name and the bracket should be separated by a space character. The template takes 2 parameters:

|1= 
the page name (default: {{PAGENAME}})
|2= 
search-text, expected in brackets right after the species name

Usage: On a page like “Bibliography:Spodoptera exempta (crops)” the template …

{{GetSpecies |1={{PAGENAME}} |2=crops}}

… would return the trimmed page name part before “(crops)”:

Spodoptera exempta

Returns: trimmed string part before “(search-text)” or void if there is no match.