Module:Sandbox/CAS222222221: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
 
function p.main(frame)
local langlist = {
local args = getArgs(frame)
return p._main(args)
-- 请在下方区域更新语言代码
{'de', '德语', '德版名'},
{'fi', '芬兰语', '芬兰版名'},
{'ja', '日语', '日版名'},
{'ko', '韩语', '韩版名'},
{'ru', '俄语', '俄版名'},
-- 请在上方区域更新语言代码
 
}
 
local langlist2 = {
 
en = {'en', '英语', '英文版名'},
na = {'en', '英语', '美版名'},
eu = {'en', '英语', '欧版名'},
}
 
local function bold( inp )
if yesno(args.bold) then
inp = '<b>' .. inp .. '</b>'
end
return inp
end
 
local function italicp._main( inp args)
-- Main module code goes here.
inp = '<i>' .. inp .. '</i>'
return inp
end
 
local function label( langIndex )
local ret
if yesno( args.diff ) or na ~= '' or eu ~= '' then
ret = langlist[langIndex][3]
else
ret = langlist[langIndex][2]
end
return ret
end
 
local function spanlang( langIndex )
local code = langlist[langIndex][1]
local ret = mw.html.create( 'span' )
span
:css( 'lang', code )
:wikitext( '-{' .. agrs[code] .. '}-' )
:tag( 'span' )
return tostring( span )
end
 
local function lead()
local ret
if yesno(args.bracket) then
ret = '《' .. bold( args[1] ) .. '》'
else
ret = bold( args[1] )
end
return ret
end
 
local function orig()
local ret = ''
for i, v in ipairs( langlist ) do
if args[v[1]] ~= '' then
ret = label( v ) .. ':' spanlang( v )
break
end
end
 
return ret
end
 
local function eng( ... )
end
 
local function trans( ... )
end
 
local function note( ... )
end
 
function p.vgname(frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if key == nil then
value = ''
end
return value
end
})
-- Main module code goes here
 
return lead() .. orig()
 
end