Difference between revisions of "Template:Baseballstats"

From blackwiki
Jump to navigation Jump to search
imported>Ruslik0
(per talk page request: https in espn links)
imported>Bagumba
 
Line 1: Line 1:
 
<includeonly>* Career statistics and player information from {{#if: {{{mlb|}}}
 
<includeonly>* Career statistics and player information from {{#if: {{{mlb|}}}
| [https://www.mlb.com/player/{{{mlb}}} MLB]{{#if: {{{espn|}}} {{{id|}}} {{{br|}}} {{{fangraphs|}}} {{{cube|}}} {{{brm|}}} {{{retro|}}}
+
| [https://www.mlb.com/player/{{{mlb}}} MLB]{{#if: {{{espn|}}} {{{id|}}} {{{br|}}} {{{fangraphs|}}} {{{brm|}}} {{{retro|}}}
 
   |, or&nbsp;
 
   |, or&nbsp;
 
   }}
 
   }}
 
}}{{#if: {{{espn|}}}
 
}}{{#if: {{{espn|}}}
| [https://www.espn.com/mlb/player/stats/_/id/{{{espn}}} ESPN]{{#if: {{{id|}}} {{{br|}}} {{{fangraphs|}}} {{{cube|}}} {{{brm|}}} {{{retro|}}}
+
| [https://www.espn.com/mlb/player/stats/_/id/{{{espn}}} ESPN]{{#if: {{{id|}}} {{{br|}}} {{{fangraphs|}}} {{{brm|}}} {{{retro|}}}
 
   |, or&nbsp;
 
   |, or&nbsp;
 
   }}
 
   }}
 
}}{{#if: {{{id|}}} {{{br|}}}
 
}}{{#if: {{{id|}}} {{{br|}}}
| [https://www.baseball-reference.com/players/{{{id|}}}{{{br|}}}.shtml Baseball-Reference]{{#if: {{{fangraphs|}}} {{{cube|}}} {{{brm|}}} {{{retro|}}}
+
| [https://www.baseball-reference.com/players/{{{id|}}}{{{br|}}}.shtml Baseball-Reference]{{#if: {{{fangraphs|}}} {{{brm|}}} {{{retro|}}}
 
   |, or&nbsp;
 
   |, or&nbsp;
 
   }}
 
   }}
 
}}{{#if: {{{fangraphs|}}}
 
}}{{#if: {{{fangraphs|}}}
| [https://www.fangraphs.com/statss.aspx?playerid={{{fangraphs}}} Fangraphs]{{#if: {{{cube|}}} {{{brm|}}} {{{retro|}}}
+
| [https://www.fangraphs.com/statss.aspx?playerid={{{fangraphs}}} Fangraphs]{{#if: {{{brm|}}} {{{retro|}}}
  |, or&nbsp;
 
  }}
 
}}{{#if: {{{cube|}}}
 
| {{#iferror: {{#invoke:String|match|s= {{{cube|}}} |pattern= [a-z]+ }}
 
  | [http://thebaseballcube.com/players/profile.asp?ID={{{cube}}} The Baseball Cube]
 
  | {{#iferror: {{#invoke:String|match|s= {{{cube|}}} |pattern= / }}
 
    | [http://thebaseballcube.com/profile.asp?P={{{cube}}} The Baseball Cube]
 
    | [http://thebaseballcube.com/players/{{{cube}}}.shtml The Baseball Cube]
 
    }}
 
  }}{{#if: {{{brm|}}} {{{retro|}}}
 
 
   |, or&nbsp;
 
   |, or&nbsp;
 
   }}
 
   }}
Line 31: Line 21:
 
}}{{#if: {{{retro|}}}
 
}}{{#if: {{{retro|}}}
 
| [https://www.retrosheet.org/boxesetc/{{{retro}}}.htm Retrosheet]
 
| [https://www.retrosheet.org/boxesetc/{{{retro}}}.htm Retrosheet]
}}<!-- Test for invalid cube= parameter (should be all-numeric):
+
}}<!-- Test for lack of any valid parameters:  
-->{{#if: {{{cube|}}}
+
-->{{#if: {{{br|}}} {{{brm|}}} {{{espn|}}} {{{fangraphs|}}} {{{id|}}} {{{mlb|}}} {{{retro|}}}
  | {{#iferror: {{#invoke:String|match|s= {{{cube|}}} |pattern= [a-z]+ }}
 
    | {{main other|[[Category:Pages using baseballstats with numeric value in cube parameter]]}}
 
    | {{main other|[[Category:Pages using baseballstats with non-numeric value in cube parameter]]}}{{red| Warning: [[Template:Baseballstats]] cube{{=}} parameter should be updated to a numeric value.}}
 
    }}
 
  }}<!-- 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|∑{{PAGENAME}}]]}}{{red| Error: [[Template:Baseballstats]] must contain at least one valid parameter name.}}
 
   | {{main other|[[Category:Pages using baseballstats with unknown parameters|∑{{PAGENAME}}]]}}{{red| Error: [[Template:Baseballstats]] must contain at least one valid parameter name.}}
Line 45: Line 29:
 
   | unknown = {{main other|[[Category:Pages using baseballstats with unknown parameters|_VALUE_{{PAGENAME}}]]}}
 
   | unknown = {{main other|[[Category:Pages using baseballstats with unknown parameters|_VALUE_{{PAGENAME}}]]}}
 
   | preview = Page using [[Template:Baseballstats]] with unknown parameter "_VALUE_"
 
   | preview = Page using [[Template:Baseballstats]] with unknown parameter "_VALUE_"
   | ignoreblank = y | br | brm | cube | espn | fangraphs | id | mlb | retro
+
   | ignoreblank = y | br | brm | espn | fangraphs | id | mlb | retro
 
   }}</includeonly><noinclude>
 
   }}</includeonly><noinclude>
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 05:52, 14 January 2020

Template documentation[view] [edit] [history] [purge]

Template:Wikidata property

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:

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 propertyScript error: No such module "If empty". 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

Script error: No such module "If empty". This template does not currently use Wikidata properties.

Maintenance/tracking categories