උදවු:Pipe trick
මෙම පිටුව ඉංග්රීසි ව්යාපෘතියෙන් මෙහි ගෙනවිත් ඇත. අන්තර්ගතය අපගේ ව්යාපෘතිය සමඟ 100% නොගැලපෙනමුත් අපගේ අවශ්යතාවයන් වලට අනුකූලව ගොඩනගා ගැනීම සඳහා මූලික පියවර ලෙස භාවිතා කළ හැකිය. |
මෙම උදවු පිටුව කෙලෙසද-මාර්ගෝපදේශනයකි. මෙය විකිපීඩියාවේ ප්රතිමාන සහ ක්රියාමාර්ගවල සමහර ලක්ෂණ විස්තර කරයි. එය විකිපීඩියාවේ ප්රතිපත්ති සහ මාර්ගෝපදේශන අතුරින් එකක් නොවේ, and may reflect varying levels of consensus and vetting. මෙම පිටුව තුල කිසිවක් අසංගත නම් එම ප්රතිපත්ති සහ මාර්ගෝපදේශන වෙත යොමු වන්න |
Linking and page manipulation |
---|
The pipe trick uses the pipe character ("|
") to save typing the label of a piped link for several kinds of 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 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 "[[train]]s
".
The pipe trick doesn't work in edit summaries, within <ref>
tags, or links to sections. See § Where it doesn't work below.
Examples
සංස්කරණයArticle titles:
Pages in other namespaces
[[Wikipedia:Verifiability|]]
results in Verifiability[[User:Example|]]
results in Example[[Template:Welcome|]]
results in Welcome.{{tl|Welcome}}
to produce {{Welcome}} is preferred instead.[[:Category:Wikipedia|]]
results in Wikipedia. The colon avoids categorization of the page.[[Category:Wikipedia|]]
should not be used.[[Category:Wikipedia| ]]
with a space after the pipe is a category sortkey and not the pipe trick.
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.
[[pipe (computing)|]]
generates the wiki markup[[pipe (computing)|pipe]]
rendered as pipe
As with all links, it is possible to blend a suffix when using the pipe trick as well:
Combinations
සංස්කරණයThe basic rule when the pipe trick is used is that an (initial) 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:
Commas beat parentheses
සංස්කරණයIf the link name involves both one or more commas and a final parenthesis, only the parenthesis is suppressed:
[[Yours, Mine and Ours (1968 film)|]]
is shown on the page as:
Only one prefix suppressed
සංස්කරණයIf there are several prefixes, which can occur, for example, for an interlanguage link, only the first is suppressed:
[[:es:Wikipedia:Políticas|]]
is rendered as:
Only the first comma
සංස්කරණයIf there are several commas, only the part up to the first comma is shown:
[[Il Buono, il Brutto, il Cattivo|]]
results in:
Other combinations
සංස්කරණයFor the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:
[[Wikipedia:Manual of Style (Persian)|]]
produces:
Where it doesn't work
සංස්කරණයWhere the pipe trick doesn't work, the link must be written out in full manually.
<ref>
footnotes and <gallery>
tags
සංස්කරණය
The trick does not work when enclosing between "ref" tags or gallery tags.
<ref>[[Roger Taylor (author)|]]</ref>
renders in the references list (generated by the <references/> tag) as:
- ^ [[Roger Taylor (author)|]]
Note: This does not apply to references defined via {{r}} or {{refn}}.
Edit summaries
සංස්කරණයThe trick does not work in edit summaries.
/* Edit summaries and the pipe trick */ as tested in [[WP:SAND|]]
renders in the edit history as:
Section links
සංස්කරණයThe pipe trick does not work on section links, and in general it does not work for links to anchors (links that use a #
sign). For example,
[[Wikipedia:Verifiability#Sources|]]
renders as:
[[Wikipedia:Verifiability#Sources|]]
It does not give you any wikilink. See phabricator:T2845, "[[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]], [[/bar|bar]]".
Related tricks
සංස්කරණයSlash trick
සංස්කරණයYou can achieve a similar effect for subpages by adding a slash.
[[/Subpage/]]
generates:
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
[[|Agonizer]]
were placed in Agonist (disambiguation), the link would be expanded to
[[Agonizer (disambiguation)|Agonizer]]
If the link
[[|Palo Alto]]
were placed in Pacific Grove, California, the link would be expanded to
[[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.