Module:StorySim/Place
可在Module:StorySim/Place/doc创建此模块的帮助文档
local p = {} local getArgs = require('Module:Arguments').getArgs local Data = mw.loadData('Module:RotaenoStoryData/PNodeText') -- 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"); box:tag('tr'):tag('th'):tag('h4'):attr('id',id):wikitext('场景 | ' .. d[1]); local node = box:tag('tr'):tag('td'):addClass('bgSim'); node:tag('div'):addClass('subTitle'):wikitext(d[2] == '' and ' ' or d[2]); node:tag('div'):addClass('Title'):wikitext(d[1]); node:tag('div'):addClass('Context'):wikitext(d[3]); local i = 2; while args[i] do local name,linkID = string.match(args[i],'(.*) *>> *(.*)'); if name and linkID then node:tag('div'):addClass('_link'):wikitext('[[#' .. linkID .. '|' .. name ..']]') else error('链接格式错误!!') end i = i + 1; end return tostring(box) end return p