Jump to content

Template:Diff: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
be more tolerant of empty server and scriptpath parameters, also add a very basic example, mainly for CI-type testing while making changes to the template
it's helpful to refer the readers to other similar templates that may better (or not) suit their needs
Line 31: Line 31:
* <code>server</code>: default if not provided is <code>{{SERVER}}</code> as taken from the <nowiki>{{SERVER}}</nowiki> [[:mw:Help:Magic words|magic word]] (for easier interwiki diffs see {{tlx|xdiff}})
* <code>server</code>: default if not provided is <code>{{SERVER}}</code> as taken from the <nowiki>{{SERVER}}</nowiki> [[:mw:Help:Magic words|magic word]] (for easier interwiki diffs see {{tlx|xdiff}})
* <code>scriptpath</code>: default if not provided is <code>{{SCRIPTPATH}}</code> as taken from the <nowiki>{{SCRIPTPATH}}</nowiki> [[:mw:Help:Magic words|magic word]] (for easier interwiki diffs see {{tlx|xdiff}})
* <code>scriptpath</code>: default if not provided is <code>{{SCRIPTPATH}}</code> as taken from the <nowiki>{{SCRIPTPATH}}</nowiki> [[:mw:Help:Magic words|magic word]] (for easier interwiki diffs see {{tlx|xdiff}})

== See also ==
* {{tlx|xdiff}}


[[Category:Internal link templates|Diff]]
[[Category:Internal link templates|Diff]]

Revision as of 12:06, 2 August 2019

Syntax: {{diff|diff|page|oldid|label}}

Instructions

  1. Open the history tab for the page in question.
  2. Click the "(prev)" link for the preferred diff.
  3. Add {{diff|diff|page|oldid|label}} where diff number is the number after "&diff=" in your address bar.

Example

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

Named parameters

Besides the traditionally used positional parameters, the template also supports named parameters:

  • page: the name of the page from where the diff is
  • cur: same as diff (may also be the number after "&cur=" in the URL)
  • diff: the number after "&diff=" as described above
  • oldid: the number after "&oldid="
  • label: the text to display for the diff link
  • server: default if not provided is //meta.wikimedia.org as taken from the {{SERVER}} magic word (for easier interwiki diffs see {{xdiff}})
  • scriptpath: default if not provided is /w as taken from the {{SCRIPTPATH}} magic word (for easier interwiki diffs see {{xdiff}})

See also