Difference between revisions of "Template:IMDb title/testcases"
Jump to navigation
Jump to search
imported>Zyxw (update testcases for current version of template) |
imported>Zyxw (use {{Test case}} to highlight any differences between main template and sandbox, add tests for empty id/title parameters, add brief descriptions of expected output) |
||
| Line 3: | Line 3: | ||
== No parameters == | == No parameters == | ||
| − | + | If no ID is provided, the template uses [[Wikidata]] property {{wpl|P345}}: | |
| − | + | : <kbd><nowiki>https://www.imdb.com/title/{{#property:P345}}/</nowiki></kbd> | |
| − | + | If the page does not have a Wikidata item containing that property, the template uses the page name: | |
| + | : <kbd><nowiki>https://www.imdb.com/Title?{{urlencode:{{PAGENAME}}}}/</nowiki></kbd> | ||
| + | : The template also adds [[:Category:IMDb template with no id set]] if the page is located in the [[WP:NS0|main or article namespace]]. | ||
| + | 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 Title (unnamed parameters) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | | }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=empty ID and Title (named parameters) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= | title= }}</nowiki> | ||
| + | }} | ||
== Parameter: id (1) == | == Parameter: id (1) == | ||
| − | + | If the ID does not start with "tt", the template adds "tt" (and leading zeros, if needed): | |
| − | + | : <kbd>0111282 — https://<nowiki/>www.imdb.com/title/{{Hilite|tt|lightgreen}}{{Hilite|0111282}}/</kbd> | |
| − | + | : <kbd>111282 — https://<nowiki/>www.imdb.com/title/{{Hilite|tt0|lightgreen}}{{Hilite|111282}}/</kbd> | |
| + | If the ID starts with "tt", the template does not make any changes: | ||
| + | : <kbd>tt0111282 — https://<nowiki/>www.imdb.com/title/{{Hilite|tt0111282}}/</kbd> (valid ID) | ||
| + | : <kbd>tt111282 — https://<nowiki/>www.imdb.com/title/{{Hilite|tt111282}}/</kbd> (invalid ID) | ||
| + | : An article using {{tlc|{{BASEPAGENAME}}|tt111282}} would be added to [[:Category:IMDb template with invalid id set]] | ||
| + | The [[link text]] should be the Wikipedia page name, without disambiguation (via {{tlg|kbd=yes|PAGENAMEBASE}}). | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (unnamed parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 }}</nowiki> | ||
| + | }} | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number without leading zeros (unnamed parameter) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 111282 }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number without leading zeros (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 111282 }}</nowiki> | ||
| + | }} | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "tt" and leading zeros (unnamed parameter) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | tt0111282 }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "tt" and leading zeros (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= tt0111282 }}</nowiki> | ||
| + | }} | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "tt" without leading zeros (unnamed parameter) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | tt111282 }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "tt" without leading zeros (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= tt111282 }}</nowiki> | ||
| + | }} | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID and empty Title (unnamed parameters) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID and empty Title (named parameters) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= }}</nowiki> | ||
| + | }} | ||
== Parameter: title (2) == | == Parameter: title (2) == | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=ID and Title (unnamed parameters) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate }}</nowiki> | |
| − | + | }} | |
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=ID and Title (named parameters) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate }}</nowiki> | |
| − | + | }} | |
| − | |||
== Parameter: description (3) == | == Parameter: description (3) == | ||
| − | + | Any text in {{para|description}} is added after the title, inside the [[link text]]. | |
| − | |||
| − | |||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=description (unnamed parameters for ID and Title) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate | description= (1994 film) }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=description (named parameters for ID and Title) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate | description= (1994 film) }}</nowiki> | ||
| + | }} | ||
== Parameter: section == | == Parameter: section == | ||
| − | + | If {{para|section|awards}} or {{para|section|award}}: | |
| + | : "Awards for " is added before the title, inside the [[link text]] | ||
| + | : <kbd>awards</kbd> is added to the end of the URL: <kbd>https://<nowiki/>www.imdb.com/title/tt#######/{{Hilite|awards}}</kbd> | ||
| + | Any other values in {{para|section}} are ignored. | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=awards (unnamed parameters for ID and Title) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate | section= awards }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=awards (named parameters for ID and Title) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate | section= awards }}</nowiki> | ||
| + | }} | ||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=award (unnamed parameters for ID and Title) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate | section= award }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=award (named parameters for ID and Title) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate | section= award }}</nowiki> | ||
| + | }} | ||
| − | === | + | {{Test case nowiki|format=inline|collapsible=yes|title=other (unnamed parameters for ID and Title) |
| + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate | section= other }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=other (named parameters for ID and Title) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate | section= other }}</nowiki> | ||
| + | }} | ||
| − | + | == All parameters == | |
| − | |||
| − | |||
| − | + | {{Test case nowiki|format=inline|collapsible=yes|title=description and awards (unnamed parameters for ID and Title) | |
| − | + | |code=<nowiki>{{__TEMPLATENAME__ | 0111282 | Stargate | description= (1994 film) | section= awards }}</nowiki> | |
| − | + | }} | |
| + | {{Test case nowiki|format=inline|collapsible=yes|title=description and awards (named parameters for ID and Title) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 0111282 | title= Stargate | description= (1994 film) | section= awards }}</nowiki> | ||
| + | }} | ||
Revision as of 19:24, 28 July 2018
- REDIRECT Template:Testcases notice
- From a page move: This is a redirect from a page that has been moved (renamed). This page was kept as a redirect to avoid breaking links, both internal and external, that may have been made to the old page name.
Contents
No parameters
If no ID is provided, the template uses Wikidata property Template:Wpl:
- https://www.imdb.com/title/{{#property:P345}}/
If the page does not have a Wikidata item containing that property, the template uses the page name:
- https://www.imdb.com/Title?{{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 |
|---|
|
| empty ID (unnamed parameter) |
|---|
|
| empty ID (named parameter) |
|---|
|
| empty ID and Title (unnamed parameters) |
|---|
|
| empty ID and Title (named parameters) |
|---|
|
Parameter: id (1)
If the ID does not start with "tt", the template adds "tt" (and leading zeros, if needed):
- 0111282 — https://www.imdb.com/title/tt0111282/
- 111282 — https://www.imdb.com/title/tt0111282/
If the ID starts with "tt", the template does not make any changes:
- tt0111282 — https://www.imdb.com/title/tt0111282/ (valid ID)
- tt111282 — https://www.imdb.com/title/tt111282/ (invalid ID)
- An article using
{{IMDb title|tt111282}}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 "tt" and leading zeros (unnamed parameter) |
|---|
|
| ID with "tt" and leading zeros (named parameter) |
|---|
|
| ID with "tt" without leading zeros (unnamed parameter) |
|---|
|
| ID with "tt" without leading zeros (named parameter) |
|---|
|
| ID and empty Title (unnamed parameters) |
|---|
|
| ID and empty Title (named parameters) |
|---|
|
Parameter: title (2)
| ID and Title (unnamed parameters) |
|---|
|
| ID and Title (named parameters) |
|---|
|
Parameter: description (3)
Any text in |description= is added after the title, inside the link text.
| description (unnamed parameters for ID and Title) |
|---|
|
| description (named parameters for ID and Title) |
|---|
|
Parameter: section
If |section=awards or |section=award:
- "Awards for " is added before the title, inside the link text
- awards is added to the end of the URL: https://www.imdb.com/title/tt#######/awards
Any other values in |section= are ignored.
| awards (unnamed parameters for ID and Title) |
|---|
|
| awards (named parameters for ID and Title) |
|---|
|
| award (unnamed parameters for ID and Title) |
|---|
|
| award (named parameters for ID and Title) |
|---|
|
| other (unnamed parameters for ID and Title) |
|---|
|
| other (named parameters for ID and Title) |
|---|
|
All parameters
| description and awards (unnamed parameters for ID and Title) |
|---|
|
| description and awards (named parameters for ID and Title) |
|---|
|