MediaWiki API 帮助

这是一个自动生成的 MediaWiki API 文档页面。

文档和示例: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page

action=compare

( | compare)

获取两个页面之间的差异。

必须传递一个修订号、页面标题、页面 ID、文本或“from”和“to”的相对引用。

特定参数
其他通用参数可用。
fromtitle

要比较的第一个标题。

fromid

要比较的第一个页面 ID。

类型:integer
fromrev

要比较的第一个修订。

类型:integer
fromslots

覆盖由 fromtitlefromidfromrev 指定的修订的内容。

此参数指定要修改的槽位。使用 fromtext-{slot}fromcontentmodel-{slot}fromcontentformat-{slot} 为每个槽位指定内容。

值(用 |其他方式分隔): main
fromtext-{slot}

指定槽位的文本。如果省略,则该槽位将从修订中删除。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 fromslots 的值。
fromsection-{slot}

fromtext-{slot} 是单个章节的内容时,这是章节标识符。它将被合并到由 fromtitlefromidfromrev 指定的修订中,就像用于章节编辑一样。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 fromslots 的值。
fromcontentformat-{slot}

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

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 fromslots 的值。
以下值之一:application/json, application/octet-stream, application/unknown, application/vue+xml, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown
fromcontentmodel-{slot}

fromtext-{slot} 的内容模型。如果未提供,将根据其他参数进行猜测。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 fromslots 的值。
以下值之一:GadgetDefinition, Graph.JsonConfig, Json.JsonConfig, JsonSchema, MassMessageListContent, Scribunto, SecurePoll, css, javascript, json, sanitized-css, text, unknown, vue, wikitext
frompst

fromtext-{slot} 执行预保存转换。

类型:布尔值(详情
fromtext
已弃用。

指定 fromslots=main 并改用 fromtext-main

fromcontentformat
已弃用。

指定 fromslots=main 并改用 fromcontentformat-main

以下值之一:application/json, application/octet-stream, application/unknown, application/vue+xml, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown
fromcontentmodel
已弃用。

指定 fromslots=main 并改用 fromcontentmodel-main

以下值之一:GadgetDefinition, Graph.JsonConfig, Json.JsonConfig, JsonSchema, MassMessageListContent, Scribunto, SecurePoll, css, javascript, json, sanitized-css, text, unknown, vue, wikitext
fromsection
已弃用。

仅使用指定“from”内容的指定章节。

totitle

要比较的第二个标题。

toid

要比较的第二个页面 ID。

类型:integer
torev

要比较的第二个修订。

类型:integer
torelative

使用相对于从 fromtitlefromidfromrev 确定的修订的修订。所有其他“to”选项将被忽略。

以下值之一:cur、next、prev
toslots

覆盖由 totitletoidtorev 指定的修订的内容。

此参数指定要修改的槽位。使用 totext-{slot}tocontentmodel-{slot}tocontentformat-{slot} 为每个槽位指定内容。

值(用 |其他方式分隔): main
totext-{slot}

指定槽位的文本。如果省略,则该槽位将从修订中删除。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 toslots 的值。
tosection-{slot}

totext-{slot} 是单个章节的内容时,这是章节标识符。它将被合并到由 totitletoidtorev 指定的修订中,就像用于章节编辑一样。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 toslots 的值。
tocontentformat-{slot}

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

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 toslots 的值。
以下值之一:application/json, application/octet-stream, application/unknown, application/vue+xml, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown
tocontentmodel-{slot}

totext-{slot} 的内容模型。如果未提供,将根据其他参数进行猜测。

这是一个 模板化参数。当发出请求时,参数名称中的 {slot} 应替换为 toslots 的值。
以下值之一:GadgetDefinition, Graph.JsonConfig, Json.JsonConfig, JsonSchema, MassMessageListContent, Scribunto, SecurePoll, css, javascript, json, sanitized-css, text, unknown, vue, wikitext
topst

totext 执行预保存转换。

类型:布尔值(详情
totext
已弃用。

指定 toslots=main 并改用 totext-main

tocontentformat
已弃用。

指定 toslots=main 并改用 tocontentformat-main

以下值之一:application/json, application/octet-stream, application/unknown, application/vue+xml, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown
tocontentmodel
已弃用。

指定 toslots=main 并改用 tocontentmodel-main

以下值之一:GadgetDefinition, Graph.JsonConfig, Json.JsonConfig, JsonSchema, MassMessageListContent, Scribunto, SecurePoll, css, javascript, json, sanitized-css, text, unknown, vue, wikitext
tosection
已弃用。

仅使用指定“to”内容的指定章节。

prop

要获取的信息片段。

diff
差异 HTML。
diffsize
差异 HTML 的大小,以字节为单位。
rel
如果存在,则为“from”之前和“to”之后的修订的修订 ID。
ids
“from”和“to”修订的页面和修订 ID。
title
“from”和“to”修订的页面标题。
user
“from”和“to”修订的用户名和 ID。如果用户已被修订删除,将返回 fromuserhiddentouserhidden 属性。
comment
“from”和“to”修订的评论。如果评论已被修订删除,将返回 fromcommenthiddentocommenthidden 属性。
parsedcomment
“from”和“to”修订的已解析评论。如果评论已被修订删除,将返回 fromcommenthiddentocommenthidden 属性。
size
“from”和“to”修订的大小。
timestamp
“from”和“to”修订的时间戳。
值(用 |备用方案 分隔):comment、diff、diffsize、ids、parsedcomment、rel、size、timestamp、title、user
默认值:diff|ids|title
slots

为这些槽位返回单独的差异,而不是所有槽位的组合差异。

值(用 |其他方式分隔): main
要指定所有值,请使用 *
difftype

将比较格式化为内联 HTML。

以下值之一:inline、table、unified
默认值:table
示例
在修订 1 和 2 之间创建差异。
api.php?action=compare&fromrev=1&torev=2 [在沙盒中打开]