打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:Example:修订间差异

来自 LNN的:not(博客)?
DGCK81LNN留言 | 贡献
创建页面,内容为“local p = {} local libraryUtil = require("libraryUtil") local getArgs = require("Module:Arguments").getArgs function p._example(frame, code) libraryUtil.checkType("_example", 1, frame, "table") libraryUtil.checkType("_example", 2, code, "string") local source = mw.text.tag("pre", {}, code) local result = frame:preprocess(code) return source, result end function p.example(frame) local args = getArgs(frame, { trim = false }) local str = args[1] str = m…”
 
DGCK81LNN留言 | 贡献
无编辑摘要
第7行: 第7行:
libraryUtil.checkType("_example", 2, code, "string")
libraryUtil.checkType("_example", 2, code, "string")


local source = mw.text.tag("pre", {}, code)
local source = mw.text.tag("pre", {}, mw.text.nowiki(code))
local result = frame:preprocess(code)
local result = frame:preprocess(code)
return source, result
return source, result

2023年2月26日 (日) 00:18的版本

此模块的文档可以在模块:Example/doc创建

local p = {}
local libraryUtil = require("libraryUtil")
local getArgs = require("Module:Arguments").getArgs

function p._example(frame, code)
	libraryUtil.checkType("_example", 1, frame, "table")
	libraryUtil.checkType("_example", 2, code, "string")

	local source = mw.text.tag("pre", {}, mw.text.nowiki(code))
	local result = frame:preprocess(code)
	return source, result
end

function p.example(frame)
	local args = getArgs(frame, { trim = false })
	local str = args[1]
	str = mw.text.unstripNoWiki(str)
	str = mw.text.killMarkers(str)
	str = mw.text.trim(str, "\n")
	return p._example(frame, str)
end

return p