Module:File link/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(fix)
m (change source to syntaxhighlight)
Line 10: Line 10:
First, you need to import the module.
First, you need to import the module.


<source lang="lua">
<syntaxhighlight lang="lua">
local mFileLink = require('Module:File link')
local mFileLink = require('Module:File link')
</syntaxhighlight>
</source>


Then you can make file links using the <code>_main</code> function.
Then you can make file links using the <code>_main</code> function.


<source lang="lua">
<syntaxhighlight lang="lua">
mFileLink._main(args)
mFileLink._main(args)
</syntaxhighlight>
</source>


<var>args</var> is a table of arguments that can have the following keys:
<var>args</var> is a table of arguments that can have the following keys:
Line 44: Line 44:


With the file only:
With the file only:
<source lang="lua">
<syntaxhighlight lang="lua">
mFileLink.main{file = 'Example.png'}
mFileLink.main{file = 'Example.png'}
-- Renders as [[File:Example.png]]
-- Renders as [[File:Example.png]]
</syntaxhighlight>
</source>


With format, size, link and caption options:
With format, size, link and caption options:
<source lang="lua">
<syntaxhighlight lang="lua">
mFileLink.main{
mFileLink.main{
file = 'Example.png',
file = 'Example.png',
Line 59: Line 59:
}
}
-- Renders as [[File:Example.png|thumb|220px|link=Wikipedia:Sandbox|An example.]]
-- Renders as [[File:Example.png|thumb|220px|link=Wikipedia:Sandbox|An example.]]
</syntaxhighlight>
</source>


With format, size, and border:
With format, size, and border:
<source lang="lua">
<syntaxhighlight lang="lua">
mFileLink.main{
mFileLink.main{
file = 'Example.png',
file = 'Example.png',
Line 70: Line 70:
}
}
-- Renders as [[File:Example.png|frameless|border|220px]]
-- Renders as [[File:Example.png|frameless|border|220px]]
</syntaxhighlight>
</source>


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||