Difference between revisions of "Template:AFL Tables/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Pigsonthewing
m (→‎top: p)
blackwiki>Zyxw
(updates related to use of Wikidata property, add category, 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|P3547}}
 +
{{Lua|Module:EditAtWikidata}}
  
{{Wikidata property|P3547}}
+
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays a uniformly formatted external link to an [[Australian Football League]] (AFL) player's profile page on the [http://afltables.com/ AFL Tables] website. It is intended for use in the [[Wikipedia:External links|external links]] section of an article.
 
 
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays a uniformly formatted external link to an [[Australian Football League]] (AFL) player's profile page on the [http://afltables.com AFL Tables] website.
 
  
 
== Usage ==
 
== Usage ==
 
Unnamed parameters:
 
Unnamed parameters:
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' <nowiki>}}</nowiki></code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' | ''NAME'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''ID'' | ''NAME'' <nowiki>}}</nowiki></code>
  
 
Named parameters (id, name):
 
Named parameters (id, name):
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' <nowiki>}}</nowiki></code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' | name= ''NAME'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''ID'' | name= ''NAME'' <nowiki>}}</nowiki></code>
  
 
Named parameters (ref, alt):
 
Named parameters (ref, alt):
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''ID'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''ID'' <nowiki>}}</nowiki></code>
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''ID'' | alt= ''NAME'' <nowiki>}}</nowiki></code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= ''ID'' | alt= ''NAME'' <nowiki>}}</nowiki></code>
  
 +
Using [[Wikidata]] property [[d:Property:P3547|P3547]]:
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''NAME'' }}</code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | alt= ''NAME'' }}</code>
 +
 +
== Parameters ==
 
The first parameter ("id" or "ref") is the exact folder and page name used in the [[URL]] at the AFL Tables website. This is in the form of '''FirstInitial/FirstName_LastName''', such as '''B/Brendan_Fevola''' for http://afltables.com/afl/stats/players/B/Brendan_Fevola.html. Where multiple players have the same name, the usual system is to add a number, such as [http://afltables.com/afl/stats/players/N/Nathan_Brown0.html N/Nathan_Brown0], [http://afltables.com/afl/stats/players/N/Nathan_Brown1.html N/Nathan_Brown1], or [http://afltables.com/afl/stats/players/N/Nathan_Brown2.html N/Nathan_Brown2].
 
The first parameter ("id" or "ref") is the exact folder and page name used in the [[URL]] at the AFL Tables website. This is in the form of '''FirstInitial/FirstName_LastName''', such as '''B/Brendan_Fevola''' for http://afltables.com/afl/stats/players/B/Brendan_Fevola.html. Where multiple players have the same name, the usual system is to add a number, such as [http://afltables.com/afl/stats/players/N/Nathan_Brown0.html N/Nathan_Brown0], [http://afltables.com/afl/stats/players/N/Nathan_Brown1.html N/Nathan_Brown1], or [http://afltables.com/afl/stats/players/N/Nathan_Brown2.html N/Nathan_Brown2].
  
 
The second parameter ("name" or "alt") is an optional alternative parameter to specify a player's name. If not given it defaults to the Wikipedia article name, without any disambiguation such as (footballer). This parameter is only needed if you want to display text other than the article name.
 
The second parameter ("name" or "alt") is an optional alternative parameter to specify a player's name. If not given it defaults to the Wikipedia article name, without any disambiguation such as (footballer). This parameter is only needed if you want to display text other than the article name.
 
== TemplateData ==
 
{{TemplateDataHeader}}
 
<templatedata>{
 
"description": "This template displays a uniformly formatted external link to an Australian Football League (AFL) player's profile page on the AFL Tables website (afltables.com).",
 
"params": {
 
  "1": {
 
    "label": "ID",
 
    "aliases": ["id","ref"],
 
    "description": "Player ID portion of the URL. Example: B/Brendan_Fevola is the ID in http://afltables.com/afl/stats/players/B/Brendan_Fevola.html",
 
    "type": "string",
 
    "default": "",
 
    "required": true
 
  },
 
  "2": {
 
    "label": "Name",
 
    "aliases": ["name","alt"],
 
    "description": "Name of player. If not given it defaults to the Wikipedia article name, without any disambiguation such as (footballer).",
 
    "type": "string",
 
    "default": "{{PAGENAME}}",
 
    "required": false
 
  }
 
}}</templatedata>
 
  
 
