Difference between revisions of "Template:Citation/make link"
From Self-sufficiency
(Comments made no difference so go back to older version.) |
(add check if #titleparts does anything) |
||
Line 1: | Line 1: | ||
− | {{#switch:{{#titleparts:{{{1|}}} | + | {{#switch:{{#titleparts:{{lcfirst:{{{1|}}}}}|2}} |
− | + | ||
|<!--if empty-->|None = {{{2}}} | |<!--if empty-->|None = {{{2}}} | ||
+ | |Http:/|Https:/|Ftp:/|{{lcfirst:{{{1|}}}}} = [{{{1}}} {{{2}}}] | ||
|#default = [[:{{{1}}}|{{{2}}}]] | |#default = [[:{{{1}}}|{{{2}}}]] | ||
}}<noinclude> | }}<noinclude> | ||
Line 13: | Line 13: | ||
not about a book or chapter. | not about a book or chapter. | ||
4. The colon in "[[:" prevents images from being expanded. | 4. The colon in "[[:" prevents images from being expanded. | ||
+ | 5. The lcfirst checks if #titleparts does anything. That is, if the result | ||
+ | of #titleparts has a lowecase first letter, then #titleparts passed through | ||
+ | the parameter unchanged, meaning the string was not a valid article title. | ||
--> | --> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 23:14, 1 August 2009
{{{2}}}
[edit]
Documentation