Difference between revisions of "Template:Compare pages/doc"

From blackwiki
Jump to navigation Jump to search
imported>Technical 13
(Starting point... More documentation to go.)
 
imported>Vanisaac
m (→‎TemplateData: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(8 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
  
Similar to the {{Tl|Diff}} template, this template is intended to be useful for creating links to "[[Help:Diff|diffs]]"; that is, links to pages that show the differences between two versions of a wiki page.  The major difference is that {{Tlc|Diff}} is intended to show two version of the same page, and this creates a link to [[Special:ComparePages]] to show one version of two different pages.
+
Similar to the {{Tl|Diff}} template, this template is intended to be useful for creating links to "[[Help:Diff|diffs]]"; that is, links to pages that show the differences between two versions of a wiki page.  The major difference is that {{Tlc|Diff}} is intended to show two versions of the same page, and this creates a link to [[Special:ComparePages]] to show one version of two different pages.
  
 
Every version of a page has a revision ID, which you can find from the [[Help:Page history|history]] of the page by looking at the link for the timestamp, which is of the form:
 
Every version of a page has a revision ID, which you can find from the [[Help:Page history|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
+
  <nowiki>https://en.wikipedia.org/w/index.php?title=SomePageName&oldid=442212827</nowiki>
The number after <tt>oldid=</tt> is the revision ID.
+
The number after <kbd>oldid=</kbd> is the revision ID.
  
 
Given a page name and one or two revision IDs, you can construct links to several types of diffs.
 
Given a page name and one or two revision IDs, you can construct links to several types of diffs.
  
 
== Usage ==
 
== Usage ==
:{{Tlx|Compare pages|''page''/''oldid'' for page 1|''page''/''oldid'' for page 2}}
+
:{{Tlx|Compare pages|''page'' or ''oldid'' for page 1|''page'' or ''oldid'' for page 2}}
*<tt>''page''</tt>&nbsp;– The title of the page.
+
*<kbd>''page''</kbd>&nbsp;– The title of the page.
*<tt>''oldid''</tt>&nbsp;– The revision ID onto which the diff is generated.
+
*<kbd>''oldid''</kbd>&nbsp;– The revision ID onto which the diff is generated.
 
<!-- ADD IN DETAILS FOR {{{3}}}, {{{label}}}, {{{label1}}}, and {{{label2}}} once the bugs are ironed out. -->
 
<!-- ADD IN DETAILS FOR {{{3}}}, {{{label}}}, {{{label1}}}, and {{{label2}}} once the bugs are ironed out. -->
  
All parameters are required. Omitted parameters will return an error.
+
All parameters are required. Omitting parameters will return an error.
  
 
== Examples ==
 
== Examples ==
 
{| class="wikitable"
 
{| class="wikitable"
! style="width:33%;" | Code !! Output
+
! style="width:40%;" | Code !! Output
 
|-
 
|-
 
| <code><nowiki>{{Compare pages|Foo|Bar}}</nowiki></code>
 
| <code><nowiki>{{Compare pages|Foo|Bar}}</nowiki></code>
 
| {{Compare pages|Foo|Bar}}
 
| {{Compare pages|Foo|Bar}}
 
'''This is the form that would be used most often.'''
 
'''This is the form that would be used most often.'''
 +
|-
 +
| <code><nowiki>{{Compare pages|Foo|Bar|Difference between pages}}</nowiki></code>
 +
| {{Compare pages|Foo|Bar|Difference between pages}}
 
|-
 
|-
 
| <code><nowiki>{{Compare pages|Foo}}</nowiki></code>
 
| <code><nowiki>{{Compare pages|Foo}}</nowiki></code>
Line 37: Line 40:
 
* {{Tl|Diff2}}
 
* {{Tl|Diff2}}
 
* {{Tl|Querylink}}&nbsp;– generic template to construct [[query string]]s
 
* {{Tl|Querylink}}&nbsp;– generic template to construct [[query string]]s
* [[diff]]&nbsp;– syntax highlight on wiki pages with [[mw:Extension:SyntaxHighlight GeSHi]]
+
* [[diff utility]]&nbsp;– syntax highlight on wiki pages with [[mw:Extension:SyntaxHighlight GeSHi]]
 
* [[User:Scottywong/diffconverter]], a tool for converting from raw form
 
* [[User:Scottywong/diffconverter]], a tool for converting from raw form
 
* [[Special:ComparePages]]
 
* [[Special:ComparePages]]
Line 80: Line 83:
 
"type": "number",
 
"type": "number",
 
"label": "id",
 
"label": "id",
"description": "The ID to be compared with the base oldid. To be included ONLY if the parameter \"diff\" is NOT specified. This should be *larger* than <tt>oldid</tt>. Some number like \"442212827\" (without the quotes)."
+
"description": "The ID to be compared with the base oldid. To be included ONLY if the parameter \"diff\" is NOT specified. This should be *larger* than <kbd>oldid</kbd>. Some number like \"442212827\" (without the quotes)."
 
}
 
}
 
},
 
},
Line 89: Line 92:
 
-->
 
-->
  
<includeonly>
+
 
[[Category:Internal link templates|{{PAGENAME}}]]
+
<includeonly>{{Sandbox other||
 
[[Category:Diff templates|{{PAGENAME}}]]
 
[[Category:Diff templates|{{PAGENAME}}]]
[[Category:Cross-reference templates|{{PAGENAME}}]]
+
}}</includeonly>
</includeonly>
 

Latest revision as of 15:48, 24 April 2020

Similar to the {{Diff}} template, 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. The major difference is that {{Diff}} is intended to show two versions of the same page, and this creates a link to Special:ComparePages to show one version of two different pages.

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:

https://en.wikipedia.org/w/index.php?title=SomePageName&oldid=442212827

The number after oldid= is the revision ID.

Given a page name and one or two revision IDs, you can construct links to several types of diffs.

Usage

{{Compare pages|page or oldid for page 1|page or oldid for page 2}}
  • page – The title of the page.
  • oldid – The revision ID onto which the diff is generated.

All parameters are required. Omitting parameters will return an error.

Examples

Code Output
{{Compare pages|Foo|Bar}} Template:Plain link

This is the form that would be used most often.

{{Compare pages|Foo|Bar|Difference between pages}} Template:Plain link
{{Compare pages|Foo}} Two pages are needed to compare.
{{Compare pages||Bar}} Two pages are needed to compare.

See also