Difference between revisions of "Template:HockeyDB/doc"

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
m (Zyxw moved page Template:Hockeydb/doc to Template:HockeyDB/doc: match move of template)
imported>Zyxw
(updates for handling of missing ID and use of Wikidata property for player if ID not specified, 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. -->
 +
{{Uses Wikidata|P2602}}
 +
{{Lua|Module:EditAtWikidata}}
  
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to [[ice hockey]] player's or team's statistics at [http://www.hockeydb.com HockeyDB.com].
+
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to [[ice hockey]] player's or team's statistics at [http://www.hockeydb.com HockeyDB.com]. It is intended for use in the [[Wikipedia:External links|external links]] section of an article.
  
 
== Usage ==
 
== Usage ==
 +
 
=== Player ===
 
=== Player ===
 
Unnamed parameters:
 
Unnamed parameters:
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|''ID''<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' }}</code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|''ID''|''NAME''<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' | ''NAME'' }}</code>
  
 
Named parameters:
 
Named parameters:
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|id=''ID''<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' }}</code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|id=''ID''|name=''NAME''<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' | name= ''NAME'' }}</code>
 +
 
 +
Using [[Wikidata]] property [[d:Property:P2602|P2602]]:
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' }}</code>
  
 
=== Team ===
 
=== Team ===
 
Unnamed parameters:
 
Unnamed parameters:
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|''ID''|team=yes<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes | ''ID'' }}</code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|''ID''|''NAME''|team=yes<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes | ''ID'' | ''NAME'' }}</code>
  
 
Named parameters:
 
Named parameters:
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|id=''ID''|team=yes<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes | id= ''ID'' }}</code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|id=''ID''|name=''NAME''|team=yes<nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes | id= ''ID'' | name= ''NAME'' }}</code>
 
 
== TemplateData ==
 
{{TemplateDataHeader}}
 
<templatedata>{
 
"description": "This template displays an external link to an ice hockey player's or team's statistics at HockeyDB.com.",
 
"params": {
 
  "1": {
 
    "label": "ID",
 
    "aliases": ["id"],
 
    "description": "Player's or team's ID number in the URL. Player: 73288 is the ID in http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288. Team: 690 is the ID in http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690.",
 
    "type": "number",
 
    "default": "",
 
    "required": true
 
  },
 
  "2": {
 
    "label": "Name",
 
    "aliases": ["name","title"],
 
    "description": "Name of player or team. If not given it defaults to the Wikipedia article name, without any disambiguation such as (ice hockey).",
 
    "type": "string",
 
    "default": "{{PAGENAME}}",
 
    "required": false
 
  },
 
  "team": {
 
    "label": "Team",
 
    "description": "If team=yes, the template will display team statistics instead of individual player statistics.",
 
    "type": "string",
 
    "default": "",
 
    "required": false
 
  }
 
}}</templatedata>
 
  
 
== Examples ==
 
== Examples ==
  
 
=== Player ===
 
=== Player ===
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb | 73288 | Sidney Crosby }}</code>
+
http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288
* ''Output:'' {{Hockeydb | 73288 | Sidney Crosby }}
 
* ''URL:'' http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288
 
  
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb |id= 73288 |name= Sidney Crosby }}</code>
+
; Unnamed parameters
* ''Output:'' {{Hockeydb |id= 73288 |name= Sidney Crosby }}
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | 73288 | Sidney Crosby }}</code>
* ''URL:'' http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288
+
: {{{{BASEPAGENAME}} | 73288 | Sidney Crosby }}
  
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb |id= 73288 |title= Sidney Crosby }}</code>
+
; Named parameters (id, name)
* ''Output:'' {{Hockeydb |id= 73288 |title= Sidney Crosby }}
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} |id= 73288 |name= Sidney Crosby }}</code>
* ''URL:'' http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288
+
: {{{{BASEPAGENAME}} |id= 73288 |name= Sidney Crosby }}
 +
 
 +
; Named parameters (id, title)
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} |id= 73288 |title= Sidney Crosby }}</code>
 +
: {{{{BASEPAGENAME}} |id= 73288 |title= Sidney Crosby }}
 +
 
 +
; Missing ID parameter and Wikidata property not defined
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: {{{{BASEPAGENAME}}<!-- -->}}
  
 
=== Team ===
 
=== Team ===
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb | 690 | Colorado Avalanche |team= yes }}</code>
+
http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690
* ''Output:'' {{Hockeydb | 690 | Colorado Avalanche |team= yes }}
+
 
* ''URL:'' http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690
+
; Unnamed parameters
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes | 690 | Colorado Avalanche }}</code>
 +
: {{{{BASEPAGENAME}} | team= yes | 690 | Colorado Avalanche }}
 +
 
 +
; Named parameters (id, name)
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes |id= 690 |name= Colorado Avalanche }}</code>
 +
: {{{{BASEPAGENAME}} | team= yes |id= 690 |name= Colorado Avalanche }}
 +
 
 +
; Named parameters (id, title)
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes |id= 690 |title= Colorado Avalanche }}</code>
 +
: {{{{BASEPAGENAME}} | team= yes |id= 690 |title= Colorado Avalanche }}
  
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb |id= 690 |name= Colorado Avalanche |team= yes }}</code>
+
; Missing ID parameter
* ''Output:'' {{Hockeydb |id= 690 |name= Colorado Avalanche |team= yes }}
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | team= yes }}</code>
* ''URL:'' http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690
+
: {{{{BASEPAGENAME}} | team= yes }}
  