== Examples ==
 
== Examples ==
Line 50: Line 33:
 
=== Unnamed parameters ===
 
=== Unnamed parameters ===
 
URL:
 
URL:
: <code><nowiki>http://</nowiki>afltables.com/afl/stats/players/{{hilite|B/Brendan_Fevola}}.html</code>
+
: <code>[http://afltables.com/afl/stats/players/B/Brendan_Fevola.html http://afltables.com/afl/stats/players/{{hilite|B/Brendan_Fevola}}.html]</code>
 
Usage:
 
Usage:
: <code><nowiki>{{</nowiki>AFL Tables | B/Brendan_Fevola | Brendan Fevola }}</code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | B/Brendan_Fevola | Brendan Fevola }}</code>
 
Result:
 
Result:
: {{AFL Tables | B/Brendan_Fevola | Brendan Fevola }}
+
: {{{{BASEPAGENAME}} | B/Brendan_Fevola | Brendan Fevola }}
  
 
=== Named parameters: id, name ===
 
=== Named parameters: id, name ===
 
URL:
 
URL:
: <code><nowiki>http://</nowiki>afltables.com/afl/stats/players/{{hilite|N/Nathan_Brown0}}.html</code>
+
: <code>[http://afltables.com/afl/stats/players/N/Nathan_Brown0.html http://afltables.com/afl/stats/players/{{hilite|N/Nathan_Brown0}}.html]</code>
 
Usage:
 
Usage:
: <code><nowiki>{{</nowiki>AFL Tables | id= N/Nathan_Brown0 | name= Nathan D. Brown }}</code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= N/Nathan_Brown0 | name= Nathan D. Brown }}</code>
 
Result:
 
Result:
: {{AFL Tables | id= N/Nathan_Brown0 | name= Nathan D. Brown }}
+
: {{{{BASEPAGENAME}} | id= N/Nathan_Brown0 | name= Nathan D. Brown }}
  
 
=== Named parameters: alt, ref ===
 
=== Named parameters: alt, ref ===
 
URL:
 
URL:
: <code><nowiki>http://</nowiki>afltables.com/afl/stats/players/{{hilite|N/Nathan_Brown1}}.html</code>
+
: <code>[http://afltables.com/afl/stats/players/N/Nathan_Brown1.html http://afltables.com/afl/stats/players/{{hilite|N/Nathan_Brown1}}.html]</code>
 
Usage:
 
Usage:
: <code><nowiki>{{</nowiki>AFL Tables | ref= N/Nathan_Brown1 | alt= Nathan G. Brown }}</code>
+
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ref= N/Nathan_Brown1 | alt= Nathan G. Brown }}</code>
 
Result:
 
Result:
: {{AFL Tables | ref= N/Nathan_Brown1 | alt= Nathan G. Brown }}
+
: {{{{BASEPAGENAME}} | ref= N/Nathan_Brown1 | alt= Nathan G. Brown }}
 +
 
 +
=== No parameters and Wikidata property not defined ===
 +
''Usage:''
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
''Output:''
 +
: {{ {{BASEPAGENAME}} }}
 +
 
 +
== TemplateData ==
 +
{{TemplateData header}}
 +
<templatedata>
 +
{
 +
  "description": "This template displays a uniformly formatted external link to an Australian Football League (AFL) player's profile page on the AFL Tables website. It is intended for use in the external links section of an article.",
 +
  "params": {
 +
    "id": {
 +
      "label": "id",
 +
      "aliases": ["ref", "1"],
 +
      "description": "This parameter should contain the ID portion of the URL. Example: B/Brendan_Fevola is the ID portion of http://afltables.com/afl/stats/players/B/Brendan_Fevola.html. It is optional if Wikidata property P3547 exists, but required if not.",
 +
      "type": "string",
 +
      "required": false,
 +
      "default": "Wikidata property P3547"
 +
    },
 +
    "name": {
 +
      "label": "name",
 +
      "aliases": ["alt", "2"],
 +
      "description": "This parameter may be used to specify the link text, which should be the name of the player. It is optional and defaults to the Wikipedia article name, without any disambiguation such as \"(footballer)\".",
 +
      "type": "string",
 +
      "required": false,
 +
      "default": "{{PAGENAMEBASE}}"
 +
    }
 +
  },
 +
  "paramOrder": [
 +
    "id",
 +
    "name"
 +
  ]
 +
}
 +
