Difference between revisions of "Template:IMDb name/testcases"

From blackwiki
Jump to navigation Jump to search
imported>CuriousEric
(→‎Parameter: id (1): added another short test "nm1109")
imported>Zyxw
(use {{Test case}} to highlight any differences between main template and sandbox, add tests for empty id/name parameters, add brief descriptions of expected output)
Line 3: Line 3:
 
== No parameters ==
 
== No parameters ==
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{))}}</code>
+
If no ID is provided, the template uses [[Wikidata]] property {{wpl|P345}}:
* Output: {{ {{BASEPAGENAME}} }}
+
: <kbd><nowiki>https://www.imdb.com/name/{{#property:P345}}/</nowiki></kbd>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox }}
+
If the page does not have a Wikidata item containing that property, the template uses the page name:
 +
: <kbd><nowiki>https://www.imdb.com/Name?{{urlencode:{{PAGENAME}}}}/</nowiki></kbd>
 +
The [[link text]] should be the Wikipedia page name, without disambiguation (via {{tlg|kbd=yes|PAGENAMEBASE}}).
 +
 
 +
{{Test case nowiki|format=inline|collapsible=yes|title=No parameters
 +
|code=<nowiki>{{__TEMPLATENAME__}}</nowiki>
 +
}}
 +
 
 +
{{Test case nowiki|format=inline|collapsible=yes|title=empty ID (unnamed parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | }}</nowiki>
 +
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=empty ID (named parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= }}</nowiki>
 +
}}
 +
 
 +
{{Test case nowiki|format=inline|collapsible=yes|title=empty ID and Name (unnamed parameters)
 +
|code=<nowiki>{{__TEMPLATENAME__ | | }}</nowiki>
 +
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=empty ID and Name (named parameters)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= | name= }}</nowiki>
 +
}}
  
 
== Parameter: id (1) ==
 
== Parameter: id (1) ==
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{))}}</code>
+
If the ID does not start with "nm", the template adds "nm" (and leading zeros, if needed):
* Output: {{ {{BASEPAGENAME}} | id= 0001109 }}
+
: <kbd>0001109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm|lightgreen}}{{Hilite|0001109}}/</kbd>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 }}  
+
: <kbd>1109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm000|lightgreen}}{{Hilite|1109}}/</kbd>
 +
If the ID starts with "nm", the template does not make any changes:
 +
: <kbd>nm0001109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm0001109}}/</kbd>
 +
: <kbd>nm1109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm1109}}/</kbd>
 +
The [[link text]] should be the Wikipedia page name, without disambiguation (via {{tlg|kbd=yes|PAGENAMEBASE}}).
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= nm0001109 {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (unnamed parameter)
* Output: {{ {{BASEPAGENAME}} | id= nm0001109 }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= nm0001109 }}  
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (named parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 }}</nowiki>
 +
}}
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID number without leading zeros (unnamed parameter)
* Output: {{ {{BASEPAGENAME}} | 0001109 }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 1109 }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 }}  
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID number without leading zeros (named parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 1109 }}</nowiki>
 +
}}
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} nm0001109 {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" and leading zeros (unnamed parameter)
* Output: {{ {{BASEPAGENAME}} | nm0001109 }}
+
|code=<nowiki>{{__TEMPLATENAME__ | nm0001109 }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | nm0001109 }}
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" and leading zeros (named parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= nm0001109 }}</nowiki>
 +
}}
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 1109 {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" without leading zeros (unnamed parameter)
* Output: {{ {{BASEPAGENAME}} | 1109 }}
+
|code=<nowiki>{{__TEMPLATENAME__ | nm1109 }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 1109 }}
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" without leading zeros (named parameter)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= nm1109 }}</nowiki>
 +
}}
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} nm1109 {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID and empty Name (unnamed parameters)
* Output: {{ {{BASEPAGENAME}} | nm1109 }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | nm1109 }}
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID and empty Name (named parameters)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= }}</nowiki>
 +
}}
  
 
== Parameter: name (2) ==
 
== Parameter: name (2) ==
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{!}} name= Jaye Davidson {{))}}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=ID and Name (unnamed parameters)
* Output: {{ {{BASEPAGENAME}} | id= 0001109 | name= Jaye Davidson }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 | name= Jaye Davidson }}  
+
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=ID and Name (named parameters)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= Jaye Davidson }}</nowiki>
 +
}}
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{!}} Jaye Davidson {{))}}</code>
+
== Parameter: section ==
* Output: {{ {{BASEPAGENAME}} | 0001109 | Jaye Davidson }}
 
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 | Jaye Davidson }}
 
  
== Parameter: section ==
+
If {{para|section|award}} or {{para|section|awards}}:
 +
: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|awards}}</kbd>
 +
If {{para|section|bio}} or {{para|section|biography}}:
 +
: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|bio}}</kbd>
  
 
=== award ===
 
=== award ===
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{!}} name= Jaye Davidson {{!}} section= award }}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=award (unnamed parameters for ID and Name)
* Output: {{ {{BASEPAGENAME}} | id= 0001109 | name= Jaye Davidson | section= award }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= award }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 | name= Jaye Davidson | section= award }}
+
}}
 
+
{{Test case nowiki|format=inline|collapsible=yes|title=award (named parameters for ID and Name)
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{!}} Jaye Davidson {{!}} section= award }}</code>
+
|code=<nowiki>{{__TEMPLATENAME__ |id= 0001109 |name= Jaye Davidson | section= award }}</nowiki>
* Output: {{ {{BASEPAGENAME}} | 0001109 | Jaye Davidson | section= award }}
+
}}
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 | name= Jaye Davidson | section= award }}
 
  
 
=== awards ===
 
