Template:Xdiff/doc
Appearance
This is a documentation subpage for Template:Xdiff. It contains usage information, categories, and other content that is not part of the original template page. |
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]- Open the history tab for the page in question.
- Click the "(prev)" link for the preferred diff.
- Copy the
diff=...&oldid=...
from the URL in the address bar. - Paste it in your text, surround it with double curly brackets, add an
x
beforediff
, and remove the equals sign after it as well as the whole&oldid=
part.- Note: Don't worry if there is
prev
afterdiff=
. The resulting{{xdiff|prev|9999}}
will still work as expected.
- Note: Don't worry if there is
- 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}}
.
- Note: If the text includes the equals sign, use the format
- 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:
- The general format is
project_shortcut:language_code
. - Use the short (shortcut) form where available, not the long one, that is,
w
instead ofwikipedia
. - For projects that have no different language versions (Wikidata, Commons, Species, Simple English, etc.) omit the
:language_code
part.
- The general format is
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]{{diff}}
{{Foundation Diff}}
{{xoldid}}