模板:Diff - Wikiwand
For faster navigation, this Iframe is preloading the Wikiwand page for 模板:Diff.

模板:Diff

维基百科,自由的百科全书

[1]

文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

模板介绍

此模板用于快速在页面里以外部链接的方式添加指向该页所在语言的维基百科计划的某个指定标题页面版本差异的网页地址。虽然实际效果和直接粘贴URL地址基本一致,但是使用这个模板可以让长URL看起来更简短一些,也不会有大量的转义符,可以方便以后的编辑修改。

每一个可修改页面在条目上方都有一个历史按钮连接到该页面的页面历史,历史表中可以比较旧版本和当前版本的区别并查看一个特定版本。

使用方法

 ((diff|(({1))}|(({2))}|(({3))}|(({4))))}

参数:

  • (({1))}为页面标题(title
  • (({2))}为页面版本间的差异(diff),许可用的包括:
  • cur – 比较旧版本和当前版本的区别
  • prev – 比较旧版本和上一版本的区别
  • next – 比较旧版本和下一版本的区别
  • (({3))}为特定版本ID(oldid
  • (({4))}为外部链接上显示的文字(label

所有参数都是可选的,省略的参数必须是空的,但要正常显示差异必须有diff参数(或参数2)和oldid参数(或参数3,title参数并非必须),用法形如((diff||新版id|旧版id))或((diff|diff=新版id|oldid=旧版id))。您还可以使用命名变数:page=, diff=, oldid=label=

但若只需显示diff参数版本号与之前版本的差异,则oidid参数(或参数3)也可省略,形如((diff||新版id))或((diff|diff=新版id))。

最后会生成形如以下的外部链接:

 [http://(({语言前缀))}.wikipedia.org/w/index.php?title=(({1))}&diff=(({2))}&oldid=(({3))} (({4))}]

范例

Code Output
((diff|Main Page|204901573|202506579|Diff between two numbered versions of a page)) Diff between two numbered versions of a page
  • The page= parameter (parameter number 1) should be a name of a page, for instance Main Page.
  • The diff= parameter (parameter number 2) should be the larger revision number.
  • The oldid= parameter (parameter number 3) should be the smaller revision number.
((diff|Wikipedia:Pagediff|204934693|204901573|Diff between two numbered versions of a Pagediff page in Wikipedia namespace)) Diff between two numbered versions of a Pagediff page in Wikipedia namespace
  • The page= parameter (parameter number 1) should be a name of a page, for instance Wikipedia:Pagediff.
  • The diff= parameter (parameter number 2) should be the page revision to appear on the right (proposed change).
  • The oldid= parameter (parameter number 3) should be the page revision to appear on the left (original).
((diff|Main Page|prev|204901573|Diff between a numbered version and the previous version)) Diff between a numbered version and the previous version

This is the form that would be used most often.

  • The diff= parameter (parameter number 2) should be the word prev.
  • The oldid= parameter (parameter number 3) should be the known revision number.
((diff|Main Page|next|204901573|Diff between a numbered version and the subsequent version)) Diff between a numbered version and the subsequent version
  • The diff= parameter (parameter number 2) should be the word next.
  • The oldid= parameter (parameter number 3) should be the known revision number.
((diff|Main Page|cur|204901573|Diff between a numbered version and the current version of a page)) Diff between a numbered version and the current version of a page
  • The diff= parameter (parameter number 2) should be the word cur.
  • The oldid= parameter (parameter number 3) should be the known revision number.
((diff|Main Page|cur||Diff showing the most recent change to a page)) Diff showing the most recent change to a page
  • The diff= parameter (parameter number 2) should be the word cur.
  • The oldid= parameter (parameter number 3) should be empty.
((diff|Main Page||204901573|A link to a numbered version of a page)) A link to a numbered version of a page
  • The diff= parameter (parameter number 2) should be empty.
  • The oldid= parameter (parameter number 3) should be the known revision number.
  • The result is not actually a diff, so this might be considered misuse of the template. See the {{oldid}} template.

参见

  • {{Fullurl}}
  • {{Oldid}} – simplifies the case for linking to a known old version
  • {{Querylink}} – generic template to construct query strings
{{bottomLinkPreText}} {{bottomLinkText}}
模板:Diff
Listen to this article