Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:File link/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Usage from Lua == First, you need to import the module. <syntaxhighlight lang="lua"> local mFileLink = require('Module:File link') </syntaxhighlight> Then you can make file links using the <code>_main</code> function. <syntaxhighlight lang="lua"> mFileLink._main(args) </syntaxhighlight> <var>args</var> is a table of arguments that can have the following keys: * <code>file</code> - the filename. (required) * <code>format</code> - the file format, e.g. 'thumb', 'thumbnail', 'frame', 'framed', or 'frameless'. * <code>formatfile</code> - a filename to specify with the 'thumbnail' format option. The filename specified will be used instead of the automatically generated thumbnail. * <code>border</code> - set this to true or "yes" (or any other value recognized as true by [[Module:Yesno]]) to set a border for the image. * <code>location</code> - the horizontal alignment of the file, e.g. 'right', 'left', 'center', or 'none'. * <code>alignment</code> - the vertical alignment of the file, e.g. 'baseline', 'middle', 'sub', 'super', 'text-top', 'text-bottom', 'top', or 'bottom'. * <code>size</code> - the size of the image, e.g. '100px', 'x100px' or '100x100px'. * <code>upright</code> - the 'upright' parameter, used for setting the size of tall and thin images. * <code>link</code> - the page that the file should link to. Use the blank string <nowiki>''</nowiki> to suppress the default link to the file description page. * <code>alt</code> - the alt text. Use the blank string <nowiki>''</nowiki> to suppress the default alt text. * <code>caption</code> - a caption for the file. * <code>page</code> - sets a page number for multi-paged files such as PDFs. * <code>class</code> - adds a <code>class</code> parameter to image links. The MediaWiki software adds this parameter to the <code>class="..."</code> attribute of the image's <code><nowiki><img /></nowiki></code> element when the page is rendered into HTML. * <code>lang</code> - adds a language attribute to specify what language to render the file in. * <code>start</code> - specifies a start time for audio and video files. * <code>end</code> - specifies an end time for audio and video files. * <code>thumbtime</code> - specifies the time to use to generate the thumbnail image for video files. To see the effect of each of these parameters, see the [[mw:Help:Images#Format|images help page on mediawiki.org]]. === Examples === With the file only: <syntaxhighlight lang="lua"> mFileLink.main{file = 'Example.png'} -- Renders as [[File:Example.png]] </syntaxhighlight> With format, size, link and caption options: <syntaxhighlight lang="lua"> mFileLink.main{ file = 'Example.png', format = 'thumb', size = '220px', link = 'Wikipedia:Sandbox', caption = 'An example.' } -- Renders as [[File:Example.png|thumb|220px|link=Wikipedia:Sandbox|An example.]] </syntaxhighlight> With format, size, and border: <syntaxhighlight lang="lua"> mFileLink.main{ file = 'Example.png', format = 'frameless', size = '220px', border = true } -- Renders as [[File:Example.png|frameless|border|220px]] </syntaxhighlight> <includeonly>{{Sandbox other|| <!-- Categories go here and interwikis go in Wikidata. --> [[Category:Link modules]] }}</includeonly><noinclude> [[Category:Module documentation pages]] </noinclude>
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)