模板: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」的值)

不明非必填