Template:Validextension: Difference between revisions
Template page
More actions
test |
m format |
||
| Line 40: | Line 40: | ||
|{{{2|}}}.webm={{{2}}}|{{{1}}}<!-- | |{{{2|}}}.webm={{{2}}}|{{{1}}}<!-- | ||
-->}}}}<noinclude> | -->}}}}<noinclude> | ||
{{#ifexist:{{ | {{#ifexist:{{FULLPAGENAME}}/doc|{{Documentation}}| | ||
<br> | <br> | ||
The template is transcluded with <nowiki>{{Tl|Validextension|</nowiki>''filename''<nowiki>|{{#invoke:File|woExtension|file= | The template is transcluded with <nowiki>{{Tl|Validextension|</nowiki>''filename''<nowiki>|{{#invoke:File|woExtension|file=</nowiki>''filename''<nowiki>}}|?}}</nowiki> | ||
where the third parameter specifies whether the file name or the extension (<code>3=e</code>) should be returned. | where the third parameter specifies whether the file name or the extension (<code>3=e</code>) should be returned. | ||
}} | }} | ||
</noinclude> | </noinclude> | ||
Revision as of 04:17, 28 February 2015
{{{1}}}
This documentation is transcluded from Template:Validextension/doc.
Postprocessor template to check the output of Module:File.
Usage
{{Validextension |1= |2= }}
As long the module does not distinguish between valid extensions and other cruft, this template can be used to verify the output of the module.
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | file name: name of the file without namespace (e.g. PAGENAMEd) | empty | required | |
2 | the name of the file without namespace and without dot_extension, e.g. {{#invoke:StripFilename|main|filename}}
| empty | required | |
3 | "Extension" when the valid extension should be returned ("e" is enough) | empty | optional | |
4 | default value for extension to be returned when invalid extension | empty | optional | |
Additional information
The template is intended to be used in the following namespaces: the File namespace
The template is intended to be used by the following user groups: all users
Localization
This template is not intended to be localized.
The template does not generate any localizable text.
Explanation
Depending on the third parameter, it returns either
- 3=e: the file extension, if it is a valid one, otherwise a null string
- otherwise: the file name without dot_extension
Examples
| {{Validextension|HSWikimedia.svg|HSWikimedia||???}} | HSWikimedia |
| {{Validextension|HSWikimedia.svg|HSWikimedia|e|???}} | svg |
| {{Validextension|HSWikimedia.icon|HSWikimedia||''unknown ext''}} | HSWikimedia.icon |
| {{Validextension|HSWikimedia.icon|HSWikimedia|e|''unknown ext''}} | |
| {{Validextension|HSWikimedia.icon|HSWikimedia}} | HSWikimedia.icon |
| {{Validextension|HSWikimedia.icon|HSWikimedia|e}} |