模块:Utils:修订间差异

来自Limbo Wiki
无编辑摘要
标签(旧)WikiEditor
(Rewrite)
标签(旧)WikiEditor
第14行: 第14行:
f:extensionTag {
f:extensionTag {
name = "indicator",
name = "indicator",
content = '<div id="mw-indicator-' .. frame.args[1] ..'" class="mw-indicator">' .. frame.args[2] .. "</div>"
content = '<div class="mw-indicator" id="Indicator-' .. frame.args[1] ..'">' .. frame.args[2] .. "</div>",
args = {name = frame.args[1]}
};
};
return;
return;

2022年12月10日 (六) 03:40的版本

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

local p = {} --啥都有。

function p.urlEncode(frame)
	local a = string.gsub(frame.args[1], "([^%w%.%- ])", 
		function(c)
			return string.format("%%%02X", string.byte(c))
		end
	)
	return a;
end

function p.ind(frame)
	f = mw.getCurrentFrame();
	f:extensionTag {
		name = "indicator",
		content = '<div class="mw-indicator" id="Indicator-' .. frame.args[1] ..'">' .. frame.args[2] .. "</div>",
		args = {name = frame.args[1]}
	};
	return;
end

return p