模板:Formatter link/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索

维基数据包含许多“外部标识符”,例如Module:Wikibase第27行Lua错误:attempt to index field 'wikibase' (a nil value) (P267)

这些代码可配合Module:Wikibase第27行Lua错误:attempt to index field 'wikibase' (a nil value) (P1630)属性使用,例如在 http://www.whocc.no/atc_ddd_index/?code=$1 中,“$1”表示替换为对应ATC代码。

此模板将一个外部标识符作为|code=参数,格式化URL作为|url=参数,构造一个指向外部资源的链接;可选提供|label=参数来设置链接文本,缺省值为|code=参数的值。

Supplying the code as a parameter to this template allows one call to be made to Wikidata to fetch the code.

示例[编辑]

查询Module:Wikibase第27行Lua错误:attempt to index field 'wikibase' (a nil value) (Q26979)Module:Wikibase第27行Lua错误:attempt to index field 'wikibase' (a nil value) (P267)

Module:Wikibase第27行Lua错误:attempt to index field 'wikibase' (a nil value) (P267)的“格式化URL”的获取方式:

  • {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}Module:WikidataIB第761行Lua错误:attempt to index field 'wikibase' (a nil value)

In infoboxes, it will generally be hard-coded because it is specific to the infobox field. Otherwise the following can be used if Wikidata changes of the formatter url should be tracked:

  • {{Formatter link |url={{wdib |P1630 |qid=P267 |fwd=ALL |osd=n |noicon=y}} |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}

另见[编辑]

模板数据[编辑]

<templatedata> { "params": { "code": { "description": "目标页面唯一ID值", "required": true }, "url": { "description": "维基数据“格式化统一资源定位符(P1630)”", "required": true }, "label": { "description": "链接文本(默认为“code”的值)" } }, "description": "用维基数据“格式化统一资源定位符(P1630)”组合一个代码值来产生一个URL", "format": "inline" } </templatedata>