首页
随机
登录
设置
关于DJMAX中文资料库
免责声明
DJMAX中文资料库
搜索
查看“︁模块:ExampleTable”︁的源代码
←
模块:ExampleTable
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local getArgs = require('Module:Arguments').getArgs function p.main(frame) local args = getArgs(frame) -- 获取输入和输出参数 local input = args[1] or "" local output = args[2] -- 如果 output 未提供,则移除左侧的 <nowiki> 标签并渲染内容 if not output then -- 移除 <nowiki> 标签 local nowiki_content = input:gsub("</?nowiki>", "") -- 渲染内容 output = frame:preprocess(nowiki_content) end -- 清理输出中的多余空格和换行 output = output:gsub("\n+", "\n"):gsub("^%s*(.-)%s*$", "%1") -- 创建表格HTML local tableHtml = mw.html.create('table') :addClass('wikitable') :tag('tr') :tag('th') :css('width', '50%') :wikitext('输入') :done() :tag('th') :css('width', '50%') :wikitext('输出') :done() :done() :tag('tr') :tag('td') :css({ ['vertical-align'] = 'middle', width = '50%' }) :tag('pre') :css('white-space', 'pre-wrap') :wikitext(input) -- 左侧显示原始输入(包括 <nowiki> 标签) :done() :done() :tag('td') :css({ ['vertical-align'] = 'middle', width = '50%' }) :wikitext(output) -- 右侧显示输出内容 :done() :done() return tostring(tableHtml) end return p
该页面使用的模板:
模块:ExampleTable/doc
(
查看源代码
)
返回
模块:ExampleTable
。