User:Rustle/Template:FileType



Template documentation
Note: portions of the template sample may not be visible without values provided.

This template is used to detect a File page's file type. It uses Module:FileType to detect the file extension within the page name, and returns the file type as a string.

It probably shouldn't be used directly on File pages; instead it should be used within other templates.

Syntax

Use the following syntax to detect the file type based on the page title:

{{FileType}}

Use the following syntax to detect the file type based on a input string:

{{FileType|<<1>>}}

Parameters

This template has one optional parameter.

Parameter Allowed values Notes
1 String Optional. A string to pass to the template, rather than the page title.

Accepted file types

Currently, the module can detect the following file types:

File extension Returned value
.png PNG
.jpg .jpeg JPEG
.gif GIF
.svg SVG

If the template is used outside the File namespace, or if the file has no file extension, the template will return Invalid file extension.. If the template is used on a file page with an extension not on the current list, it will return Unsupported file type. instead.