模板:Formatter link
維基數據包含許多「外部標識符」,例如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):
{{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}} }}→ Module:WikidataIB第761行Lua錯誤:attempt to index field 'wikibase' (a nil value) Module:WikidataIB第761行Lua錯誤:attempt to index field 'wikibase' (a nil value)
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}} }}
另見[編輯]
- {{Wikidata ID}}和{{Wikidata ID line}}
- {{format link}}名稱相似但完全不相干的另一個模板
模板資料[編輯]
<templatedata> { "params": { "code": { "description": "目標頁面唯一ID值", "required": true }, "url": { "description": "維基數據「格式化統一資源定位符(P1630)」", "required": true }, "label": { "description": "連結文本(預設為「code」的值)" } }, "description": "用維基數據「格式化統一資源定位符(P1630)」組合一個代碼值來產生一個URL", "format": "inline" } </templatedata>