跳转到内容

模組:Trim quotes

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由Qqkuro66541留言 | 贡献2018年7月14日 (六) 15:40 建立内容为“local p = {} local function _trim(s) if s then if mw.ustring.find(s,'^".*"$') or mw.ustring.find(s,"^'.*'$") then return _trim(string.sub(s,2,-2…”的新页面)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)
local p = {}

local function _trim(s)
	if s then
		if mw.ustring.find(s,'^".*"$') or mw.ustring.find(s,"^'.*'$") then return _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 _trim(s)
end
	
return p