中文乐谱库
未登录
登录
搜索
导航
首页
最近更改
随机页面
乐谱
作曲家
所有乐谱
乐器/流派
国籍
时期
编辑
编辑作曲家
编辑乐谱
关于
捐助/支持
关于我们
成为贡献者
常见问题
工具
链入页面
相关更改
特殊页面
页面信息
页面历史
刷新页面
←
模块:File link/doc
查看“模块:File link/doc”的源代码
名字空间
模块
讨论
视图
查看
查看源代码
历史
操作
来自中文乐谱库
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
This module is used to construct wikitext links to files. It is primarily useful for templates and modules that use complicated logic to make file links. Simple file links should be made with wikitext markup directly, as it uses less resources than calling this module. For help with wikitext file markup please refer to the [[mw:Help:Images|documentation at mediawiki.org]]. == 維基語法的使用 == From wikitext, this module should be called from a template, usually {{tl|file link}}. Please see the template page for documentation. However, it can also be called using the syntax <code><nowiki>{{#invoke:File link|main|</nowiki>''arguments''<nowiki>}}</nowiki></code>. == Lua的使用 == First, you need to import the module. <source lang="lua"> local mFileLink = require('Module:File link') </source> Then you can make file links using the <code>_main</code> function. <source lang="lua"> mFileLink._main(args) </source> <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 '' to suppress the default link to the file description page. * <code>alt</code> - the alt text. Use the blank string '' 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: <source lang="lua"> mFileLink.main{file = 'Example.png'} -- Renders as [[File:Example.png]] </source> With format, size, link and caption options: <source 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.]] </source> With format, size, and border: <source lang="lua"> mFileLink.main{ file = 'Example.png', format = 'frameless', size = '220px', border = true } -- Renders as [[File:Example.png|frameless|border|220px]] </source> <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| <!-- Categories go here and interwikis go in Wikidata. --> }}</includeonly>
该页面使用的模板:
模板:Tl
(
查看源代码
)
模板:Transclude
(
查看源代码
)
返回至
模块:File link/doc
。