查看“︁Module:Listen”︁的源代码
←
Module:Listen
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
--本模块嵌入{{listen}} local mFileLink = require('Module:File link') local mTableTools = require('Module:TableTools') local mSideBox = require('Module:Side box') local p = {} function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= '' then args[k] = v end end return p._main(args) end function p._main(args) -- Organise the arguments by number. local numArgs = {} do local origNumArgs = mTableTools.numData(args) origNumArgs[1] = origNumArgs.other -- Overwrite args.filename1 etc. with args.filename etc. origNumArgs = mTableTools.compressSparseArray(origNumArgs) for i, t in ipairs(origNumArgs) do if t.filename then numArgs[#numArgs + 1] = t end end end -- Find whether we are outputting a plain or an embedded box. local isPlain = args.plain == 'yes' local isEmbedded = args.embed and true or false -- Build the arguments for {{side box}} local sbargs = {} sbargs.metadata = 'no' sbargs.position = args.pos -- Style arguments do local style = {} if isPlain then style[#style + 1] = 'border:none' style[#style + 1] = 'background:transparent' style[#style + 1] = 'float:none' style[#style + 1] = 'clear:none' end if isEmbedded then style[#style + 1] = 'border-collapse:collapse' style[#style + 1] = 'border-width:1px 0 0 0' style[#style + 1] = 'background:transparent' style[#style + 1] = 'float:none' style[#style + 1] = 'clear:none' style[#style + 1] = 'margin:0 -5px' end if args.pos == 'left' or args.pos == '左' then style[#style + 1] = 'float:left' style[#style + 1] = 'clear:left' elseif args.pos == 'center' or args.pos == '居中' then style[#style + 1] = 'float:center' style[#style + 1] = 'clear:both' style[#style + 1] = 'margin-left:auto' style[#style + 1] = 'margin-right:auto' end style[#style + 1] = args.style sbargs.style = table.concat(style, '; ') end sbargs.textstyle = 'line-height:1.1em' -- Image if not isPlain and not isEmbedded then if args.image then sbargs.image = args.image else local images = { speech = 'Classic Microphone.svg', music = 'Classic Music Player icon.svg' } local image = args.type and images[args.type] or 'Green Headphone icon.svg' sbargs.image = mFileLink._main{ file = image, size = '65x50px', location = 'center', link = '', alt = '' } end end -- Text do local header if args.header then header = mw.html.create('div') header :css{ background = 'transparent', ['text-align'] = 'left', padding = args.embed and '2px 0' or '2px' } :wikitext(args.header) header = tostring(header) header = header .. '\n' else header = '' end local text = {} for i, t in ipairs(numArgs) do text[#text + 1] = p.renderRow(t.filename, t.title, t.play, t.alt, t.description) if numArgs[i + 1] then text[#text + 1] = '<hr />' end end sbargs.text = header .. table.concat(text) end -- Below if not isPlain and not isEmbedded and args.help ~= 'no' then sbargs.below = string.format( '<hr/><span style="font-size:smaller;">' .. "播放%s时有问题?请参阅[[Help:媒体帮助|媒体帮助]]。" .. '</span>', #numArgs > 1 and '这些-{zh-cn:文件; zh-tw:档桉;}-' or '此-{zh-cn:文件; zh-tw:档桉;}-' ) end -- Render the side box. local sideBox = mSideBox._main(sbargs) --Render the tracking categories. local trackingCategories = p.renderTrackingCategories(args, numArgs) return sideBox .. trackingCategories end function p.renderRow(filename, title, play, alt, description) -- Renders the HTML for one file description row. if not filename then return nil end local root = mw.html.create('') root :tag('div') :addClass('haudio') :newline() :tag('div') :css{ ['width'] = '220px', padding = '4px 0' } :wikitext(string.format('[[:File:%s|%s]]', filename, title or '')) :done() :newline() :tag('div') :wikitext( play ~= 'no' and mFileLink._main{ file = filename, size = '220px', alt = alt } or nil ) :done() :newline() :tag('div') :css{ ['width'] = '220px', padding = '2px 0 0 0' } :addClass('description') :wikitext(description) :done() :done() return tostring(root) end function p.renderTrackingCategories(args, numArgs, titleObj) -- Renders all tracking categories produced by the template. -- args and numArgs are passed through from p._main, -- and the titleObj is only used for testing purposes. local cats = {} local currentTitle = titleObj or mw.title.getCurrentTitle() if currentTitle.namespace == 0 then -- We are in mainspace. cats[#cats + 1] = '嵌入hAudio微格式的条目' for i, t in ipairs(numArgs) do local success, title = pcall(mw.title.new, 'Media:' .. t.filename) if success and title and not title.exists then cats[#cats + 1] = '嵌入空的试听模板条目' break end end end if args.plain == 'yes' then cats[#cats + 1] = '使用plain参数的试听模板' end for i, cat in ipairs(cats) do cats[i] = string.format('[[Category:%s]]', cat) end return table.concat(cats) end return p
该页面使用的模板:
Module:Listen/doc
(
查看源代码
)
返回
Module:Listen
。
导航菜单
个人工具
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
特殊页面
工具
链入页面
相关更改
页面信息
批量上传文件
友情链接
VCPedia
其他相关站点
vocaloid中文歌詞wiki
UTAU中华组wiki
初音ミク Wiki
VOCALOID Wiki
Vocaloid Lyrics Wiki
Vocaloid Database