Difference between revisions of "Template:Davis Cup player/doc"

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
imported>Zyxw
(update examples and TemplateData, add Category:External link templates using Wikidata)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{Wikidata property|P2641}}
+
{{Uses Wikidata|P2641}}
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to a tennis player's page at the [[Davis Cup]] website.
+
{{Lua|Module:EditAtWikidata}}
 +
 
 +
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to a tennis player's profile at [http://www.daviscup.com/ DavisCup.com], the official website of the [[Davis Cup]]. It is intended for use in the [[Wikipedia:External links|external links]] section of an article.
  
 
== Usage ==
 
== Usage ==
Zero parameters:
+
Unnamed parameters:
: <code>{{((}}{{BASEPAGENAME}}{{))}}</code> (uses id retrieved from wikidata)
+
: {{tlcw|{{BASEPAGENAME}} | <var>ID</var> }}
 +
: {{tlcw|{{BASEPAGENAME}} | <var>ID</var> | <var>NAME</var> }}
 +
 
 +
Named parameters:
 +
: {{tlcw|{{BASEPAGENAME}} | id{{=}} <var>ID</var> }}
 +
: {{tlcw|{{BASEPAGENAME}} | id{{=}} <var>ID</var> | name{{=}} <var>NAME</var> }}
 +
 
 +
Using [[Wikidata]] property [[d:Property:P2641|P2641]]:
 +
: {{tlcw|{{BASEPAGENAME}} }}
 +
: {{tlcw|{{BASEPAGENAME}} | name{{=}} <var>NAME</var> }}
 +
 
 +
== Examples ==
 +
 
 +
=== ID in template ===
 +
''Usage in the article [[James Blake (tennis)|James Blake]], with article name as link text:''
 +
: {{tlcw|a=1|{{BASEPAGENAME}} | 800198270 }}
 +
: {{tlcw|a=1|{{BASEPAGENAME}} | id{{=}} 800198270 }}
 +
 
 +
''Usage with name parameter as link text:''
 +
: {{tlcw|a=1|{{BASEPAGENAME}} | 800198270 | James Blake }}
 +
: {{tlcw|a=1|{{BASEPAGENAME}} | id{{=}} 800198270 | name{{=}} James Blake }}
 +
 
 +
''Output:''
 +
:* {{{{BASEPAGENAME}} | 800198270 | James Blake }}
 +
 
 +
''URLs:''
 +
