Module:StorySim/Place
可在Module:StorySim/Place/doc创建此模块的帮助文档
local p = {} local getArgs = require('Module:Arguments').getArgs; local Data = mw.loadData('Module:RotaenoStoryData/PNodeText'); local classStorySim = require('Module:StorySim'); -- Start -- local function makeInvokeFunc(funcName) return function(frame) local args = getArgs(frame) return p[funcName](args) end end p.main = makeInvokeFunc('_main') function p._main(args)-- 生成HTML的主函数 部分代码来源:[[Module:Songtable]] local id = args['bg'] or args['background'] or args['id'] or args[1]; local d = Data[id]; if not d then error('找不到场景文本!!!');end --- 构建HTML --- local box = mw.html.create("table"):addClass("rotable mw-collapsible mw-collapsed storyTable"); local title = '场景 | ' .. d[1]; local subTitle; if d[2] == '' then subTitle = ' ' else title = title .. '(' .. d[2] .. ')';subTitle = d[2]; end box:tag('tr'):tag('th'):tag('h4'):attr('id',id):wikitext(title); local node = box:tag('tr'):tag('td'):addClass('bgSim'); node:tag('div'):addClass('subTitle'):wikitext(subTitle); node:tag('div'):addClass('Title'):wikitext(d[1]); node:tag('div'):addClass('Context'):wikitext(d[3]); local i = 2; local storySimList = {}; while args[i] do local name,linkID = string.match(args[i],'(.*) *>> *(.*)'); if name and linkID then node:tag('div'):addClass('_link'):wikitext('[[#' .. linkID .. '|' .. name ..']]') storySimList[i] = classStorySim._main({'短剧 | ' .. name,linkID}); else error('链接格式错误!!') end i = i + 1; end local str = tostring(box); if i ~= 2 then storySimList[1] = str; str = table.concat(storySimList,"\n"); end return str end return p;