=== awards ===
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{!}} name= Jaye Davidson {{!}} section= awards }}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=awards (unnamed parameters for ID and Name)
* Output: {{ {{BASEPAGENAME}} | id= 0001109 | name= Jaye Davidson | section= awards }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= awards }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 | name= Jaye Davidson | section= awards }}
+
}}
 
+
{{Test case nowiki|format=inline|collapsible=yes|title=awards (named parameters for ID and Name)
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{!}} Jaye Davidson {{!}} section= awards }}</code>
+
|code=<nowiki>{{__TEMPLATENAME__ |id= 0001109 |name= Jaye Davidson | section= awards }}</nowiki>
* Output: {{ {{BASEPAGENAME}} | 0001109 | Jaye Davidson | section= awards }}
+
}}
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 | name= Jaye Davidson | section= awards }}
 
  
 
=== bio ===
 
=== bio ===
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{!}} name= Jaye Davidson {{!}} section= bio }}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=bio (unnamed parameters for ID and Name)
* Output: {{ {{BASEPAGENAME}} | id= 0001109 | name= Jaye Davidson | section= bio }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= bio }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 | name= Jaye Davidson | section= bio }}
+
}}
 
+
{{Test case nowiki|format=inline|collapsible=yes|title=bio (named parameters for ID and Name)
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{!}} Jaye Davidson {{!}} section= bio }}</code>
+
|code=<nowiki>{{__TEMPLATENAME__ |id= 0001109 |name= Jaye Davidson | section= bio }}</nowiki>
* Output: {{ {{BASEPAGENAME}} | 0001109 | Jaye Davidson | section= bio }}
+
}}
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 | name= Jaye Davidson | section= bio }}
 
  
 
=== biography ===
 
=== biography ===
  
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} id= 0001109 {{!}} name= Jaye Davidson {{!}} section= biography }}</code>
+
{{Test case nowiki|format=inline|collapsible=yes|title=biography (unnamed parameters for ID and Name)
* Output: {{ {{BASEPAGENAME}} | id= 0001109 | name= Jaye Davidson | section= biography }}
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= biography }}</nowiki>
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | id= 0001109 | name= Jaye Davidson | section= biography }}
+
}}
 
+
{{Test case nowiki|format=inline|collapsible=yes|title=biography (named parameters for ID and Name)
Usage: <code>{{((}} {{BASEPAGENAME}} {{!}} 0001109 {{!}} Jaye Davidson {{!}} section= biography }}</code>
+
|code=<nowiki>{{__TEMPLATENAME__ |id= 0001109 |name= Jaye Davidson | section= biography }}</nowiki>
* Output: {{ {{BASEPAGENAME}} | 0001109 | Jaye Davidson | section= biography }}
+
}}
* Sandbox: {{ {{BASEPAGENAME}}/sandbox | 0001109 | name= Jaye Davidson | section= biography }}
 

Revision as of 16:39, 28 July 2018

No parameters

If no ID is provided, the template uses Wikidata property Template:Wpl:

https://www.imdb.com/name/{{#property:P345}}/

If the page does not have a Wikidata item containing that property, the template uses the page name:

https://www.imdb.com/Name?{{urlencode:{{PAGENAME}}}}/

The link text should be the Wikipedia page name, without disambiguation (via {{PAGENAMEBASE}}).

No parameters
  • {{IMDb name}}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox}}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
empty ID (unnamed parameter)
  • {{IMDb name | }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
empty ID (named parameter)
  • {{IMDb name | id= }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | id= }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
empty ID and Name (unnamed parameters)
  • {{IMDb name | | }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | | }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
empty ID and Name (named parameters)
  • {{IMDb name | id= | name= }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | id= | name= }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".

Parameter: id (1)

If the ID does not start with "nm", the template adds "nm" (and leading zeros, if needed):

0001109 — https://www.imdb.com/name/nm0001109/
1109 — https://www.imdb.com/name/nm0001109/

If the ID starts with "nm", the template does not make any changes:

nm0001109 — https://www.imdb.com/name/nm0001109/
nm1109 — https://www.imdb.com/name/nm1109/

The link text should be the Wikipedia page name, without disambiguation (via {{PAGENAMEBASE}}).

ID number with leading zeros (unnamed parameter)
ID number with leading zeros (named parameter)
ID number without leading zeros (unnamed parameter)
ID number without leading zeros (named parameter)
ID with "nm" and leading zeros (unnamed parameter)
  • {{IMDb name | nm0001109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | nm0001109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
ID with "nm" and leading zeros (named parameter)
  • {{IMDb name | id= nm0001109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | id= nm0001109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
ID with "nm" without leading zeros (unnamed parameter)
  • {{IMDb name | nm1109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | nm1109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
ID with "nm" without leading zeros (named parameter)
  • {{IMDb name | id= nm1109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
  • {{IMDb name/sandbox | id= nm1109 }}Template:PAGENAMEBASE at IMDbScript error: No such module "EditAtWikidata".Expression error: Unrecognized punctuation character "[".
ID and empty Name (unnamed parameters)
ID and empty Name (named parameters)

Parameter: name (2)

ID and Name (unnamed parameters)
ID and Name (named parameters)

Parameter: section

If |section=award or |section=awards:

https://www.imdb.com/name/nm#######/awards

If |section=bio or |section=biography:

https://www.imdb.com/name/nm#######/bio

award

award (unnamed parameters for ID and Name)
award (named parameters for ID and Name)

awards

awards (unnamed parameters for ID and Name)
awards (named parameters for ID and Name)

bio

bio (unnamed parameters for ID and Name)
bio (named parameters for ID and Name)

biography

biography (unnamed parameters for ID and Name)
biography (named parameters for ID and Name)