Jump to content

Template:Diff: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
SLV100 (talk | contribs)
1 rv
add "server" and "scriptpath" params to support interwiki diffs, manually or by templates like Template:Xdiff, also document the named parameters (NB: need to double check "cur")
Line 3: Line 3:
|diff={{{diff|{{{1|cur}}}}}}&
|diff={{{diff|{{{1|cur}}}}}}&
}}oldid={{{oldid|{{{3|}}}}}}}}
}}oldid={{{oldid|{{{3|}}}}}}}}
|{{SERVER}}{{SCRIPTPATH}}/index.php?title={{#if:{{{diff|{{{1|cur}}}}}}
|{{{server|{{SERVER}}}}}{{{scriptpath|{{SCRIPTPATH}}}}}/index.php?title={{#if:{{{diff|{{{1|cur}}}}}}
|&diff={{{diff|{{{1|cur}}}}}}
|&diff={{{diff|{{{1|cur}}}}}}
}}&oldid={{{oldid|{{{3|}}}}}}
}}&oldid={{{oldid|{{{3|}}}}}}
}} {{#if:{{{label|{{{4|}}}}}}|{{{label|{{{4|}}}}}}|diff}}]</span></includeonly><noinclude>
}} {{#if:{{{label|{{{4|}}}}}}|{{{label|{{{4|}}}}}}|diff}}]</span></includeonly><noinclude>
:Syntax: {{tlx|diff|diff|page|oldid|label}}
:Syntax: {{tlx|diff|diff|page|oldid|label}}
==Instructions==
== Instructions ==
# Open the history tab for the page in question.
# Open the history tab for the page in question.
# Click the "(prev)" link for the preferred diff.
# Click the "(prev)" link for the preferred diff.
# Add {{tlx|diff|diff|page|oldid|label}} where ''diff number'' is the number after "&diff=" in your address bar.
# Add {{tlx|diff|diff|page|oldid|label}} where ''diff number'' is the number after "&diff=" in your address bar.

== Named parameters ==
Besides the traditionally used positional parameters, the template also supports named parameters:
* <code>page</code>: the name of the page from where the diff is
* <code>cur</code>: same as diff (may also be the number after "&cur=" in the URL)
* <code>diff</code>: the number after "&diff=" as described above
* <code>oldid</code>: the number after "&oldid="
* <code>label</code>: the text to display for the diff link
* <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}})

[[Category:Internal link templates|Diff]]
[[Category:Internal link templates|Diff]]
</noinclude>
</noinclude>

Revision as of 10:43, 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.

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}})