Difference between revisions of "Template:Baseballstats"
Jump to navigation
Jump to search
imported>Jonesey95 (removing period (full stop) per talk page; some people put custom text and links immediately after this template) |
imported>Jonesey95 (add test for invalid cube= parameter, tested in sandbox) |
||
Line 25: | Line 25: | ||
}}{{#if:{{{retro<includeonly>|</includeonly>}}} | }}{{#if:{{{retro<includeonly>|</includeonly>}}} | ||
|[https://www.retrosheet.org/boxesetc/{{{retro}}}.htm Retrosheet] | |[https://www.retrosheet.org/boxesetc/{{{retro}}}.htm Retrosheet] | ||
− | }}<!-- Test for lack of any valid parameters: -->{{#if:{{{br|}}}{{{brm|}}}{{{cube|}}}{{{espn|}}}{{{fangraphs|}}}{{{id|}}}{{{mlb|}}}{{{retro|}}}|| {{main other|[[Category:Pages using baseballstats with unknown parameters|∑]]{{red| Error: [[:Template:Baseballstats]] requires at least one parameter.}}}} }}<!-- Test for invalid parameters: -->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using baseballstats with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Baseballstats]] with unknown parameter "_VALUE_"|ignoreblank=y| br | brm | cube | espn | fangraphs | id | mlb | retro }}<noinclude> | + | }}<!--Test for invalid cube= parameter (should be all-numeric) -->{{main other|{{#if:{{{cube|}}}|{{#iferror:{{#invoke:String|match|s= {{{cube|}}} |pattern= [a-z]+ }}||[[Category:Pages using baseballstats with unknown parameters|Ω]] {{red|1= Error: [[:Template:Baseballstats]] cube= parameter must be all-numeric.}}}}}}}}<!-- Test for lack of any valid parameters: -->{{#if:{{{br|}}}{{{brm|}}}{{{cube|}}}{{{espn|}}}{{{fangraphs|}}}{{{id|}}}{{{mlb|}}}{{{retro|}}}|| {{main other|[[Category:Pages using baseballstats with unknown parameters|∑]]{{red| Error: [[:Template:Baseballstats]] requires at least one parameter.}}}} }}<!-- Test for invalid parameters: -->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using baseballstats with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Baseballstats]] with unknown parameter "_VALUE_"|ignoreblank=y| br | brm | cube | espn | fangraphs | id | mlb | retro }}<noinclude> |
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 10:28, 23 November 2018
- Career statistics and player information from MLB, or ESPN, or Baseball-Reference, or Fangraphs, or The Baseball Cube, or Baseball-Reference (Minors), or Retrosheet
![]() | This template uses Lua: |
Usage
To use this template, copy and paste this text to a baseball player's external links section:
{{Baseballstats |mlb= |espn= |br= |fangraphs= |brm= |retro=}}
Add the page ID's after the equals sign to properly direct the links that you desire to have. If you do not specify an ID, the site will not be shown.
Example
Example for Chris Young (outfielder):
{{Baseballstats |mlb= 455759 |espn= 6514 |br= y/youngch04 |fangraphs= 3882 |brm= young-001chr |retro= Y/Pyounc004 }}
results in:
- Career statistics and player information from MLB, or ESPN, or Baseball-Reference, or Fangraphs, or Baseball-Reference (Minors), or Retrosheet
To find a player's ID, find the player's page on a website and locate a string of numbers or letters in the URL similar to the ones above. That is the player's ID.
Parameters
Parameter | Website | Wikidata property![]() |
URL |
---|---|---|---|
|mlb=
|
MLB.com | P3541 | https://mlb.mlb.com/team/player.jsp?player_id={{{mlb}}} |
|espn=
|
ESPN.com | P3571 | https://www.espn.com/mlb/player/stats/_/id/{{{espn}}} |
|br=
|
Baseball-Reference.com | P1825 | https://www.baseball-reference.com/players/{{{br}}}.shtml |
|fangraphs=
|
Fangraphs.com | P3574 | https://www.fangraphs.com/statss.aspx?playerid={{{fangraphs}}} |
|brm=
|
Baseball-Reference.com (Minors) | P1826 | https://www.baseball-reference.com/minors/player.cgi?id={{{brm}}} |
|retro=
|
Retrosheet.org | https://www.retrosheet.org/boxesetc/{{retro}}.htm |
This template does not currently use Wikidata properties.
Maintenance/tracking categories
The above documentation is transcluded from Template:Baseballstats/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |