Module:沙盒/盐棋/Sandbox1:修订间差异

删除1,544字节 、​ 2024年2月27日 (星期二)
try
(try?)
(try)
标签替换
 
(未显示同一用户的22个中间版本)
第1行: 第1行:
-- text.jsonEncode({sp=W.site.namespaces},W.text.JSON_PRETTY)
local p = {}
local p={}
function p.len(frame)
p.filter={text=mw.text.encode,json=mw.text.jsonEncode,no=function(x)return x end}
return #frame.args.a
function p.label_text(text)
   return tostring(mw.html.create('span'):addClass('label-text'):wikitext(text))
end
end
function p.song_cell(frame)
function p.explode(frame)
return mw.text.jsonEncode({
return mw.dumpObject({mw.ustring.byte(frame.args.a,1,-1)})
class=frame.args['色彩'],
tab=frame.args['标签'],
content=string.format('[[文件:Songs %%s%s.jpg|256px|none]]%s%s',frame.args['后缀']or'',p.label_text('画师'),frame.args['画师']),
active=frame.args['后缀']==nil
},mw.text.JSON_PRESERVE_KEYS)
end
function p.tab_img(id, config)
local container = mw.html.create('div'):addClass('container')
if #config==1 then
container:wikitext(config[1].content)
else
local img_tab=container:tag('div'):addClass('img-tab'):attr('id', 'tab-a')
for _, tab in ipairs(config) do
img_tab:tag('div'):addClass('img-tab-part'):addClass(tab.class):wikitext(tab.tab)
local figure=container:tag('div'):addClass('tab-text-a'):wikitext(tab.content)
if _==id then figure:addClass('active') end
end
end
return tostring(container)
-- return '[[文件:Songs '..tostring(id) .. '.jpg|点此上传图片]]'
end
function p.song(frame)
local config,main={},1
for i, v in ipairs(frame) do
local item=mw.text.jsonDecode(v)
item.content=item.content:format(frame.args['id'])
config:insert(item)
if item.active then main=i end
end
return p.tab_img(main,config)
end
function p.direct(frame)
return p.filter[frame.args[3] or 'no'](p.tab_img(frame.args[1],frame.args[2]))
end
function p.jsonmode(frame)
return p.filter[frame.args[3] or 'no'](p.tab_img(frame.args[1],mw.text.jsonDecode(frame.args[2])))
end
end
return p
return p
1,124

个编辑