''Usage:'' <code><nowiki>{{</nowiki>Hockeydb |id= 690 |title= Colorado Avalanche |team= yes }}</code>
+
== TemplateData ==
* ''Output:'' {{Hockeydb |id= 690 |title= Colorado Avalanche |team= yes }}
+
{{TemplateData header}}
* ''URL:'' http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690
+
<templatedata>
 +
{
 +
  "description": "This template displays an external link to ice hockey player's or team's statistics at HockeyDB.com. It is intended for use in the external links section of an article.",
 +
  "params": {
 +
    "id": {
 +
      "label": "id",
 +
      "aliases": ["1"],
 +
      "description": "Player's or team's ID number in the URL. Player: 73288 is the ID in http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288. Team: 690 is the ID in http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690. For players, this parameter is optional if Wikidata property 2602 exists, but required if not. For teams, this parameter is required.",
 +
      "type": "number",
 +
      "required": false,
 +
      "default": "Wikidata property P2602 (for players)"
 +
    },
 +
    "name": {
 +
      "label": "name",
 +
      "aliases": ["title", "2"],
 +
      "description": "Name of player or team. If not given it defaults to the Wikipedia article name, without any disambiguation such as (ice hockey).",
 +
      "type": "string",
 +
      "required": false,
 +
      "default": "{{PAGENAMEBASE}}"
 +
    },
 +
    "team": {
 +
      "label": "team",
 +
      "description": "If team=yes, the template will display team statistics instead of individual player statistics.",
 +
      "type": "string",
 +
      "required": false
 +
    }
 +
  },
 +
  "paramOrder": [
 +
    "id",
 +
    "name",
 +
    "team"
 +
  ]
 +
}
 +
</templatedata>
  
 
== See also ==
 
== See also ==
Line 101: Line 127:
 
[[Category:WikiProject Ice Hockey templates]]
 
[[Category:WikiProject Ice Hockey templates]]
 
[[Category:People and person external link templates]]
 
[[Category:People and person external link templates]]
 +
[[Category:External link templates using Wikidata]]
 
}}</includeonly>
 
}}</includeonly>

Revision as of 09:57, 25 April 2017

Template:Uses Wikidata

Template:HockeyDB displays an external link to ice hockey player's or team's statistics at HockeyDB.com. It is intended for use in the external links section of an article.

Usage

Player

Unnamed parameters:

{{HockeyDB | ID }}
{{HockeyDB | ID | NAME }}

Named parameters:

{{HockeyDB | id= ID }}
{{HockeyDB | id= ID | name= NAME }}

Using Wikidata property P2602:

{{HockeyDB}}
{{HockeyDB | name= NAME }}

Team

Unnamed parameters:

{{HockeyDB | team= yes | ID }}
{{HockeyDB | team= yes | ID | NAME }}

Named parameters:

{{HockeyDB | team= yes | id= ID }}
{{HockeyDB | team= yes | id= ID | name= NAME }}

Examples

Player

http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288

Unnamed parameters
{{HockeyDB | 73288 | Sidney Crosby }}
Sidney Crosby career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Named parameters (id, name)
{{HockeyDB |id= 73288 |name= Sidney Crosby }}
Sidney Crosby career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Named parameters (id, title)
{{HockeyDB |id= 73288 |title= Sidney Crosby }}
Template:PAGENAMEBASE career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Missing ID parameter and Wikidata property not defined
{{HockeyDB}}
Template:PAGENAMEBASE career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".

Team

http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690

Unnamed parameters
{{HockeyDB | team= yes | 690 | Colorado Avalanche }}
Colorado Avalanche career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Named parameters (id, name)
{{HockeyDB | team= yes |id= 690 |name= Colorado Avalanche }}
Colorado Avalanche career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Named parameters (id, title)
{{HockeyDB | team= yes |id= 690 |title= Colorado Avalanche }}
Template:PAGENAMEBASE career statistics at The Internet Hockey DatabaseScript error: No such module "EditAtWikidata".
Missing ID parameter
{{HockeyDB | team= yes }}
Template:PAGENAMEBASE career statistics at The Internet Hockey DatabaseScript 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 HockeyDB

This template displays an external link to ice hockey player's or team's statistics at HockeyDB.com. It is intended for use in the external links section of an article.

Template parameters

ParameterDescriptionTypeStatus
idid 1

Player's or team's ID number in the URL. Player: 73288 is the ID in http://www.hockeydb.com/ihdb/stats/pdisplay.php?pid=73288. Team: 690 is the ID in http://www.hockeydb.com/ihdb/stats/teamseasons.php?tid=690. For players, this parameter is optional if Wikidata property 2602 exists, but required if not. For teams, this parameter is required.

Default
Wikidata property P2602 (for players)
Numberoptional
namename title 2

Name of player or team. If not given it defaults to the Wikipedia article name, without any disambiguation such as (ice hockey).

Default
{{PAGENAMEBASE}}
Stringoptional
teamteam

If team=yes, the template will display team statistics instead of individual player statistics.

Stringoptional

See also

Ice hockey player external link templates: