Template:Formatter link

本页使用了标题或全文手工转换
维基百科,自由的百科全书
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

维基数据包含许多“外部标识符”,例如ATC代码 (P267)

这些代码可配合格式化统一资源定位符 (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.

示例

查询乙酰乙酸铝 (Q26979)ATC代码 (P267)

  • {{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}A02AB05

ATC代码 (P267)的“格式化URL”的获取方式:

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}} }}

另见

模板数据

用维基数据“格式化统一资源定位符(P1630)”组合一个代码值来产生一个URL

模板参数[编辑模板数据]

此模板首选参数不换行的行内格式。

参数描述类型状态
codecode

目标页面唯一ID值

未知必需
urlurl

维基数据“格式化统一资源定位符(P1630)”

未知必需
labellabel

链接文本(默认为“code”的值)

未知可选