</templatedata>
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
+
<includeonly>{{sandbox other||
 
<!-- Categories go here, and interwikis go in Wikidata -->
 
<!-- Categories go here, and interwikis go in Wikidata -->
 
[[Category:People and person external link templates]]
 
[[Category:People and person external link templates]]
Line 79: Line 98:
 
[[Category:Specific-source templates]]
 
[[Category:Specific-source templates]]
 
[[Category:WikiProject Australian rules football]]
 
[[Category:WikiProject Australian rules football]]
 +
[[Category:External link templates using Wikidata]]
 
}}</includeonly>
 
}}</includeonly>

Revision as of 13:39, 16 April 2017

Template:Uses Wikidata

Template:AFL Tables displays a uniformly formatted external link to an Australian Football League (AFL) player's profile page on the AFL Tables website. It is intended for use in the external links section of an article.

Usage

Unnamed parameters:

{{AFL Tables | ID }}
{{AFL Tables | ID | NAME }}

Named parameters (id, name):

{{AFL Tables | id= ID }}
{{AFL Tables | id= ID | name= NAME }}

Named parameters (ref, alt):

{{AFL Tables | ref= ID }}
{{AFL Tables | ref= ID | alt= NAME }}

Using Wikidata property P3547:

{{AFL Tables}}
{{AFL Tables | name= NAME }}
{{AFL Tables | alt= NAME }}

Parameters

The first parameter ("id" or "ref") is the exact folder and page name used in the URL at the AFL Tables website. This is in the form of FirstInitial/FirstName_LastName, such as B/Brendan_Fevola for http://afltables.com/afl/stats/players/B/Brendan_Fevola.html. Where multiple players have the same name, the usual system is to add a number, such as N/Nathan_Brown0, N/Nathan_Brown1, or N/Nathan_Brown2.

The second parameter ("name" or "alt") is an optional alternative parameter to specify a player's name. If not given it defaults to the Wikipedia article name, without any disambiguation such as (footballer). This parameter is only needed if you want to display text other than the article name.

Examples

Unnamed parameters

URL:

http://afltables.com/afl/stats/players/B/Brendan_Fevola.html

Usage:

{{AFL Tables | B/Brendan_Fevola | Brendan Fevola }}

Result:

Brendan Fevola's playing statistics from AFL TablesScript error: No such module "EditAtWikidata".

Named parameters: id, name

URL:

http://afltables.com/afl/stats/players/N/Nathan_Brown0.html

Usage:

{{AFL Tables | id= N/Nathan_Brown0 | name= Nathan D. Brown }}

Result:

Nathan D. Brown's playing statistics from AFL TablesScript error: No such module "EditAtWikidata".

Named parameters: alt, ref

URL:

http://afltables.com/afl/stats/players/N/Nathan_Brown1.html

Usage:

{{AFL Tables | ref= N/Nathan_Brown1 | alt= Nathan G. Brown }}

Result:

Nathan G. Brown's playing statistics from AFL TablesScript error: No such module "EditAtWikidata".

No parameters and Wikidata property not defined

Usage:

{{AFL Tables}}

Output:

Template:PAGENAMEBASE's playing statistics from AFL TablesScript 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 AFL Tables

This template displays a uniformly formatted external link to an Australian Football League (AFL) player's profile page on the AFL Tables website. It is intended for use in the external links section of an article.

Template parameters

ParameterDescriptionTypeStatus
idid ref 1

This parameter should contain the ID portion of the URL. Example: B/Brendan_Fevola is the ID portion of http://afltables.com/afl/stats/players/B/Brendan_Fevola.html. It is optional if Wikidata property P3547 exists, but required if not.

Default
Wikidata property P3547
Stringoptional
namename alt 2

This parameter may be used to specify the link text, which should be the name of the player. It is optional and defaults to the Wikipedia article name, without any disambiguation such as "(footballer)".

Default
{{PAGENAMEBASE}}
Stringoptional