Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Help:Pipe trick

From Wikipedia, the free encyclopedia
How to use pipe character for wiki links
This help page is ahow-to guide.
It explains concepts or processes used by the Wikipedia community. It is not one ofWikipedia's policies or guidelines, and may reflect varying levels ofconsensus.
Linking and
page manipulation

Thepipe trick uses thepipe character ("|") to save typing the label of apiped link for several kinds ofwiki 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 removesnamespace 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'swiki markup –thus, it is merely an aid to editing.

The pipe trick does not work in edit summaries, within<ref> tags, or with links to sections. See§ Where it doesn't work below.

Examples

[edit]

Article titles:

  • [[Pipe (computing)|]] results inPipe
  • [[Nashville, Tennessee|]] results inNashville

Pages in other namespaces:

  • [[Wikipedia:Verifiability|]] results inVerifiability
  • [[User:Example|]] results inExample
  • [[Template:Welcome|]] results inWelcome.{{tl|Welcome}} to produce{{Welcome}} is preferred instead.
  • [[:Category:Wikipedia|]] results inWikipedia. The colon avoids categorization of the page.[[Category:Wikipedia|]] should not be used.[[Category:Wikipedia| ]] with a space after the pipe is acategory 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 aspipe

As with all links, it is possible to blend a suffix when using the pipe trick as well:

  • [[pipe (computing)|]]s generates the wiki markup[[pipe (computing)|pipe]]s rendered aspipes
  • [[pipe (computing)|]]mill generates the wiki markup[[pipe (computing)|pipe]]mill rendered aspipemill

Combinations

[edit]

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

[edit]

If the link name involves both one or more commasand a final parenthesis, only the parenthesis is suppressed:

[[Yours, Mine and Ours (1968 film)|]]

is shown on the page as:

Yours, Mine and Ours

Only one prefix suppressed

[edit]

If there are several prefixes, which can occur, for example, for aninterlanguage link, only the first is suppressed:

[[:es:Wikipedia:Políticas|]]

is rendered as:

Wikipedia:Políticas

Only the first comma

[edit]

If there are several commas, only the part up to the first comma is shown:

[[Elgin, Kershaw County, South Carolina|]]

results in:

Elgin

Other combinations

[edit]

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:

Manual of Style

Where it doesn't work

[edit]

Where the pipe trick doesn't work, the link must be written out in full manually. For example, if[[Roger Taylor (author)|]] doesn't work then write the full[[Roger Taylor (author)|Roger Taylor]].

<ref> footnotes and<gallery> tags

[edit]
Tracked inPhabricator
Task T4700

The trick does not work when enclosing between"ref" tags orgallery tags.

<ref>[[Roger Taylor (author)|]]</ref>[1]

renders in the references list (generated by the <references/> tag) as:

  1. ^[[Roger Taylor (author)|]]

Note: This does not apply to references defined via{{r}} or{{refn}}.

Edit summaries

[edit]

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:

→‎Edit summaries and the pipe trick: as tested inWP:SAND

Section links

[edit]
Tracked inPhabricator
Task T2845

The pipe trick does not work onsection links, or more generally, links to anchors (links that use a# sign). For example,

[[Wikipedia:Verifiability#Sources|]]

renders as:

[[Wikipedia:Verifiability#Sources|]]

Related tricks

[edit]

Slash trick

[edit]

You can achieve a similar effect forsubpages by adding a slash.

[[/Subpage/]]

generates:

Subpage

Unlike the pipe trick, though, the slash trick is not expanded in the savedwiki markup.

This trick only works in namespaces where subpages are enabled.

Reverse pipe trick

[edit]

If the title of the article you are editing includes a parenthesized term or a comma, placing a pipe at thestart of a link will append that parenthesized text to the link target, but not display it.

For example, if the link

[[|Palo Alto]]

were placed inPacific Grove, California, the link would be expanded to

[[Palo Alto, California|Palo Alto]]

If the link

[[|Agonizer]]

were placed inAgonist (disambiguation), the link would be expanded to

[[Agonizer (disambiguation)|Agonizer]]

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

[edit]

Some templates are available as alternatives to using the trick for linking.

See also

[edit]
General
technical help
Special
page
-related
Wikitext
Links anddiffs
Media files: images,
videos and sounds
Other graphics
Templates and
Lua modules
Data structure
HTML andCSS
Customisation
and tools
Automated editing
Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Pipe_trick&oldid=1304881996"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp