Module:StorySim/Place:修订间差异
(创建页面,内容为“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 a…”) |
无编辑摘要 |
||
第19行: | 第19行: | ||
--- 构建HTML --- | --- 构建HTML --- | ||
local box = mw.html.create("table"):addClass("rotable mw-collapsible mw-collapsed storyTable"); | local box = mw.html.create("table"):addClass("rotable mw-collapsible mw-collapsed storyTable"); | ||
box:tag('tr'):tag('th'):tag('h4'):attr('id',id):wikitext( | 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'); | local node = box:tag('tr'):tag('td'):addClass('bgSim'); | ||
node:tag('div'):addClass('subTitle'):wikitext( | node:tag('div'):addClass('subTitle'):wikitext(subTitle); | ||
node:tag('div'):addClass('Title'):wikitext(d[1]); | node:tag('div'):addClass('Title'):wikitext(d[1]); | ||
node:tag('div'):addClass('Context'):wikitext(d[3]); | node:tag('div'):addClass('Context'):wikitext(d[3]); | ||
第35行: | 第40行: | ||
return tostring(box) | return tostring(box) | ||
end | end | ||
return p | return p; |
2023年12月31日 (日) 15:32的版本
可在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"); 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; 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;