: <kbd>[https://www.daviscup.com/en/players/player.aspx?id=800198270 https://www.daviscup.com/en/players/player.aspx?id={{hilite|800198270}}]</kbd>
 +
: <kbd><nowiki>http://</nowiki>www.daviscup.com/en/players/player/profile.aspx?playerid={{hilite|10021072}}</kbd> (former ID, [https://web.archive.org/web/20160314201710/http://www.daviscup.com/en/players/player/profile.aspx?playerid=10021072 archived 2016-03-14])
  
One parameter:
+
=== ID in Wikidata ===
: <code>{{((}}{{BASEPAGENAME}} | ''ID'' {{))}}</code>
+
''Usage in the article [[Rod Laver]]:''
: <code>{{((}}{{BASEPAGENAME}} | id= ''ID'' {{))}}</code>
+
: {{tlcw|a=1|{{BASEPAGENAME}} }}
 +
: {{tlcw|a=1|{{BASEPAGENAME}} | name{{=}} Rod Laver }}
  
Two parameters:
+
''Output:''
: <code>{{((}}{{BASEPAGENAME}} | ''ID'' | ''NAME'' {{))}}</code>
+
:* {{{{BASEPAGENAME}} | 800173355 | Rod Laver }} [[File:Blue pencil.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/Q105550#P2641 |Edit this at Wikidata]]
: <code>{{((}}{{BASEPAGENAME}} | id= ''ID'' | name= ''NAME'' {{))}}</code>
 
  
== TemplateData ==
+
''URLs:''
{{TemplateDataHeader}}
+
: <kbd>[https://www.daviscup.com/en/players/player.aspx?id=800173355 https://www.daviscup.com/en/players/player.aspx?id={{hilite|800173355}}]</kbd>
<templatedata>{
+
: <kbd><nowiki>http://</nowiki>www.daviscup.com/en/players/player/profile.aspx?playerid={{hilite|10002749}}</kbd> (former ID, [https://web.archive.org/web/20160314151826/http://www.daviscup.com/en/players/player/profile.aspx?playerid=10002749 archived 2016-03-14])
"description": "This template displays an external link to a tennis player's page at the Davis Cup website.",
 
"params": {
 
  "1": {
 
    "label": "ID",
 
    "aliases": ["id"],
 
    "description": "Player's ID number in the URL. Example: 10021072 is the ID in http://www.daviscup.com/en/players/player/profile.aspx?playerid=10021072",
 
    "type": "string",
 
    "default": "",
 
    "required": false
 
  },
 
  "2": {
 
    "label": "Name",
 
    "aliases": ["name"],
 
    "description": "Name of tennis player. If not given it defaults to the Wikipedia article name, without any disambiguation such as (tennis).",
 
    "type": "string",
 
    "default": "{{PAGENAME}}",
 
    "required": false
 
  }
 
}}</templatedata>
 
  
== Examples ==
+
=== No ID in template or Wikidata ===
 +
''Usage:''
 +
: {{tlcw|a=1|{{BASEPAGENAME}} }}
  
One parameter:
+
''Output:''
: [[James Blake (tennis)|James Blake]]:
+
:* {{{{BASEPAGENAME}} }}
: <code><nowiki>http://</nowiki>www.daviscup.com/en/players/player/profile.aspx?playerid={{hilite|800198270}}</code>
 
# <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | 800198270 }}</code>
 
#: {{{{BASEPAGENAME}} | 800198270 }}
 
# <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= 800198270 }}</code>
 
#: {{{{BASEPAGENAME}} | id= 800198270 }}
 
  
Two parameters:
+
== TemplateData ==
: [[Rod Laver]]:
+
{{TemplateData header}}
: <code><nowiki>http://</nowiki>www.daviscup.com/en/players/player/profile.aspx?playerid={{hilite|800173355}}</code>
+
<templatedata>
# <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | 800173355 | Rod Laver }}</code>
+
{
#: {{{{BASEPAGENAME}} | 800173355 | Rod Laver }}
+
  "description": "This template displays an external link to a tennis player's profile at DavisCup.com, the official website of the Davis Cup. It is intended for use in the external links section of an article.",
# <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= 800173355 | name= Rod Laver }}</code>
+
  "params": {
#: {{{{BASEPAGENAME}} | id= 800173355 | name= Rod Laver }}
+
    "id": {
 +
      "label": "id",
 +
      "aliases": ["1"],
 +
      "description": "The \"id\" parameter (or unnamed parameter \"1\") should contain the ID portion of the URL. Example: 800198270 is the ID in https://www.daviscup.com/en/players/player.aspx?id=800198270.",
 +
      "type": "number",
 +
      "required": false,
 +
      "default": "Wikidata property P2641"
 +
    },
 +
    "name": {
 +
      "label": "name",
 +
      "aliases": ["2"],
 +
      "description": "The \"name\" parameter (or unnamed parameter \"2\") may be used to specify the link text, which should be the name of the tennis player. This parameter is optional; it defaults to the Wikipedia article name, without any disambiguation such as \"(tennis)\".",
 +
      "type": "string",
 +
      "required": false,
 +
      "default": "{{PAGENAMEBASE}}"
 +
    }
 +
  },
 +
  "paramOrder": [
 +
    "id",
 +
    "name"
 +
  ]
 +
}
 +
</templatedata>
  
 
== See also ==
 
== See also ==
Line 61: Line 90:
 
* {{tl|ITF profile}} – external link to player page at the [[International Tennis Federation]]
 
* {{tl|ITF profile}} – external link to player page at the [[International Tennis Federation]]
 
* {{tl|ATP}}} – external link to player page at the [[Association of Tennis Professionals]]
 
* {{tl|ATP}}} – external link to player page at the [[Association of Tennis Professionals]]
 +
* {{tl|WTA}}} – external link to player page at the [[Women's Tennis Association]]
  
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
Line 66: Line 96:
 
[[Category:Tennis external link templates]]
 
[[Category:Tennis external link 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 13:21, 28 May 2018

Template:Uses Wikidata

Template:Davis Cup player displays an external link to a tennis player's profile at DavisCup.com, the official website of the Davis Cup. It is intended for use in the external links section of an article.

Usage

Unnamed parameters:

Template:Tlcw
Template:Tlcw

Named parameters:

Template:Tlcw
Template:Tlcw

Using Wikidata property P2641:

Template:Tlcw
Template:Tlcw

Examples

ID in template

Usage in the article James Blake, with article name as link text:

Template:Tlcw
Template:Tlcw

Usage with name parameter as link text:

Template:Tlcw
Template:Tlcw

Output:

URLs:

https://www.daviscup.com/en/players/player.aspx?id=800198270
http://www.daviscup.com/en/players/player/profile.aspx?playerid=10021072 (former ID, archived 2016-03-14)

ID in Wikidata

Usage in the article Rod Laver:

Template:Tlcw
Template:Tlcw

Output:

URLs:

https://www.daviscup.com/en/players/player.aspx?id=800173355
http://www.daviscup.com/en/players/player/profile.aspx?playerid=10002749 (former ID, archived 2016-03-14)

No ID in template or Wikidata

Usage:

Template:Tlcw

Output:

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 Davis Cup player

This template displays an external link to a tennis player's profile at DavisCup.com, the official website of the Davis Cup. It is intended for use in the external links section of an article.

Template parameters

ParameterDescriptionTypeStatus
idid 1

The "id" parameter (or unnamed parameter "1") should contain the ID portion of the URL. Example: 800198270 is the ID in https://www.daviscup.com/en/players/player.aspx?id=800198270.

Default
Wikidata property P2641
Numberoptional
namename 2

The "name" parameter (or unnamed parameter "2") may be used to specify the link text, which should be the name of the tennis player. This parameter is optional; it defaults to the Wikipedia article name, without any disambiguation such as "(tennis)".

Default
{{PAGENAMEBASE}}
Stringoptional

See also