⚠ NOTICE

The game has been released in Early Access on 26th of April, 2024.
Please keep in mind that any information provided on this Wiki may be incomplete or subject to change as the game progresses.

Template:CheckLinkText

From Manor Lords Official Wiki
Revision as of 04:58, 9 May 2024 by Techhead7890 (talk | contribs) (add to doc)


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: [[articlearticle{{CheckLinkText| {{{parameter name|}}} }}]]

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: [[Manor_Lords_Official_Wiki{{CheckLinkText|{{{parameter name|}}} }}]] where {{{parameter name|}}} is the parameter it is checking for link text, and the |}}} at the end means it defaults to an empty string.

Example

[[Manor Lords Official Wiki{{CheckLinkText|{{{parameter name|defaultparameterresult}}} }}]]
[[Manor Lords Official Wiki{{CheckLinkText|I want this link to look cool}}]]
defaultparameterresult
I want this link to look cool

test cases for development use

{{CheckLinkText}}
{{CheckLinkText|Anchorage, Alaska}} (not within a full link, so this is just what is returned to the main template)
[[Manor Lords Official Wiki{{CheckLinkText|}}]] (empty)
[[Manor Lords Official Wiki{{CheckLinkText|{{{2|}}} }}]] (main numbered parameter, default to empty)
[[Manor Lords Official Wiki{{CheckLinkText|{{{parameter name|}}} }}]] (main named parameter, default to empty)
[[Manor Lords Official Wiki{{CheckLinkText|Iwantthis link to look cool}}]] (input, should successfully rename link)
| Anchorage, Alaska
Manor_Lords_Official_Wiki
Manor_Lords_Official_Wiki
Manor_Lords_Official_Wiki
Iwantthis link to look cool