跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
代码酷
搜索
搜索
中文(中国大陆)
外观
创建账号
登录
个人工具
创建账号
登录
未登录编辑者的页面
了解详情
贡献
讨论
编辑“︁
模板:Wikidata/doc
”︁(章节)
模板
讨论
大陆简体
阅读
编辑源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
编辑源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
外观
移至侧栏
隐藏
您的更改会在有权核准的用户核准后向读者展示。
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
== Usage == The general structure of a call to this {{lcfirst:{{NAMESPACE}}}} is as follows. Note that the basic structure consists of positional commands, flags and arguments, which all have a fixed position. :{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}{{0| }}{{Background color|#cddae3|<nowiki>|command1|flag1a|flag1b|flag1c</nowiki>}}{{0| }}{{Background color|#dce5ec|<nowiki>|command2|flag2a|flag2b|flag2c</nowiki>}}{{0| }}{{Background color|#c1debf|<nowiki>|flag0a|flag0b|flag0c</nowiki>}}{{0| }}{{Background color|#ffdfc4|<nowiki>|arg1|arg2|arg3</nowiki>}}}} Use different [[#Commands|{{Background color|#cddae3|commands}}]] to get different kinds of values from Wikidata. At least one command must be given and multiple commands can be combined into one call as shown above (in any order, more than two is also possible), but this only applies to commands from the [[#Claim class|claim class]]; calls containing a command from the [[#General class|general class]] cannot contain any other command. Each command can be followed by any number of [[#Command flags|{{Background color|#cddae3|command flags}}]], which are optional and can be used to tweak the output generated by that command. The commands and their flags may be followed by any number of [[#Configuration flags|{{Background color|#c1debf|configuration flags}}]], which are also optional and affect the selection of data and the {{lcfirst:{{NAMESPACE}}}}'s behaviour in general. The call is closed with the [[#Positional arguments|{{Background color|#ffdfc4|positional arguments}}]], which may be required depending on the given command(s). Some [[#Named arguments|named arguments]] (i.e. name-value pairs) also exist, as well as a set of named flags for [[#Advanced usage|advanced usage]] that can be used to change the way the fetched values are merged together into the output. This {{lcfirst:{{NAMESPACE}}}} was designed to provide the basic needs for fetching data from Wikidata, but a lot can be achieved through different combinations of calls. For convenience, such combinations could be wrapped into new templates that serve a specific need. See also the section on [[#Common use cases|common use cases]] below for some examples of useful "building blocks". Likewise, the functionality of this {{lcfirst:{{NAMESPACE}}}} can be extended by creating wrapper templates that use the [[Module:Wd#Main class|<code>main</code> command]] provided by {{module other|this module|[[Module:Wd]] which is being used by this template}} (just like {{tl|WikidataOI}} does). === Common use cases === Below follows a list of common use cases. In the future, shortcut commands may be implemented that are equivalent to these calls for convenience. {| class="wikitable" |- ! Call ! Use case |- | {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}}} | Returns the Q-identifier of the Wikidata item connected to the current page (e.g. "Q55"). |- | {{nowrap|<code><nowiki>{{#if:</nowiki>{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}<nowiki>|...}}</nowiki></code>}} | Performs a check to determine if the current page has a Wikidata item. Note that this statement relies on a returned value that is either empty or non-empty and that the <code>raw</code> flag is important to include. Without this flag, an existing item's regular label would be returned which could be empty, giving an undesired result. If the flag is given on the other hand, then a non-empty Q-identifier is always returned if an item exists and an empty value if an item does not exist. |}
摘要:
请注意,所有对代码酷的贡献均被视为依照知识共享署名-非商业性使用-相同方式共享发表(详情请见
代码酷:著作权
)。如果您不希望您的文字作品被随意编辑和分发传播,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)