⚠ 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: Difference between revisions
Techhead7890 (talk | contribs) (add to doc) |
Techhead7890 (talk | contribs) (→Advanced: spaces) |
||
Line 13: | Line 13: | ||
===Advanced=== | ===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: <code><nowiki>[[Manor_Lords_Official_Wiki{{CheckLinkText|{{{parameter name|}}} }}]]</nowiki></code> where <code><nowiki>{{{parameter name|}}}</nowiki></code> is the parameter it is checking for link text, and the <code><nowiki>|}}}</nowiki></code> at the end means it defaults to an empty string. | 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: <code><nowiki>[[Manor_Lords_Official_Wiki{{CheckLinkText|{{{parameter name|}}} }}]]</nowiki></code> where <code><nowiki>{{{parameter name|}}}</nowiki></code> is the parameter it is checking for link text, and the <code><nowiki>|}}}</nowiki></code> 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): <code><nowiki><!-- --></nowiki></code> | |||
===Example=== | ===Example=== |
Latest revision as of 05:00, 9 May 2024
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.
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{{CheckLinkText|{{{parameter name|defaultparameterresult}}} }}]] [[Manor Lords Official Wiki{{CheckLinkText|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)