MediaWiki API 帮助
这是自动生成的MediaWiki API文档页面。
文档和例子:https://www.mediawiki.org/wiki/API:Main_page/zh
action=compare
- 此模块需要读取权限。
 - 来源:MediaWiki
 - 许可协议:GPL-2.0-or-later
 
获取两页面之间的差异。
必须传递“from”和“to”之间的修订版本号、页面标题、页面ID、文本或相关参考资料。
- fromtitle
 要比较的第一个标题。
- fromid
 要比较的第一个页面 ID。
- Type: integer
 - fromrev
 要比较的第一个修订版本。
- Type: integer
 - fromslots
 Override content of the revision specified by fromtitle, fromid or fromrev.
This parameter specifies the slots that are to be modified. Use fromtext-{slot}, fromcontentmodel-{slot}, and fromcontentformat-{slot} to specify content for each slot.
- 值(以|或替代物分隔):main
 - fromtext-{slot}
 Text of the specified slot. If omitted, the slot is removed from the revision.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为fromslots的值。
 - fromsection-{slot}
 When fromtext-{slot} is the content of a single section, this is the section number. It will be merged into the revision specified by fromtitle, fromid or fromrev as if for a section edit.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为fromslots的值。
 - fromcontentformat-{slot}
 fromtext-{slot}的内容序列化格式
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为fromslots的值。
 - 以下值中的一个:application/json、text/css、text/javascript、text/plain、text/x-wiki
 - fromcontentmodel-{slot}
 Content model of fromtext-{slot}. If not supplied, it will be guessed based on the other parameters.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为fromslots的值。
 - 以下值中的一个:GadgetDefinition、JsonSchema、Scribunto、css、javascript、json、sanitized-css、smw/schema、text、wikitext
 - frompst
 在fromtext-{slot}执行预保存转变。
- Type: boolean (details)
 - fromtext
 - 已弃用。
 指定fromslots=main并改用fromtext-main。
- fromcontentformat
 - 已弃用。
 指定fromslots=main并改用fromcontentformat-main。
- 以下值中的一个:application/json、text/css、text/javascript、text/plain、text/x-wiki
 - fromcontentmodel
 - 已弃用。
 指定fromslots=main并改用fromcontentmodel-main。
- 以下值中的一个:GadgetDefinition、JsonSchema、Scribunto、css、javascript、json、sanitized-css、smw/schema、text、wikitext
 - fromsection
 - 已弃用。
 只使用指定“from”内容的指定章节。
- totitle
 要比较的第二个标题。
- toid
 要比较的第二个页面 ID。
- Type: integer
 - torev
 要比较的第二个修订版本。
- Type: integer
 - torelative
 使用与定义自fromtitle、fromid或fromrev的修订版本相关的修订版本。所有其他“to”的选项将被忽略。
- 以下值中的一个:cur、next、prev
 - toslots
 Override content of the revision specified by totitle, toid or torev.
This parameter specifies the slots that are to be modified. Use totext-{slot}, tocontentmodel-{slot}, and tocontentformat-{slot} to specify content for each slot.
- 值(以|或替代物分隔):main
 - totext-{slot}
 Text of the specified slot. If omitted, the slot is removed from the revision.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为toslots的值。
 - tosection-{slot}
 When totext-{slot} is the content of a single section, this is the section number. It will be merged into the revision specified by totitle, toid or torev as if for a section edit.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为toslots的值。
 - tocontentformat-{slot}
 Content serialization format of totext-{slot}.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为toslots的值。
 - 以下值中的一个:application/json、text/css、text/javascript、text/plain、text/x-wiki
 - tocontentmodel-{slot}
 Content model of totext-{slot}. If not supplied, it will be guessed based on the other parameters.
- 这是一个模板参数。当做出请求时,参数名中的{slot}应替换为toslots的值。
 - 以下值中的一个:GadgetDefinition、JsonSchema、Scribunto、css、javascript、json、sanitized-css、smw/schema、text、wikitext
 - topst
 在totext执行预保存转换。
- Type: boolean (details)
 - totext
 - 已弃用。
 使用该文本而不是由totitle、toid或torev指定的修订版本内容。
- tocontentformat
 - 已弃用。
 totext的内容序列化格式。
- 以下值中的一个:application/json、text/css、text/javascript、text/plain、text/x-wiki
 - tocontentmodel
 - 已弃用。
 totext的内容模型。如果未指定,这将基于其他参数猜想。
- 以下值中的一个:GadgetDefinition、JsonSchema、Scribunto、css、javascript、json、sanitized-css、smw/schema、text、wikitext
 - 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”修订版本的大小。
 - timestamp
 - (没有说明)
 
- 值(以|或替代物分隔):comment、diff、diffsize、ids、parsedcomment、rel、size、timestamp、title、user
 - Default: diff|ids|title
 - slots
 Return individual diffs for these slots, rather than one combined diff for all slots.
- 值(以|或替代物分隔):main
 - 要指定所有值,请使用*。
 
- 在版本1和2中创建差异。
 - api.php?action=compare&fromrev=1&torev=2 [在沙盒中打开]