Difference between revisions of "Template:Diff2/sandbox"

From blackwiki
Jump to navigation Jump to search
(sync)
(define in terms of Template:Diff)
Line 1: Line 1:
<includeonly><span class="plainlinks"><!--
+
<includeonly>{{#ifeq:{{{3|a}}}|{{{3|b}}}                 <!-- if third parameter is given, -->
-->[{{SERVER}}{{SCRIPTPATH}}/index.php?title=&diff=prev&oldid=<!--
+
|{{diff||prev|{{{1}}}#{{anchorencode:{{{2|}}}}}|{{{3}}}}} <!-- ...use the 2nd as the anchor and the 3rd as the title; -->
-->{{#ifeq: {{{3|a}}} | {{{3|b}}}                   <!-- if three parameters are given, -->
+
|{{diff||prev|{{{1}}}|{{{2}}}}}                          <!-- otherwise, use the 2nd as the title. -->
    | {{{1}}}#{{anchorencode:{{{2|}}}}} {{{3}}} <!-- ...use the 2nd as the anchor and the 3rd as the title; -->
+
}}</span></includeonly><noinclude>
    | {{{1}}} {{{2|}}}                             <!-- otherwise, use the 2nd as the title. -->
 
  }}]</span></includeonly><noinclude>
 
 
 
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 14:02, 23 January 2014

Template documentation[view] [edit] [history] [purge]

This template is intended to be useful for creating links to "diffs"; that is, links to pages that show the differences between two versions of a wiki page.

Every version of a page has a revision ID, which you can find from the history of the page by looking at the link for the timestamp, which is of the form:

http[s]://en.wikipedia.org/w/index.php?title=SomePageName&oldid=442212827

The number after oldid= is the revision ID.

This template does not require the page name, and provides a diff between a specified revision ID and the one immediately before it (i.e. what changed at a certain ID).

Usage

{{Diff2 |oldid|section|label}}
  • oldid – The base ID onto which the diff is generated.
  • section – (optional) The section (anchor) within the page.
  • label – (optional) Text to display as link. No label will give a numbered link.

If 3 parameters are specified (i.e. parameter {{{3}}} exists), parameter {{{2}}} is the section, and parameter {{{3}}} is the label. Otherwise, parameter {{{2}}}, if present, is the label (and the link is to the whole page).

(Consequently, specifying a section but no label can be achieved by leaving the label blank save for its pipe character, as in the fourth example below.)

Examples

Code Output
{{Diff2|123456789}} [1]
{{Diff2|123456789|SomeUser's edit to "Some article name"}} SomeUser's edit to "Some article name"
{{Diff2|123456789|External links|SomeUser's edit to "Some article name"}} SomeUser's edit to "Some article name"
{{Diff2|123456789|External links|}} [2]

Redirects

You can use the following text in place of "Diff2":

See also