模組:Trim quotes/sandbox
这是Module:Trim quotes(差异)的沙盒。 |
模块文档[创建]
您可能想要创建本Scribunto模块的文档。 编者可以在本模块的沙盒 (编辑 | 差异)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模块的子页面。 |
local p = {}
function p._trim(s)
if s then
if s:match([[^(['"]).*%1$]]) then return p._trim(string.sub(s,2,-2)) else return s end
else
return ""
end
end
function p.trim(frame)
local s = (frame.args['s'] or frame.args[1]) or (frame:getParent().args['s'] or frame:getParent().args[1])
return p._trim(s)
end
return p