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

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
m (formatting)
imported>Zyxw
(→‎Parameter: section: add tests for empty name parameter when |section= is used)
Line 85: Line 85:
 
== Parameter: section ==
 
== Parameter: section ==
  
If {{para|section|awards}} or {{para|section|award}}:
+
If {{para|section|award}} or {{para|section|awards}}:
 
: "Awards for " is added before the name, inside the [[link text]]
 
: "Awards for " is added before the name, inside the [[link text]]
 
: <kbd>awards</kbd> is added to the end of the URL: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|awards}}</kbd>
 
: <kbd>awards</kbd> is added to the end of the URL: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|awards}}</kbd>
Line 92: Line 92:
 
: <kbd>bio</kbd> is added to the end of the URL: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|bio}}</kbd>
 
: <kbd>bio</kbd> is added to the end of the URL: <kbd>https://<nowiki/>www.imdb.com/name/nm#######/{{Hilite|bio}}</kbd>
 
Any other values in {{para|section}} are ignored.
 
Any other values in {{para|section}} are ignored.
 +
 +
=== awards ===
 +
 +
{{Test case nowiki|format=inline|collapsible=yes|title=award (unnamed parameters for ID and Name)
 +
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= award }}</nowiki>
 +
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=award (named parameters for ID and Name)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= Jaye Davidson | section= award }}</nowiki>
 +
}}
  
 
{{Test case nowiki|format=inline|collapsible=yes|title=awards (unnamed parameters for ID and Name)
 
{{Test case nowiki|format=inline|collapsible=yes|title=awards (unnamed parameters for ID and Name)
Line 100: Line 109:
 
}}
 
}}
  
{{Test case nowiki|format=inline|collapsible=yes|title=award (unnamed parameters for ID and Name)  
+
{{Test case nowiki|format=inline|collapsible=yes|title=awards (unnamed parameter for ID, empty Name)
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= award }}</nowiki>
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | | section= awards }}</nowiki>
 +
}}
 +
{{Test case nowiki|format=inline|collapsible=yes|title=awards (named parameter for ID, empty Name)
 +
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= | section= awards }}</nowiki>
 +
}}
 +
 
 +
=== biography ===
 +
 
 +
{{Test case nowiki|format=inline|collapsible=yes|title=biography (unnamed parameters for ID and Name)  
 +
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= biography }}</nowiki>
 
}}
 
}}
{{Test case nowiki|format=inline|collapsible=yes|title=award (named parameters for ID and Name)
+
{{Test case nowiki|format=inline|collapsible=yes|title=biography (named parameters for ID and Name)
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= Jaye Davidson | section= award }}</nowiki>
+
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= Jaye Davidson | section= biography }}</nowiki>
 
}}
 
}}
  
Line 114: Line 132:
 
}}
 
}}
  
{{Test case nowiki|format=inline|collapsible=yes|title=biography (unnamed parameters for ID and Name)  
+
{{Test case nowiki|format=inline|collapsible=yes|title=bio (unnamed parameter for ID, empty Name)
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | Jaye Davidson | section= biography }}</nowiki>
+
|code=<nowiki>{{__TEMPLATENAME__ | 0001109 | | section= bio }}</nowiki>
 
}}
 
}}
{{Test case nowiki|format=inline|collapsible=yes|title=biography (named parameters for ID and Name)
+
{{Test case nowiki|format=inline|collapsible=yes|title=bio (named parameter for ID, empty Name)
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= Jaye Davidson | section= biography }}</nowiki>
+
|code=<nowiki>{{__TEMPLATENAME__ | id= 0001109 | name= | section= bio }}</nowiki>
 
}}
 
}}
 +
 +
=== unknown section ===
  
 
{{Test case nowiki|format=inline|collapsible=yes|title=other (unnamed parameters for ID and Name)  
 
{{Test case nowiki|format=inline|collapsible=yes|title=other (unnamed parameters for ID and Name)  

Revision as of 20: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 template also adds Category:IMDb template with no id set if the page is located in the main or article namespace.

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/ (valid ID)
nm1109 — https://www.imdb.com/name/nm1109/ (invalid ID)
An article using {{IMDb name|nm1109}} would be added to Category:IMDb template with invalid id set

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:

"Awards for " is added before the name, inside the link text
awards is added to the end of the URL: https://www.imdb.com/name/nm#######/awards

If |section=bio or |section=biography:

"Biography for " is added before the name, inside the link text
bio is added to the end of the URL: https://www.imdb.com/name/nm#######/bio

Any other values in |section= are ignored.

awards

award (unnamed parameters for ID and Name)
award (named parameters for ID and Name)
awards (unnamed parameters for ID and Name)
awards (named parameters for ID and Name)
awards (unnamed parameter for ID, empty Name)
awards (named parameter for ID, empty Name)

biography

biography (unnamed parameters for ID and Name)
biography (named parameters for ID and Name)
bio (unnamed parameters for ID and Name)
bio (named parameters for ID and Name)
bio (unnamed parameter for ID, empty Name)
bio (named parameter for ID, empty Name)

unknown section

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