模組:Vgname/sandbox
外观
![]() | 这是Module:Vgname(差异)的沙盒。 参见本模块的测试样例(运行)。 |
请在 Module:Vgname/languages定义新的外语
require("Module:No globals")
local getArgs = require("Module:Arguments").getArgs
local yesno = require("Module:Yesno")
local lc = require("Module:WikitextLC")
local foreignRegionList = mw.loadData("Module:Vgname/languages")
local function boldText(context, isbold)
if yesno(bold) then
return "<b>" .. context .. "</b>"
end
return context
end
local function main(context, isBold, bracketType)
local title, footnotes
if content == nil then
title = mw.title.getCurrentTitle().basePageTitle
end
title = boldText(title, isBold)
if bracketType == "normal" then
title = "《" .. title .. "》"
elseif bracket == "quotation" then
title = "「" .. title .. "」"
end
return title
end
local p = {}
function p.vgname(frame)
local args = getArgs(frame)
return p._vgname(args)
end
function p._vgname(args)
local retval = ""
local bold, diff, bracket
if yesno(args.bold) ~= false then
bold = true
end
if mw.ustring.lower(args.bracket) == "q" then
bracket = "quotation"
elseif yesno(args.bracket) == false then
bracket = "none"
else
bracket = "normal"
end
if yesno(args.diff) == true then
diff = true
elseif args.na or args.eu then
diff = true
end
retval = main(args[1], bold, bracket)
return retval
end
return p