Difference between revisions of "Template:Cricinfo/doc"
imported>Zyxw (update Wikidata templates (uses and tracks), place examples after usage, document tracking category sort keys, add/update categories) |
imported>Zyxw (note use of module, misc formatting) |
||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> | <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> | ||
| − | {{Larger|{{Template | + | {{Larger|{{Template redirect|ESPNcricinfo}}}} |
{{Uses Wikidata|P2697}} | {{Uses Wikidata|P2697}} | ||
{{Tracks Wikidata|P2697}} | {{Tracks Wikidata|P2697}} | ||
| + | {{Lua|Module:EditAtWikidata}} | ||
| − | '''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to an [[ESPNcricinfo]] web page. Links to [[cricket]] player profiles are created with the "id" parameter and links to other pages are created with the "ref" parameter. | + | '''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to an [[ESPNcricinfo]] web page. Links to [[cricket]] player profiles are created with the "id" parameter and links to other pages are created with the "ref" parameter. It is intended for use in the [[Wikipedia:External links|external links]] section of an article. |
| + | |||
| + | For players, the "id" value should be added to the {{wpl|P2697}} property in [[Wikidata]]. Then, if the "id" or "ref" parameters are not specified, the template will retrieve the id from Wikidata. Discrepancies between a specified "id" parameter and the Wikidata property are reported at [[:Category:Cricinfo maintenance]]. | ||
== Usage == | == Usage == | ||
| Line 29: | Line 32: | ||
''Usage:'' | ''Usage:'' | ||
| − | : <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | + | : <code><nowiki>{{</nowiki>{{BASEPAGENAME}}}}</code> |
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar }} | : {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar }} | ||
''Usage with accessdate parameter:'' | ''Usage with accessdate parameter:'' | ||
| − | : <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | + | : <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | accessdate= 25 February 2017 }}</code> |
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar | accessdate= 25 February 2017 }} | : {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar | accessdate= 25 February 2017 }} | ||
| Line 72: | Line 75: | ||
"id": { | "id": { | ||
"label": "id", | "label": "id", | ||
| − | "description": "The \"id\" parameter should contain the ID number in the URL for the player's profile. Example: 35320 is the \"id\" in http://www.espncricinfo.com/ci/content/player/35320.html. | + | "description": "The \"id\" parameter should contain the ID number in the URL for the player's profile. Example: 35320 is the \"id\" in http://www.espncricinfo.com/ci/content/player/35320.html. It is required when not using the \"ref\" parameter or the Wikidata property.", |
"type": "number", | "type": "number", | ||
| − | "default": "Wikidata property P2697" | + | "required": false, |
| − | + | "default": "Wikidata property P2697" | |
}, | }, | ||
"ref": { | "ref": { | ||
"label": "ref", | "label": "ref", | ||
| − | "description": "The \"ref\" parameter is optional and only used when the player \"id\" is not specified. If used, it should contain the portion of the URL between \"http://www.espncricinfo.com/\" and \".html\". Example: pakistan/content/ground/59011 is the \"ref\" portion of http://www.espncricinfo.com/pakistan/content/ground/59011.html.", | + | "description": "The \"ref\" parameter is optional and only used when the player \"id\" is not specified. If used, it should contain the portion of the URL between \"http://www.espncricinfo.com/\" and \".html\". Example: pakistan/content/ground/59011 is the \"ref\" portion of http://www.espncricinfo.com/pakistan/content/ground/59011.html. It is required when not using the \"id\" parameter or the Wikidata property.", |
"type": "string", | "type": "string", | ||
"required": false | "required": false | ||
| Line 87: | Line 90: | ||
"description": "The \"name\" parameter may be used to specify the link text. This parameter is optional; it defaults to the Wikipedia article name, without any disambiguation such as \"(cricketer)\".", | "description": "The \"name\" parameter may be used to specify the link text. This parameter is optional; it defaults to the Wikipedia article name, without any disambiguation such as \"(cricketer)\".", | ||
"type": "string", | "type": "string", | ||
| − | "default": "{{PAGENAMEBASE}}" | + | "required": false, |
| − | + | "default": "{{PAGENAMEBASE}}" | |
}, | }, | ||
"accessdate": { | "accessdate": { | ||
Revision as of 03:05, 30 October 2017
| This is a documentation subpage for Template:Cricinfo. It contains usage information, categories and other content that is not part of the original template page. |
Template:Template redirect Template:Uses Wikidata Template:Tracks Wikidata
| This template uses Lua: |
Template:Cricinfo displays an external link to an ESPNcricinfo web page. Links to cricket player profiles are created with the "id" parameter and links to other pages are created with the "ref" parameter. It is intended for use in the external links section of an article.
For players, the "id" value should be added to the Template:Wpl property in Wikidata. Then, if the "id" or "ref" parameters are not specified, the template will retrieve the id from Wikidata. Discrepancies between a specified "id" parameter and the Wikidata property are reported at Category:Cricinfo maintenance.
Contents
Usage
Using "id" from Wikidata:
{{Cricinfo}}{{Cricinfo | name= NAME }}{{Cricinfo | name= NAME | accessdate= DATE }}
Using "id" parameter:
{{Cricinfo | id= ID }}{{Cricinfo | id= ID | name= NAME }}{{Cricinfo | id= ID | name= NAME | accessdate= DATE }}
Using "ref" parameter:
{{Cricinfo | ref= REF }}{{Cricinfo | ref= REF | name= NAME }}{{Cricinfo | ref= REF | name= NAME | accessdate= DATE }}
Examples
Using "id" from Wikidata
The Wikidata examples are simulated, they only work as shown if used in the Sachin Tendulkar article.
Usage:
{{Cricinfo}}- Sachin Tendulkar at ESPNcricinfoScript error: No such module "EditAtWikidata".
Usage with accessdate parameter:
{{Cricinfo | accessdate= 25 February 2017 }}- "Sachin Tendulkar". ESPNcricinfo. Retrieved 25 February 2017.
Using "id" parameter
URL:
Usage:
{{Cricinfo | id= 35320 | name= Sachin Tendulkar }}- Sachin Tendulkar at ESPNcricinfoScript error: No such module "EditAtWikidata".
Usage with accessdate parameter:
{{Cricinfo | id= 35320 | name= Sachin Tendulkar | accessdate= 25 February 2017 }}- "Sachin Tendulkar". ESPNcricinfo. Retrieved 25 February 2017.
Using "ref" parameter
URL:
Usage:
{{Cricinfo | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium }}- Zafar Ali Stadium at ESPNcricinfoScript error: No such module "EditAtWikidata".
Usage with ".html" in ref parameter:
{{Cricinfo | ref= pakistan/content/ground/59011.html | name= Zafar Ali Stadium }}- Zafar Ali Stadium at ESPNcricinfoScript error: No such module "EditAtWikidata".
Usage with accessdate parameter:
{{Cricinfo | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium | accessdate= 25 February 2017 }}- "Zafar Ali Stadium". ESPNcricinfo. Retrieved 25 February 2017.
TemplateData
TemplateData for Cricinfo
This template displays an external link to an ESPNcricinfo web page. Links to cricket player profiles are created with the "id" parameter and links to other pages are created with the "ref" parameter. If "id" and "ref" parameters are omitted, the value stored in Wikidata is used. It is intended for use in the external links section of an article.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| id | id | The "id" parameter should contain the ID number in the URL for the player's profile. Example: 35320 is the "id" in http://www.espncricinfo.com/ci/content/player/35320.html. It is required when not using the "ref" parameter or the Wikidata property.
| Number | optional |
| ref | ref | The "ref" parameter is optional and only used when the player "id" is not specified. If used, it should contain the portion of the URL between "http://www.espncricinfo.com/" and ".html". Example: pakistan/content/ground/59011 is the "ref" portion of http://www.espncricinfo.com/pakistan/content/ground/59011.html. It is required when not using the "id" parameter or the Wikidata property. | String | optional |
| name | name | The "name" parameter may be used to specify the link text. This parameter is optional; it defaults to the Wikipedia article name, without any disambiguation such as "(cricketer)".
| String | optional |
| accessdate | accessdate | The "accessdate" parameter may be used to document the date when the link was accessed or retrieved. This parameter is optional. | Date | optional |
| check-wikidata | check-wikidata | Set "check-wikidate=no" to prevent the template comparing the provided id or ref value against the value from wikidata. Use mainly when this template is used on list, place or other people's articles.
| String | optional |
Tracking category
- Category:Cricinfo maintenance (2) – handles multiple maintenance issues using category sort keys:
1: pages using template with unnamed parameter 12: pages using template with unnamed parameter 2Diff: pages using template with "id" number different than number in Wikidata propertyMissingID: pages using template with "id" or "ref" missing and Wikidata property does not exist
See also
{{Cricketarchive}}, which uses a similar format{{Yahoo! Cricket}}, which uses a similar format
Other ESPN external link templates: