<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://test.zybkcn.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AMultiReplace</id>
	<title>Module:MultiReplace - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://test.zybkcn.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AMultiReplace"/>
	<link rel="alternate" type="text/html" href="https://test.zybkcn.com/w/index.php?title=Module:MultiReplace&amp;action=history"/>
	<updated>2026-07-18T03:15:21Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://test.zybkcn.com/w/index.php?title=Module:MultiReplace&amp;diff=795&amp;oldid=prev</id>
		<title>WikiBot：​错误信息改为中文 + 保留 nowiki 转义</title>
		<link rel="alternate" type="text/html" href="https://test.zybkcn.com/w/index.php?title=Module:MultiReplace&amp;diff=795&amp;oldid=prev"/>
		<updated>2026-06-22T12:43:51Z</updated>

		<summary type="html">&lt;p&gt;错误信息改为中文 + 保留 nowiki 转义&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年6月22日 (一) 20:43的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第11行：&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第11行：&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		if not change.repl then&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		if not change.repl then&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return require(&#039;Module:Error&#039;).error{&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return require(&#039;Module:Error&#039;).error{&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;				&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MultiReplace: Unpaired argument: &lt;/del&gt;&amp;lt;code&amp;gt;&#039; .. (i * 2) .. &#039; = &#039; .. mw.text.nowiki(change.pattern) .. &#039;&amp;lt;/code&amp;gt;&#039;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;				&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MultiReplace：不配对冲突：&lt;/ins&gt;&amp;lt;code&amp;gt;&#039; .. (i * 2) .. &#039; = &#039; .. mw.text.nowiki(change.pattern) .. &#039;&amp;lt;/code&amp;gt;&#039;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key zybkcn_com:diff:1.41:old-794:rev-795:wikidiff2=table:1.14.2:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiBot</name></author>
	</entry>
	<entry>
		<id>https://test.zybkcn.com/w/index.php?title=Module:MultiReplace&amp;diff=794&amp;oldid=prev</id>
		<title>WikiBot：​写入 enwiki 原版 Module:MultiReplace（local p + nowiki 转义）</title>
		<link rel="alternate" type="text/html" href="https://test.zybkcn.com/w/index.php?title=Module:MultiReplace&amp;diff=794&amp;oldid=prev"/>
		<updated>2026-06-22T12:42:38Z</updated>

		<summary type="html">&lt;p&gt;写入 enwiki 原版 Module:MultiReplace（local p + nowiki 转义）&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local function MultiReplace(args)&lt;br /&gt;
	local input = args[1] or &amp;quot;{{{1}}}&amp;quot;&lt;br /&gt;
	local plain = args.plain == &amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	local i = 1&lt;br /&gt;
	local changeList = {}&lt;br /&gt;
	while args[i * 2] do&lt;br /&gt;
		local change = {pattern = args[i * 2], repl = args[i * 2 + 1]}&lt;br /&gt;
		if not change.repl then&lt;br /&gt;
			return require(&amp;#039;Module:Error&amp;#039;).error{&lt;br /&gt;
				&amp;#039;MultiReplace: Unpaired argument: &amp;lt;code&amp;gt;&amp;#039; .. (i * 2) .. &amp;#039; = &amp;#039; .. mw.text.nowiki(change.pattern) .. &amp;#039;&amp;lt;/code&amp;gt;&amp;#039;&lt;br /&gt;
			}&lt;br /&gt;
		end&lt;br /&gt;
		changeList[i] = change&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local matchList = {}&lt;br /&gt;
	local pos = 1&lt;br /&gt;
	local len = mw.ustring.len(input)&lt;br /&gt;
	local result = &amp;quot;&amp;quot;&lt;br /&gt;
	while pos &amp;lt;= len do&lt;br /&gt;
		local bestStart = len + 1&lt;br /&gt;
		local bestStop = len&lt;br /&gt;
		local bestChange&lt;br /&gt;
		for _, change in ipairs(changeList) do&lt;br /&gt;
			local start, stop = mw.ustring.find(input, change.pattern, pos, plain)&lt;br /&gt;
			if start and (start &amp;lt; bestStart) then&lt;br /&gt;
				bestStart = start&lt;br /&gt;
				bestStop = stop&lt;br /&gt;
				bestChange = change&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		result = result .. mw.ustring.sub(input, pos, bestStart - 1)&lt;br /&gt;
		if bestChange then&lt;br /&gt;
			local fragment = mw.ustring.sub(input, bestStart, bestStop)&lt;br /&gt;
			result = result .. (plain and bestChange.repl or&lt;br /&gt;
				mw.ustring.gsub(fragment, bestChange.pattern, bestChange.repl, 1))&lt;br /&gt;
		end&lt;br /&gt;
		pos = bestStop + 1&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame, ...)&lt;br /&gt;
	local args =&lt;br /&gt;
		type(frame) ~= &amp;#039;table&amp;#039; and {frame, ...} or&lt;br /&gt;
		type(frame.args) ~= &amp;#039;table&amp;#039; and frame or&lt;br /&gt;
		frame.args[1] and frame.args or&lt;br /&gt;
		frame:getParent().args&lt;br /&gt;
	return MultiReplace(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiBot</name></author>
	</entry>
</feed>