「模組:Listen」:各本之異
[底本] | [底本] |
刪去的內容 新增的內容
新文「--本模塊嵌入{{listen}} local mFileLink = require('Module:File link') local mTableTools = require('Module:TableTools') local mSideBox = require('Module:Side box') local p = {……」 |
無編輯摘要 簽:掌中纂 纂於掌中卷 |
||
第六行:
local p = {}
local hasMidi -- Tracker for the tracking category
function p.main(frame)
第一五行 ⟶ 第一六行:
args[k] = v
end
end
-- Exit early if filename (required) is not provided.
if not args.filename then
end
return p._main(args)
第三九行 ⟶ 第四四行:
-- Build the arguments for {{side box}}
local sbargs = {}
sbargs.class = 'noprint'
sbargs.metadata = 'no'
sbargs.position = args.pos
第九七行 ⟶ 第一〇三行:
if args.header then
header = mw.html.create('div')
header:css{
background = 'transparent',
▲ padding = args.embed and '2px 0' or '2px'
▲ }
:wikitext(args.header)
header = tostring(header)
第一一一行 ⟶ 第一一六行:
local text = {}
for i, t in ipairs(numArgs) do
text[#text + 1] = p.renderRow(t.filename, t.title, t.play, t.alt, t.description, t.start)
if numArgs[i + 1] then
text[#text + 1] = '<hr
end
end
第一二二行 ⟶ 第一二七行:
if not isPlain and not isEmbedded and args.help ~= 'no' then
sbargs.below = string.format(
▲ .. "播放%s時有問題?請參閱[[Wikipedia:媒體幫助|媒體幫助]]。"
▲ #numArgs > 1 and '這些-{zh-cn:文件; zh-tw:檔案;}-' or '此-{zh-cn:文件; zh-tw:檔案;}-'
)
end
第一三八行 ⟶ 第一四一行:
end
function p.renderRow(filename, title, play, alt, description, start)
-- Renders the HTML for one file description row.
if not filename then
return nil
end
local isMidi, player
if filename:lower():find('%.mid$') then
isMidi = true
hasMidi = true
player = p.renderMidi(filename)
else
start = start
end
end
local root = mw.html.create('')
root:tag('div')
:cssText(isMidi and 'width:220px;overflow:hidden')
:cssText(isMidi and 'margin-top:-1em')
:newline()
:tag('div')
:
:
:
▲ :css('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')
▲ :addClass('description')
:done()▼
:done()
return tostring(root)
end
第一八四行 ⟶ 第一九五行:
-- We are in mainspace.
cats[#cats + 1] = '嵌入hAudio微格式的條目'
if hasMidi then
cats[#cats + 1] = '使用MIDI檔所生之音訊的條目'
end
for i, t in ipairs(numArgs) do
第二〇二行 ⟶ 第二一七行:
end
return table.concat(cats)
end
function p.renderMidi(filename)
return mw.getCurrentFrame():extensionTag(
'score',
[[\version "2.18"
\new Staff \with {
\remove "Staff_symbol_engraver"
\omit "Staff.Clef"
\omit "Staff.TimeSignature"
} % Comment to re-generate (and use fluidsynth)
\relative {s1^\markup{" "} }]],
{ vorbis = '1', override_midi = filename }
)
end
|