Difference between revisions of "Template:SmartLink/Anchor"

From Wikispooks
Jump to navigation Jump to search
(Created page with "<noinclude>This is used by Template:SmartLink and Template:ArrayMapPropertyListLink. It is 'smart', in that it does the following operation:<br/> * It removes a traili...")
 
(Replace #substring:)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>This is used by [[Template:SmartLink]] and [[Template:ArrayMapPropertyListLink]]. It is 'smart', in that it does the following operation:<br/>
+
<noinclude>[[Category:String manipulation templates]]This is used by [[Template:SmartLink]], as is [[Template:SmartLink/Link]]. It is 'smart', in that it does the following operation:<br/>
* It removes a trailing "?" from the pagename (to allow people to end links in "?" to indicate uncertainty)
+
* If the pagename exists and has [[Property:So called]], give it "..." marks ''(via [[Template:SmartLink/Anchor/So-called]])''
</noinclude><includeonly>{{#if: {{{1|}}}} | {{#ifeq: {{#substring:{{{1|}}}|-1}}|?|{{#sub:{{{1}}}|0|-1}}| {{{1|}}} }} }}</includeonly>
+
** Before testing whether the pagename exists, it removes a trailing punctuation character ('.', ';' or '?') from the pagename (e.g. to allow people to end links in "?" to indicate uncertainty)
 +
</noinclude><includeonly>{{#switch: {{#sub:{{{1|}}}|-1}}
 +
|=
 +
|?
 +
|.
 +
|;={{SmartLink/Anchor/So-called|{{#sub:{{{1}}}|0|-1}}}}{{#sub:{{{1|}}}|-1}}
 +
|#default={{SmartLink/Anchor/So-called|{{{1|}}}}}
 +
}}</includeonly>

Latest revision as of 06:08, 6 July 2019

This is used by Template:SmartLink, as is Template:SmartLink/Link. It is 'smart', in that it does the following operation:

  • If the pagename exists and has Property:So called, give it "..." marks (via Template:SmartLink/Anchor/So-called)
    • Before testing whether the pagename exists, it removes a trailing punctuation character ('.', ';' or '?') from the pagename (e.g. to allow people to end links in "?" to indicate uncertainty)