Difference between revisions of "Template:Cricinfo/doc"

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
imported>Zyxw
(update examples)
Line 11: Line 11:
  
 
== Usage ==
 
== Usage ==
Using "id" from Wikidata:
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' <nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' | accessdate= ''DATE'' <nowiki>}}</nowiki></code>
 
 
 
Using "id" parameter:
 
Using "id" parameter:
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' <nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' <nowiki>}}</nowiki></code>
Line 25: Line 20:
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''REF'' | name= ''NAME'' <nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''REF'' | name= ''NAME'' <nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''REF'' | name= ''NAME'' | accessdate= ''DATE'' <nowiki>}}</nowiki></code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''REF'' | name= ''NAME'' | accessdate= ''DATE'' <nowiki>}}</nowiki></code>
 +
 +
Using [[Wikidata]] property {{Property|P2697}}:
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' <nowiki>}}</nowiki></code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' | accessdate= ''DATE'' <nowiki>}}</nowiki></code>
  
 
== Examples ==
 
== Examples ==
 
=== Using "id" from Wikidata ===
 
: ''The Wikidata examples are simulated; they only work as shown if used in the article for [[Sachin Tendulkar]].''
 
 
''Usage:''
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}}}</code>
 
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar }} [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/Q9488#P2697 |Edit this at Wikidata]]
 
 
''Usage with accessdate parameter:''
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | accessdate= 25 February 2017 }}</code>
 
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar | accessdate= 25 February 2017 }}
 
  
 
=== Using "id" parameter ===
 
=== Using "id" parameter ===
''URL:''
+
<kbd>[http://www.espncricinfo.com/ci/content/player/35320.html http://www.espncricinfo.com/ci/content/player/{{hilite|35320}}.html]</kbd>
: <kbd>[http://www.espncricinfo.com/ci/content/player/35320.html http://www.espncricinfo.com/ci/content/player/{{hilite|35320}}.html]</kbd>
 
  
 
''Usage:''
 
''Usage:''
Line 52: Line 40:
  
 
=== Using "ref" parameter ===
 
=== Using "ref" parameter ===
''URL:''
+
<kbd>[http://www.espncricinfo.com/pakistan/content/ground/59011.html http://www.espncricinfo.com/{{hilite|pakistan/content/player/39343}}.html]</kbd>
: <kbd>[http://www.espncricinfo.com/pakistan/content/ground/59011.html http://www.espncricinfo.com/{{hilite|pakistan/content/player/39343}}.html]</kbd>
 
  
 
''Usage:''
 
''Usage:''
Line 66: Line 53:
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium | accessdate= 25 February 2017 }}</code>
 
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium | accessdate= 25 February 2017 }}</code>
 
: {{{{BASEPAGENAME}} | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium | accessdate= 25 February 2017 }}
 
: {{{{BASEPAGENAME}} | ref= pakistan/content/ground/59011 | name= Zafar Ali Stadium | accessdate= 25 February 2017 }}
 +
 +
=== Using ID from Wikidata ===
 +
The Wikidata examples are simulated; they only work as shown if used in the article for [[Sachin Tendulkar]].
 +
 +
''Usage:''
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}}}</code>
 +
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar }} [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/Q9488#P2697 |Edit this at Wikidata]]
 +
 +
''Usage with accessdate parameter:''
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | accessdate= 25 February 2017 }}</code>
 +
: {{{{BASEPAGENAME}} | id= 35320 | name= Sachin Tendulkar | accessdate= 25 February 2017 }}
 +
 +
=== Missing "id" and "ref" parameter and no ID in Wikidata ===
 +
''Usage:''
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}}}</code>
 +
: {{{{BASEPAGENAME}} }}
  
 
== TemplateData ==
 
== TemplateData ==
Line 76: Line 79:
 
"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. It is required when not using the \"ref\" parameter or the Wikidata property.",
 
"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.",
 +
"default": "Wikidata property P2697",
 +
"example": "|id=35320",
 
"type": "number",
 
