Jump to content

Template:Xdiff

From Meta, a Wikimedia project coordination wiki
Template documentation

Short syntax: {{xdiff|diff|oldid|label|proj}}

Description

[edit]

xdiff is an alternative form of the {{diff}} template, implemented as a wrapper around the latter, with two distinctions:

  • it has a slightly simplified positional parameter syntax, which makes copy-pasting from the diff URL easier;
  • it supports diffs from other projects, which can be especially handy in projects like Meta, Commons, and Wikidata.

Usage

[edit]
  1. Open the history tab for the page in question.
  2. Click the "(prev)" link for the preferred diff.
  3. Copy the diff=...&oldid=... from the URL in the address bar.
  4. Paste it in your text, surround it with double curly brackets, add an x before diff, and remove the equals sign after it as well as the whole &oldid= part.
    Note: Don't worry if there is prev after diff=. The resulting {{xdiff|prev|9999}} will still work as expected.
  5. If you want the link to display custom text, add it in the third positional parameter (label in the general syntax example above). Otherwise the text will simply be “diff”.
    Note: If the text includes the equals sign, use the format 3=some text=more text, for example {{xdiff|10000|9999|3=here it is claimed that 2+2=5}}.
  6. If the diff is from another WMF project, add the project shortcut from WP:INTERWIKI as a fourth positional parameter according to the following rules:
    1. The general format is project_shortcut:language_code.
    2. Use the short (shortcut) form where available, not the long one, that is, w instead of wikipedia.
    3. For projects that have no different language versions (Wikidata, Commons, Species, Simple English, etc.) omit the :language_code part.

Examples

[edit]
Simplest form, local diff with no customization

{{xdiff|2986565|1884091}} => diff

Local diff with custom text

{{xdiff|2986565|1884091|this is a diff}} => this is a diff

Diff from the English Wikipedia

{{xdiff|864711889|864629150||w:en}} => diff

Diff from the English Wikipedia with custom text

{{xdiff|864711889|864629150|this change|w:en}} => this change

Diff from Commons

{{xdiff|prev|357020824||c}} => diff

See also

[edit]