local p = {} function p.main(frame) local wrappers = { ['Template:沙盒'] = true, ['Template:大家族内容行'] = true, ['Template:Links/br'] = true } local parent = frame:getParent() if parent and wrappers[parent:getTitle()] then frame = parent end return p._main(frame.args) end function p._main(args) local titles = {} -- 链接 local sep -- 分隔字符串 local str -- 返回值 local nolink -- boolean -- 处理参数 -- 参数有:1~n、char、indent、nolink for i, v in ipairs(args) do v = mw.text.trim(v) if v ~= '' then table.insert(titles, v) end end nolink = args.nolink and args.nolink ~= '' -- 构造分隔字符串 local sepParts = { ']]', args.char or ' • ', '', '[[' } if nolink then sepParts[1], sepParts[4] = '', '' end local indent = tonumber(args.indent) if indent and indent >= 3 then sepParts[3] = '<!--\n'..mw.ustring.rep(' ', indent - 3)..'-->' end sep = table.concat(sepParts) -- 输出 str = table.concat(titles, sep) if not nolink then str = '[['..str..']]' end return str end return p