Difference between revisions of "Template:Citation/make link"
From Self-sufficiency
(return to non-demo #default, remove <span>s, and update code notes) |
(Simplify code. Remove obvious comment. Add one non-obvious one.) |
||
Line 1: | Line 1: | ||
{{#switch:{{#titleparts:{{{1|}}}|2}} | {{#switch:{{#titleparts:{{{1|}}}|2}} | ||
− | |Http:/|Https:/|Ftp:/ = [{{{1}}} {{{2 | + | |Http:/|Https:/|Ftp:/ = [{{{1}}} {{{2}}}] |
− | |<!--if empty-->|None = {{{2 | + | |<!--if empty-->|None = {{{2}}} |
− | |#default = [[:{{{1}}}|{{{2 | + | |#default = [[:{{{1}}}|{{{2}}}]] |
}}<noinclude> | }}<noinclude> | ||
<!-- Code notes (here so that people /read/ it) | <!-- Code notes (here so that people /read/ it) | ||
− | + | 1. Parameter #2 is always non-empty when called from {{Citation/core}}. | |
− | + | 2. It's up to {{Citation/core}} to stop italicized "'foo' & 'bar'" from becoming | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | 1. Parameter #2 is always non-empty when called from | + | |
− | 2. | + | |
"'''foo' & 'bar'''". Citation/core does this by having a <nowiki></nowiki> | "'''foo' & 'bar'''". Citation/core does this by having a <nowiki></nowiki> | ||
at both beginning and end of the call to this template. Since this is only | at both beginning and end of the call to this template. Since this is only | ||
− | needed once, | + | needed once, it's more efficient to do it in citation/core than here. |
− | 3. "None" is safe to use as a magic word | + | 3. "None" is safe to use as a magic word here, as the Wikipedia article [[None]] is |
− | + | not about a book or chapter. | |
+ | 4. The colon in "[[:" prevents images from being expanded. | ||
--> | --> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 21:13, 31 July 2009
{{{2}}}
[edit]
Documentation