Template:CheckLinkText

Documentation
Usage intended within other templates only, as a nested template. This template can be used to more safely add linktext if it is possible that the input might be blank (which may break stuff by making the link invisible). It will check first to see if the input is blank, and only then decide whether it should add the pipe to change the linktext. Finally it will add the input it recieved as the linktext.

Usage
To use this template in another template, format the link like this, where articlearticle is the link target:

Advanced
Put in a string to check; when doing so, this template (CheckLinkText) itself accepts only one unnamed parameter. But when using this in another template, the input string given to CheckLinkText should keep it should keep its parameter markup from the main template. Ensure that the parameter's default is empty. So for example, use it as:  where   is the parameter it is checking for link text, and the   at the end means it defaults to an empty string.

You can put spaces before it; that's fine, whitespace in the link target is ignored. Don't add spaces between the end of its template brackets and the link brackets because those may be interpreted literally as part of the link text. If you need to do so for readability, add HTML comment/note tags (even if it is 7 characters long):

Example
Manor Lords Official Wiki Manor Lords Official Wiki


 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki

test cases for development use
(not within a full link, so this is just what is returned to the main template) Manor Lords Official Wiki (empty) Manor Lords Official Wiki (main numbered parameter, default to empty) Manor Lords Official Wiki (main named parameter, default to empty) Manor Lords Official Wiki (input, should successfully rename link)


 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki
 * Manor_Lords_Official_Wiki