编辑“︁模块:Message box”︁

跳转到导航 跳转到搜索
警告:您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您登录创建账号,您的编辑会以您的用户名署名,此外还有其他益处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第62行: 第62行:
table.sort(nums)
table.sort(nums)
return nums
return nums
end
local function insertStyle(cfg)
-- Create the templatestyles tag.
local frame = mw.getCurrentFrame()
return frame:extensionTag{
name = 'templatestyles',
args = { src = cfgTables['@global'].templatestyles },
} .. frame:extensionTag{
name = 'templatestyles',
args = { src = cfg.templatestyles },
}
end
end


第160行: 第174行:
error(format('無效的訊息框類型「%s」;有效的類型為%s', tostring(boxType), mw.text.listToText(boxTypes)), 2)
error(format('無效的訊息框類型「%s」;有效的類型為%s', tostring(boxType), mw.text.listToText(boxTypes)), 2)
end
end
self.cfg = cfg
return cfg
return cfg
end
end


function box:removeBlankArgs(cfg, args)
function box:removeBlankArgs(args)
-- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams.
-- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams.
local newArgs = {}
local newArgs = {}
第171行: 第186行:
end
end
end
end
for i, param in ipairs(cfg.allowBlankParams or {}) do
for i, param in ipairs(self.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
newArgs[param] = args[param]
end
end
第177行: 第192行:
end
end


function box:setBoxParameters(cfg, args)
function box:setBoxParameters(args)
local cfg = self.cfg
 
-- Get type data.
-- Get type data.
self.type = args.type
self.type = args.type
第285行: 第302行:
local talkText = '相關討論可見於'
local talkText = '相關討論可見於'
if talkArgIsTalkPage then
if talkArgIsTalkPage then
talkText = format('%s[[%s|%s]]', talkText, talk, talkTitle.prefixedText)
talkText = format('%s[[%s|%s]].', talkText, talk, talkTitle.prefixedText)
else
else
talkText = format('%s[[%s#%s|討論頁]]', talkText, talkTitle.prefixedText, talk)
talkText = format('%s[[%s#%s|討論頁]].', talkText, talkTitle.prefixedText, talk)
end
end
self.talk = talkText
self.talk = talkText
第516行: 第533行:
))
))
end
end
root:wikitext(insertStyle(self.cfg))


-- Create the box table.
-- Create the box table.
第558行: 第577行:
textCell
textCell
:cssText(self.textstyle)
:cssText(self.textstyle)
local textCellSpan = textCell:tag('span')
local textCellSpan = textCell:tag('div')
textCellSpan
textCellSpan
:addClass('mbox-text-span')
:addClass('mbox-text-span')
第627行: 第646行:
local outputBox = box.new()
local outputBox = box.new()
outputBox:setTitle(args)
outputBox:setTitle(args)
local cfg = outputBox:getConfig(boxType)
outputBox:getConfig(boxType)
args = outputBox:removeBlankArgs(cfg, args)
args = outputBox:removeBlankArgs(args)
outputBox:setBoxParameters(cfg, args)
outputBox:setBoxParameters(args)
return outputBox:export()
return outputBox:export()
end
end
第638行: 第657行:
return main(boxType, args)
return main(boxType, args)
end
end
end
local function insertStyleWikitext(frame)
local args = getArgs(frame, {trim = false, removeBlanks = false})
local boxType = args[1] or 'mbox'
-- // ---- // --
local outputBox = box.new()
outputBox:setTitle(args)
local cfg = outputBox:getConfig(boxType)
return insertStyle(cfg)
end
end


local p = {
local p = {
main = main,
main = main,
mbox = makeWrapper('mbox')
mbox = makeWrapper('mbox'),
insertStyle = insertStyleWikitext
}
}


for boxType in pairs(cfgTables) do
for boxType in pairs(cfgTables) do
p[boxType] = makeWrapper(boxType)
if boxType:sub(1, 1) ~= '@' then
p[boxType] = makeWrapper(boxType)
end
end
end


return p
return p
请注意,所有对DJMAX中文资料库的贡献均被视为依照知识共享署名发表(详情请见DJMAX中文资料库:著作权)。如果您不希望您的文字作品被随意编辑和分发传播,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源。未经许可,请勿提交受著作权保护的作品!
取消 编辑帮助(在新窗口中打开)

该页面使用的模板: