MediaWiki API 帮助
这是自动生成的MediaWiki API文档页面。
文档和例子:https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page
action=wbformatvalue
(main | wbformatvalue)
- 此模块需要读取权限。
- 来源:WikibaseClient
- 许可协议:GPL-2.0-or-later
格式数据值。
具体参数:
其他通用参数可用。
- generate
要生成的预期输出格式。
- 以下值中的一个:text/html、text/html; disposition=verbose、text/html; disposition=verbose-preview、text/plain、text/x-wiki
- 默认:text/x-wiki
- datavalue
要格式化的数据。这必须为数据类型对象的JSON序列化。
- 这个参数是必需的。
- datatype
值的数据类型。这与值的类型不同
- 以下值中的一个:commonsMedia、external-id、geo-shape、globe-coordinate、monolingualtext、quantity、string、tabular-data、time、url、wikibase-item、wikibase-property
- property
数据值所属的属性ID,应在没有datatype参数时使用。
- options
格式化程序应使用的选项。以JSON对象提供。
例子:
- 格式化简单字符串值。
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%22hello%22%2C%22type%22%3A%22string%22%7D [在沙盒中打开]
- 在HTML中格式化一个字符串值作为URL。
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%22http%3A%5C%2F%5C%2Facme.org%22%2C%22type%22%3A%22string%22%7D&datatype=url&generate=text%2Fhtml [在沙盒中打开]
- 將時間值格式化成純文字,如有需要會自動顯示日曆模型。
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%7B%22time%22%3A%22%2B1879-03-14T00%3A00%3A00Z%22%2C%22timezone%22%3A0%2C%22before%22%3A0%2C%22after%22%3A0%2C%22precision%22%3A11%2C%22calendarmodel%22%3A%22http%3A%5C%2F%5C%2Fwww.wikidata.org%5C%2Fentity%5C%2FQ1985727%22%7D%2C%22type%22%3A%22time%22%7D&datatype=time&generate=text%2Fplain&options=%7B%22showcalendar%22%3A%22auto%22%7D [在沙盒中打开]