Changes
Jump to navigation
Jump to search
m
Reverted edits by 37.153.123.72 (talk) to last version by Eisthefifthletter
{{Wikipedia how to|H:PT|WP:PIPETRICK}}
{{Linking and page manipulation|linking and diffs}}
The '''pipe trick''' uses the [[pipe character]] ("{{code|{{!}}}}") to save typing the label of a [[Help:piped link|piped link]] for several kinds of [[wikilink|wiki links]]. This can avoid potentially making an error while typing the label.
When the last character of a link is the pipe character, the pipe trick will automatically generate the text that displays for that link. Its processing removes the parenthesized part of the link title, handles commas in the title, and removes [[WP:Namespace|namespace]] prefixes. The described processing happens at the point of saving the page data, and the generated text is saved with the rest of the page's [[wiki markup]] – thus, it is merely an aid to editing.
An even better way to save keystrokes that doesn't need any additional characters is by simply attaching text to the link, as in "<nowiki>[[train]]s</nowiki>".
The pipe trick doesn't work in edit summaries, within <nowiki><ref></nowiki> tags, or links to sections – [[#Where it doesn't work|see below]].
==Examples==
{| class="wikitable"
|-
| style="width: 33%; vertical-align: top" |
'''Article titles'''
* {{code|[[Pipe (computing){{!}}]]}} results in [[Pipe (computing)|Pipe]]
* {{code|[[Phoenix, Arizona{{!}}]]}} results in [[Phoenix, Arizona|Phoenix]]
| style="width: 33%; vertical-align: top" |
'''Pages in other namespaces'''
* {{code|[[Wikipedia:Verifiability{{!}}]]}} results in [[Wikipedia:Verifiability|Verifiability]]
* {{code|[[User:Example{{!}}]]}} results in [[User:Example|Example]]
* {{code|[[Template:Welcome{{!}}]]}} results in [[Template:Welcome|Welcome]]
|}
The next few examples demonstrate additional features and show the expanded wiki markup text that this pipe-trick process generates, which in turn generates the results in the page display.
Since Wikipedia is case-insensitive in regard to the first character of the target title, it is possible to use the pipe trick for upper- or lowercase words regardless of the target page's case.
* {{code|[[pipe (computing){{!}}]]}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]}} rendered as [[pipe (computing)|pipe]]
As with all links, it is possible to blend a suffix when using the pipe trick as well:
* {{code|[[pipe (computing){{!}}]]s}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]s}} rendered as [[pipe (computing)|pipe]]s
* {{code|[[pipe (computing){{!}}]]mill}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]mill}} rendered as [[pipe (computing)|pipe]]mill<!-- A redirect named pipemill exists as well, but this is only an example -->
==Combinations==
The basic rule when the pipe trick is used is that an (initial) [[WP:namespace|namespace]] prefix, a final part beginning with a comma, or a final parenthesis (usually intended for disambiguation) is suppressed in the rendering of the link. The rendered text is case neutral and so should be entered precisely as the user wishes it to appear in the article. In case of combinations of suppressible parts, the following rules apply:
{| class="wikitable"
|-
| style="vertical-align: top; padding: 1em;" |
===Commas beat parentheses===
If the link name involves both one or more commas ''and'' a final parenthesis, only the parenthesis is suppressed:
:{{code|[[Yours, Mine and Ours (1968 film){{!}}]]}}
is shown on the page as:
:[[Yours, Mine and Ours (1968 film)|Yours, Mine and Ours]]
| style="vertical-align: top; padding: 1em;" |
===Only one prefix suppressed===
If there are several prefixes, which can occur, for example, for an [[Help:Interlanguage links|interlanguage link]], only the first is suppressed:
:{{code|[[:es:Wikipedia:Políticas{{!}}]]}}
is rendered as:
:[[:es:Wikipedia:Políticas|Wikipedia:Políticas]]
|-
| style="vertical-align: top; padding: 1em;" |
===Only the first comma===
If there are several commas, only the part up to the first comma is shown:
:{{code|[[Il Buono, il Brutto, il Cattivo{{!}}]]}}
results in:
:[[Il Buono, il Brutto, il Cattivo|Il Buono]]
| style="vertical-align: top; padding: 1em;" |
===Other combinations===
For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:
:{{code|[[Wikipedia:Manual of Style (Persian){{!}}]]}}
produces:
:[[Wikipedia:Manual of Style (Persian)|Manual of Style]]
|}
==Where it doesn't work==
Where the pipe trick doesn't work, the link must be written out in full manually.
===<code><ref></code> footnotes and <code><gallery></code> tags===
{{notice|This was reported as a bug over 10 years ago, but as of {{date}} it has not been resolved. See [[phabricator:T4700|this bug report]] for technical details.}}
The trick does not work when enclosing between [[wikipedia:footnotes|"ref" tags]] or [[WP:Gallery|gallery tags]].
:<code><nowiki><ref>[[Roger Taylor (author)|]]</ref></nowiki><span style="display:none"><ref>[[Roger Taylor (author)|]]</ref></span></code>
renders in the references list (generated by the <nowiki><references/></nowiki> tag) as:
<references/>
Note: This does not apply to references defined via {{tl|r}} or {{tl|refn}}.
===Edit summaries===
<!-- The pipe trick auto-converts, for example, <nowiki>[[WP:SAND|]]</nowiki> to [[WP:SAND|SAND]] -->
The trick does not work in edit summaries.
:{{code|/* Edit summaries and the pipe trick */ as tested in [[WP:SAND{{!}}]]}}
renders in the edit history as:
:<span class="comment">(<span class="autocomment">[[#Edit summaries and the pipe trick|→]]Edit summaries and the pipe trick:</span> as tested in [[WP:SAND]])</span>
===Section links===
The pipe trick does not work on [[Help:Link#Section linking (anchors)|section links]], and in general it does not work for links to anchors (links that use a {{code|#}} sign). For example,
:{{code|[[Wikipedia:Verifiability#Sources{{!}}]]}} renders as:
[[Wikipedia:Verifiability#Sources|]]
It does not give you any wikilink. See [[phabricator:T2845]], "<nowiki>[[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]], [[/bar|bar]]</nowiki>".<!--
The following commented out 2012-11-16, please don't restore until it works. --><!--
{{caution|The following is future behaviour and not valid {{as of|2011|04|19|lc=y}}:}}
The pipe trick works only for section links to the current page.
:{{code|<nowiki>[[#Examples|]]</nowiki>}}
gives
:{{code|<nowiki>[[#Examples|Examples]]</nowiki>}}
but
:{{code|<nowiki>[[Other#Examples|]]</nowiki>}}
acts like
:{{code|<nowiki>[[Other#Examples]]</nowiki>}}
-->
== Related tricks ==
=== Slash trick ===
You can achieve a similar effect for [[help:subpage|subpage]]s by adding a slash.
: {{code|[[/Subpage/]]}}
generates:
: [[/Subpage/]]
Unlike the pipe trick, though, the slash trick is not expanded in the saved [[wiki markup]].
This trick only works in namespaces where subpages are enabled.
===Reverse pipe trick===
If the title of the article you are editing includes a parenthesized term or a comma, placing a pipe at the ''start'' of a link will append that parenthesized text to the link target, but not display it.
For example, if the link
:{{code|[[{{!}}Agonizer]]}}
were placed in [[Agonist (disambiguation)]], the link would be expanded to
:{{code|[[Agonizer (disambiguation)|Agonizer]]}}
If the link
:{{code|[[{{!}}Palo Alto]]}}
were placed in [[Pacific Grove, California]], the link would be expanded to
:{{code|[[Palo Alto, California|Palo Alto]]}}
Placing a pipe at the start of a link to an article that has no parentheses or comma in its title will have no effect.
==Alternatives==
Some templates are available as alternatives to using the trick for linking.
{{tbullet|user link|Example}} (shortcut: {{tl|u}})
{{tbullet|help link|Example}}
{{tbullet|tlbare|Example}}
==See also==
* [[Help:Magic]]
* [[Help:Piped link]]
* [[m:Help:Piped link]]
{{Wikipedia technical help|collapsed}}
[[Category:Wikipedia features|{{PAGENAME}}]]
[[Category:Wikipedia link help]]
{{Linking and page manipulation|linking and diffs}}
The '''pipe trick''' uses the [[pipe character]] ("{{code|{{!}}}}") to save typing the label of a [[Help:piped link|piped link]] for several kinds of [[wikilink|wiki links]]. This can avoid potentially making an error while typing the label.
When the last character of a link is the pipe character, the pipe trick will automatically generate the text that displays for that link. Its processing removes the parenthesized part of the link title, handles commas in the title, and removes [[WP:Namespace|namespace]] prefixes. The described processing happens at the point of saving the page data, and the generated text is saved with the rest of the page's [[wiki markup]] – thus, it is merely an aid to editing.
An even better way to save keystrokes that doesn't need any additional characters is by simply attaching text to the link, as in "<nowiki>[[train]]s</nowiki>".
The pipe trick doesn't work in edit summaries, within <nowiki><ref></nowiki> tags, or links to sections – [[#Where it doesn't work|see below]].
==Examples==
{| class="wikitable"
|-
| style="width: 33%; vertical-align: top" |
'''Article titles'''
* {{code|[[Pipe (computing){{!}}]]}} results in [[Pipe (computing)|Pipe]]
* {{code|[[Phoenix, Arizona{{!}}]]}} results in [[Phoenix, Arizona|Phoenix]]
| style="width: 33%; vertical-align: top" |
'''Pages in other namespaces'''
* {{code|[[Wikipedia:Verifiability{{!}}]]}} results in [[Wikipedia:Verifiability|Verifiability]]
* {{code|[[User:Example{{!}}]]}} results in [[User:Example|Example]]
* {{code|[[Template:Welcome{{!}}]]}} results in [[Template:Welcome|Welcome]]
|}
The next few examples demonstrate additional features and show the expanded wiki markup text that this pipe-trick process generates, which in turn generates the results in the page display.
Since Wikipedia is case-insensitive in regard to the first character of the target title, it is possible to use the pipe trick for upper- or lowercase words regardless of the target page's case.
* {{code|[[pipe (computing){{!}}]]}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]}} rendered as [[pipe (computing)|pipe]]
As with all links, it is possible to blend a suffix when using the pipe trick as well:
* {{code|[[pipe (computing){{!}}]]s}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]s}} rendered as [[pipe (computing)|pipe]]s
* {{code|[[pipe (computing){{!}}]]mill}} generates the wiki markup {{code|[[pipe (computing){{!}}pipe]]mill}} rendered as [[pipe (computing)|pipe]]mill<!-- A redirect named pipemill exists as well, but this is only an example -->
==Combinations==
The basic rule when the pipe trick is used is that an (initial) [[WP:namespace|namespace]] prefix, a final part beginning with a comma, or a final parenthesis (usually intended for disambiguation) is suppressed in the rendering of the link. The rendered text is case neutral and so should be entered precisely as the user wishes it to appear in the article. In case of combinations of suppressible parts, the following rules apply:
{| class="wikitable"
|-
| style="vertical-align: top; padding: 1em;" |
===Commas beat parentheses===
If the link name involves both one or more commas ''and'' a final parenthesis, only the parenthesis is suppressed:
:{{code|[[Yours, Mine and Ours (1968 film){{!}}]]}}
is shown on the page as:
:[[Yours, Mine and Ours (1968 film)|Yours, Mine and Ours]]
| style="vertical-align: top; padding: 1em;" |
===Only one prefix suppressed===
If there are several prefixes, which can occur, for example, for an [[Help:Interlanguage links|interlanguage link]], only the first is suppressed:
:{{code|[[:es:Wikipedia:Políticas{{!}}]]}}
is rendered as:
:[[:es:Wikipedia:Políticas|Wikipedia:Políticas]]
|-
| style="vertical-align: top; padding: 1em;" |
===Only the first comma===
If there are several commas, only the part up to the first comma is shown:
:{{code|[[Il Buono, il Brutto, il Cattivo{{!}}]]}}
results in:
:[[Il Buono, il Brutto, il Cattivo|Il Buono]]
| style="vertical-align: top; padding: 1em;" |
===Other combinations===
For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:
:{{code|[[Wikipedia:Manual of Style (Persian){{!}}]]}}
produces:
:[[Wikipedia:Manual of Style (Persian)|Manual of Style]]
|}
==Where it doesn't work==
Where the pipe trick doesn't work, the link must be written out in full manually.
===<code><ref></code> footnotes and <code><gallery></code> tags===
{{notice|This was reported as a bug over 10 years ago, but as of {{date}} it has not been resolved. See [[phabricator:T4700|this bug report]] for technical details.}}
The trick does not work when enclosing between [[wikipedia:footnotes|"ref" tags]] or [[WP:Gallery|gallery tags]].
:<code><nowiki><ref>[[Roger Taylor (author)|]]</ref></nowiki><span style="display:none"><ref>[[Roger Taylor (author)|]]</ref></span></code>
renders in the references list (generated by the <nowiki><references/></nowiki> tag) as:
<references/>
Note: This does not apply to references defined via {{tl|r}} or {{tl|refn}}.
===Edit summaries===
<!-- The pipe trick auto-converts, for example, <nowiki>[[WP:SAND|]]</nowiki> to [[WP:SAND|SAND]] -->
The trick does not work in edit summaries.
:{{code|/* Edit summaries and the pipe trick */ as tested in [[WP:SAND{{!}}]]}}
renders in the edit history as:
:<span class="comment">(<span class="autocomment">[[#Edit summaries and the pipe trick|→]]Edit summaries and the pipe trick:</span> as tested in [[WP:SAND]])</span>
===Section links===
The pipe trick does not work on [[Help:Link#Section linking (anchors)|section links]], and in general it does not work for links to anchors (links that use a {{code|#}} sign). For example,
:{{code|[[Wikipedia:Verifiability#Sources{{!}}]]}} renders as:
[[Wikipedia:Verifiability#Sources|]]
It does not give you any wikilink. See [[phabricator:T2845]], "<nowiki>[[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]], [[/bar|bar]]</nowiki>".<!--
The following commented out 2012-11-16, please don't restore until it works. --><!--
{{caution|The following is future behaviour and not valid {{as of|2011|04|19|lc=y}}:}}
The pipe trick works only for section links to the current page.
:{{code|<nowiki>[[#Examples|]]</nowiki>}}
gives
:{{code|<nowiki>[[#Examples|Examples]]</nowiki>}}
but
:{{code|<nowiki>[[Other#Examples|]]</nowiki>}}
acts like
:{{code|<nowiki>[[Other#Examples]]</nowiki>}}
-->
== Related tricks ==
=== Slash trick ===
You can achieve a similar effect for [[help:subpage|subpage]]s by adding a slash.
: {{code|[[/Subpage/]]}}
generates:
: [[/Subpage/]]
Unlike the pipe trick, though, the slash trick is not expanded in the saved [[wiki markup]].
This trick only works in namespaces where subpages are enabled.
===Reverse pipe trick===
If the title of the article you are editing includes a parenthesized term or a comma, placing a pipe at the ''start'' of a link will append that parenthesized text to the link target, but not display it.
For example, if the link
:{{code|[[{{!}}Agonizer]]}}
were placed in [[Agonist (disambiguation)]], the link would be expanded to
:{{code|[[Agonizer (disambiguation)|Agonizer]]}}
If the link
:{{code|[[{{!}}Palo Alto]]}}
were placed in [[Pacific Grove, California]], the link would be expanded to
:{{code|[[Palo Alto, California|Palo Alto]]}}
Placing a pipe at the start of a link to an article that has no parentheses or comma in its title will have no effect.
==Alternatives==
Some templates are available as alternatives to using the trick for linking.
{{tbullet|user link|Example}} (shortcut: {{tl|u}})
{{tbullet|help link|Example}}
{{tbullet|tlbare|Example}}
==See also==
* [[Help:Magic]]
* [[Help:Piped link]]
* [[m:Help:Piped link]]
{{Wikipedia technical help|collapsed}}
[[Category:Wikipedia features|{{PAGENAME}}]]
[[Category:Wikipedia link help]]