MediaWiki API 說明

此頁為自動產生的 MediaWiki API 說明文件頁面。

說明文件與範例:https://www.mediawiki.org/wiki/API

action=compare

main | compare

比較 2 個頁面間的差異。

"from" 以及 "to" 的修訂編號,頁面標題或頁面 ID 為必填。

參數:
fromtitle

要比對的第一個標題。

fromid

要比對的第一個頁面 ID。

類型:整數
fromrev

要比對的第一個修訂。

類型:整數
fromslots

覆蓋由 fromtitlefromidfromrev 指定的修訂內容。

此參數指定要變動的間隔。使用 fromtext-{slot}fromcontentmodel-{slot}、與 fromcontentformat-{slot} 來指定各間隔的內容。

多值 (以 |alternative 分隔):main
fromtext-{slot}

指定間隔的文字。若忽略的話,間隔會從修訂中移除。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 fromslots 的值。
fromsection-{slot}

fromtext-{slot} 是單一段落的內容時,這代表是段落的號碼。這會合併至由 fromtitlefromidfromrev 指定的修訂,就像用於段落編輯。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 fromslots 的值。
fromcontentformat-{slot}

fromtext-{slot} 的內容序列化格式。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 fromslots 的值。
單值:text/x-wikitext/javascriptapplication/jsontext/csstext/plain
fromcontentmodel-{slot}

fromtext-{slot} 內容模組。若不提供,則會根據其它參數猜測。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 fromslots 的值。
單值:wikitextjavascriptjsoncsstext
frompst

fromtext-{slot} 進行預先儲存轉換。

類型:布林值(詳細資訊
fromtext
已停用。

指定 fromslots=main 並改用 fromtext-main

fromcontentformat
已停用。

指定 fromslots=main 並改使用 fromcontentformat-main

單值:text/x-wikitext/javascriptapplication/jsontext/csstext/plain
fromcontentmodel
已停用。

指定 fromslots=main 並改使用 fromcontentmodel-main

單值:wikitextjavascriptjsoncsstext
fromsection
已停用。

僅使用 'from' 內容的指定段落。

totitle

要比對的第二個標題。

toid

要比對的第二個頁面 ID。

類型:整數
torev

要比對的第二個修訂。

類型:整數
torelative

使用判定自 fromtitlefromid、或 fromrev 之修訂相關的修訂。所有其它的 'to' 選項將會忽略。

單值:prevnextcur
toslots

覆蓋由 totitletoidtorev 指定的修訂內容。

此參數指定要變動的間隔。使用 totext-{slot}tocontentmodel-{slot}、與 tocontentformat-{slot} 來指定各間隔的內容。

多值 (以 |alternative 分隔):main
totext-{slot}

指定間隔的文字。若忽略的話,間隔會從修訂中移除。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 toslots 的值。
tosection-{slot}

totext-{slot} 是單一段落的內容時,這代表是段落的號碼。這會合併至由 totitletoidtorev 指定的修訂,就像用於段落編輯。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 toslots 的值。
tocontentformat-{slot}

totext-{slot} 的內容序列化格式。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 toslots 的值。
單值:text/x-wikitext/javascriptapplication/jsontext/csstext/plain
tocontentmodel-{slot}

totext-{slot} 內容模組。若不提供,則會基於其它參數來猜測。

此為模板參數。當做出請求時,在參數名稱裡的 {slot} 應替換成 toslots 的值。
單值:wikitextjavascriptjsoncsstext
topst

totext 執行預先保存轉換。

類型:布林值(詳細資訊
totext
已停用。

指定 toslots=main 並改用 totext-main

tocontentformat
已停用。

指定 toslots=main 並改使用 tocontentformat-main

單值:text/x-wikitext/javascriptapplication/jsontext/csstext/plain
tocontentmodel
已停用。

指定 toslots=main 並改使用 tocontentmodel-main

單值:wikitextjavascriptjsoncsstext
tosection
已停用。

僅使用 'to' 內容的指定段落。

prop

要取得的資訊部份。

diff
HTML 差異。
diffsize
以位元組為單位的 HTML 差異大小。
rel
'from' 之前與 'to' 之後修訂的修訂 ID,若有的話。
ids
「from」與「to」修訂的頁面與修訂 ID。
title
「from」與「to」修訂的頁面標題。
user
「from」與「to」修訂的使用者名稱與 ID。
comment
「from」與「to」修訂的註釋。
parsedcomment
「from」與「to」修訂的解析註釋。
size
「from」與「to」修訂的大小。
多值 (以 |alternative 分隔):diffdiffsizerelidstitleusercommentparsedcommentsize
預設值:diff|ids|title
slots

回傳這些間隔的個別差異,而不是由所有間隔所合併出的單一差異。

多值 (以 |alternative 分隔):main
要指定所有值,請使用*
範例:
建立修訂 1 與 1 的差異檔
api.php?action=compare&fromrev=1&torev=2 [在沙盒中開啟]