"type": "number",
"required": false,
+
"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.  It is required when not using the \"id\" parameter or the Wikidata property.",
 
"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.",
 +
"example": "|ref=pakistan/content/ground/59011",
 
"type": "string",
 
"type": "string",
 
"required": false
 
"required": false
Line 89: Line 94:
 
"label": "name",
 
"label": "name",
 
"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)\".",
 +
"default": "{{PAGENAMEBASE}}",
 +
"example": "|name=Sachin Tendulkar",
 
"type": "string",
 
"type": "string",
"required": false,
+
"required": false
"default": "{{PAGENAMEBASE}}"
 
 
},
 
},
 
"accessdate": {
 
"accessdate": {
 
"label": "accessdate",
 
"label": "accessdate",
"description": "The \"accessdate\" parameter may be used to document the date when the link was accessed or retrieved. This parameter is optional.",
+
"description": "The optional \"accessdate\" parameter may be used to document the date when the link was accessed or retrieved. It also changes the output to a citation format, such as \"Name\". ESPNcricinfo. Retrieved 25 February 2017.",
 +
"example": "|accessdate=25 February 2017",
 
"type": "date",
 
"type": "date",
 
"required": false
 
"required": false
Line 101: Line 108:
 
"check-wikidata": {
 
"check-wikidata": {
 
"label": "check-wikidata",
 
"label": "check-wikidata",
"description": "Set \"check-wikidata=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.",
+
"description": "Include \"check-wikidata=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.",
 +
"example": "|check-wikidata=no",
 
           "type": "string",
 
           "type": "string",
"example": "no",
 
 
"required": false
 
"required": false
 
}
 
}

Revision as of 06:17, 10 December 2019

Template:Template redirect

Template:Uses Wikidata Template:Tracks Wikidata

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.

Usage

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

Using Wikidata property Template:Property:

{{Cricinfo}}
{{Cricinfo | name= NAME }}
{{Cricinfo | name= NAME | accessdate= DATE }}

Examples

Using "id" parameter

http://www.espncricinfo.com/ci/content/player/35320.html

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

http://www.espncricinfo.com/pakistan/content/player/39343.html

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.

Using ID from Wikidata

The Wikidata examples are simulated; they only work as shown if used in the article for Sachin Tendulkar.

Usage:

{{Cricinfo}}
Sachin Tendulkar at ESPNcricinfoScript error: No such module "EditAtWikidata". Edit this at Wikidata

Usage with accessdate parameter:

{{Cricinfo | accessdate= 25 February 2017 }}
"Sachin Tendulkar". ESPNcricinfo. Retrieved 25 February 2017.

Missing "id" and "ref" parameter and no ID in Wikidata

Usage:

{{Cricinfo}}
Template:PAGENAMEBASE at ESPNcricinfoScript error: No such module "EditAtWikidata".

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

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.

Template parameters

ParameterDescriptionTypeStatus
idid

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.

Default
Wikidata property P2697
Example
|id=35320
Numberoptional
refref

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.

Example
|ref=pakistan/content/ground/59011
Stringoptional
namename

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)".

Default
{{PAGENAMEBASE}}
Example
|name=Sachin Tendulkar
Stringoptional
accessdateaccessdate

The optional "accessdate" parameter may be used to document the date when the link was accessed or retrieved. It also changes the output to a citation format, such as "Name". ESPNcricinfo. Retrieved 25 February 2017.

Example
|accessdate=25 February 2017
Dateoptional
check-wikidatacheck-wikidata

Include "check-wikidata=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.

Example
|check-wikidata=no
Stringoptional

Tracking category

  • Category:Cricinfo maintenance (2) – handles multiple maintenance issues using category sort keys:
    • 1: pages using template with unnamed parameter 1
    • 2: pages using template with unnamed parameter 2
    • Diff: pages using template with "id" number different than number in Wikidata property
    • MissingID: pages using template with "id" or "ref" missing and Wikidata property does not exist

See also

Other ESPN external link templates: