Difference between revisions of "Template:IMDb name/testcases"
Jump to navigation
Jump to search
imported>Zyxw (add tests) |
imported>Zyxw (add tests for valid IDs with 8 digits) |
||
| Line 31: | Line 31: | ||
If the ID does not start with "nm", the template adds "nm" (and leading zeros, if needed): | If the ID does not start with "nm", the template adds "nm" (and leading zeros, if needed): | ||
| − | : <kbd>0001109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm|lightgreen}}{{Hilite|0001109}}/</kbd> | + | : <kbd>0001109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm|lightgreen}}{{Hilite|0001109}}/</kbd> (valid ID: 7 digits) |
| − | : <kbd>1109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm000|lightgreen}}{{Hilite|1109}}/</kbd> | + | : <kbd>1109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm000|lightgreen}}{{Hilite|1109}}/</kbd> (valid ID: 7 digits after template adds leading zeros) |
| − | + | : <kbd>10108524 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm|lightgreen}}{{Hilite|10108524}}/</kbd> (valid ID: 8 digits) | |
| − | : <kbd> | + | : <kbd>123456789 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm|lightgreen}}{{Hilite|123456789}}/</kbd> (invalid ID: more than 8 digits) |
| − | : <kbd> | ||
| − | : | ||
| − | |||
{{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (unnamed parameter) | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with leading zeros (unnamed parameter) | ||
| Line 52: | Line 49: | ||
|code=<nowiki>{{__TEMPLATENAME__ | id= 1109 }}</nowiki> | |code=<nowiki>{{__TEMPLATENAME__ | id= 1109 }}</nowiki> | ||
}} | }} | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with 8 digits (unnamed parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | 10108524 }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with 8 digits (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 10108524 }}</nowiki> | ||
| + | }} | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with 9 digits (unnamed parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | 123456789 }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID number with 9 digits (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= 123456789 }}</nowiki> | ||
| + | }} | ||
| + | |||
| + | If the ID starts with "nm", the template does not make any changes: | ||
| + | : <kbd>nm0001109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm0001109}}/</kbd> (valid ID: nm + 7 digits) | ||
| + | : <kbd>nm1109 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm1109}}/</kbd> (invalid ID: less than 7 digits) | ||
| + | : <kbd>nm10108524 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm10108524}}/</kbd> (valid ID: nm + 8 digits) | ||
| + | : <kbd>nm123456789 — https://<nowiki/>www.imdb.com/name/{{Hilite|nm123456789}}/</kbd> (invalid ID: more than 8 digits) | ||
| + | : An article using {{tlc|{{BASEPAGENAME}}|nm1109}} or {{tlc|{{BASEPAGENAME}}|nm123456789}} would be added to [[:Category:IMDb template with invalid id set]] and a warning message is displayed in preview mode. | ||
{{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" and leading zeros (unnamed parameter) | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" and leading zeros (unnamed parameter) | ||
| Line 66: | Line 84: | ||
|code=<nowiki>{{__TEMPLATENAME__ | id= nm1109 }}</nowiki> | |code=<nowiki>{{__TEMPLATENAME__ | id= nm1109 }}</nowiki> | ||
}} | }} | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" with 8 digits (unnamed parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | nm10108524 }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" with 8 digits (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= nm10108524 }}</nowiki> | ||
| + | }} | ||
| + | |||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" with 9 digits (unnamed parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | nm123456789 }}</nowiki> | ||
| + | }} | ||
| + | {{Test case nowiki|format=inline|collapsible=yes|title=ID with "nm" with 9 digits (named parameter) | ||
| + | |code=<nowiki>{{__TEMPLATENAME__ | id= nm123456789 }}</nowiki> | ||
| + | }} | ||
| + | |||
| + | 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 and empty Name (unnamed parameters) | {{Test case nowiki|format=inline|collapsible=yes|title=ID and empty Name (unnamed parameters) | ||
Revision as of 07:36, 25 March 2019
| This is the template test cases page for the sandbox of Template:IMDb name. Script error: No such module "Purge". to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki, see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins with these links: |
Contents
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 |
|---|
|
| empty ID (unnamed parameter) |
|---|
|
| empty ID (named parameter) |
|---|
|
| empty ID and Name (unnamed parameters) |
|---|
|
| empty ID and Name (named parameters) |
|---|
|
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/ (valid ID: 7 digits)
- 1109 — https://www.imdb.com/name/nm0001109/ (valid ID: 7 digits after template adds leading zeros)
- 10108524 — https://www.imdb.com/name/nm10108524/ (valid ID: 8 digits)
- 123456789 — https://www.imdb.com/name/nm123456789/ (invalid ID: more than 8 digits)
| 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 number with 8 digits (unnamed parameter) |
|---|
|
| ID number with 8 digits (named parameter) |
|---|
|
| ID number with 9 digits (unnamed parameter) |
|---|
|
| ID number with 9 digits (named parameter) |
|---|
|
If the ID starts with "nm", the template does not make any changes:
- nm0001109 — https://www.imdb.com/name/nm0001109/ (valid ID: nm + 7 digits)
- nm1109 — https://www.imdb.com/name/nm1109/ (invalid ID: less than 7 digits)
- nm10108524 — https://www.imdb.com/name/nm10108524/ (valid ID: nm + 8 digits)
- nm123456789 — https://www.imdb.com/name/nm123456789/ (invalid ID: more than 8 digits)
- An article using
{{IMDb name|nm1109}}or{{IMDb name|nm123456789}}would be added to Category:IMDb template with invalid id set and a warning message is displayed in preview mode.
| ID with "nm" and leading zeros (unnamed parameter) |
|---|
|
| ID with "nm" and leading zeros (named parameter) |
|---|
|
| ID with "nm" without leading zeros (unnamed parameter) |
|---|
|
| ID with "nm" without leading zeros (named parameter) |
|---|
|
| ID with "nm" with 8 digits (unnamed parameter) |
|---|
|
| ID with "nm" with 8 digits (named parameter) |
|---|
|
| ID with "nm" with 9 digits (unnamed parameter) |
|---|
|
| ID with "nm" with 9 digits (named parameter) |
|---|
|
The link text should be the Wikipedia page name, without disambiguation (via {{PAGENAMEBASE}}).
| 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) |
|---|
|
| Name only, no ID (named parameters) |
|---|
|
| Name only, empty ID (unnamed parameters) |
|---|
|
| Name only, empty ID (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, no Name) |
|---|
|
| awards (named parameter for ID, no 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, no Name) |
|---|
|
| bio (named parameter for ID, no 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) |
|---|
|