<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://9on0wiki.gunmu.dns.navy/index.php?action=history&amp;feed=atom&amp;title=Module%3A%E6%8C%89%E9%92%AE</id>
	<title>Module:按钮 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://9on0wiki.gunmu.dns.navy/index.php?action=history&amp;feed=atom&amp;title=Module%3A%E6%8C%89%E9%92%AE"/>
	<link rel="alternate" type="text/html" href="https://9on0wiki.gunmu.dns.navy/index.php?title=Module:%E6%8C%89%E9%92%AE&amp;action=history"/>
	<updated>2026-08-27T17:41:43Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://9on0wiki.gunmu.dns.navy/index.php?title=Module:%E6%8C%89%E9%92%AE&amp;diff=555&amp;oldid=prev</id>
		<title>DoubleCircle：​&quot;修复 Module:按钮 的 mw.util 报错：改用 frame:preprocess 生成内部链接地址&quot;</title>
		<link rel="alternate" type="text/html" href="https://9on0wiki.gunmu.dns.navy/index.php?title=Module:%E6%8C%89%E9%92%AE&amp;diff=555&amp;oldid=prev"/>
		<updated>2026-08-25T22:33:09Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;修复 Module:按钮 的 mw.util 报错：改用 frame:preprocess 生成内部链接地址&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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&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年8月25日 (二) 22:33的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l34&quot;&gt;第34行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第34行：&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;			:attr(&amp;#039;rel&amp;#039;, &amp;#039;noopener noreferrer&amp;#039;)&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;			:attr(&amp;#039;rel&amp;#039;, &amp;#039;noopener noreferrer&amp;#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;	else&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;	else&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;		html:attr(&#039;href&#039;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw&lt;/del&gt;.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;util&lt;/del&gt;.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;getUrl(&lt;/del&gt;link))&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;		html:attr(&#039;href&#039;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;frame:preprocess(&#039;{{fullurl:&#039; &lt;/ins&gt;.. link &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.. &#039;}}&#039;&lt;/ins&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;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;br&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;br&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-521:rev-555:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>DoubleCircle</name></author>
	</entry>
	<entry>
		<id>https://9on0wiki.gunmu.dns.navy/index.php?title=Module:%E6%8C%89%E9%92%AE&amp;diff=521&amp;oldid=prev</id>
		<title>DoubleCircle：​&quot;按钮模板改用 Lua 模块生成链接，修复 &lt;a&gt; 标签不被解析导致的 href 外链化问题&quot;</title>
		<link rel="alternate" type="text/html" href="https://9on0wiki.gunmu.dns.navy/index.php?title=Module:%E6%8C%89%E9%92%AE&amp;diff=521&amp;oldid=prev"/>
		<updated>2026-08-25T18:28:12Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;按钮模板改用 Lua 模块生成链接，修复 &amp;lt;a&amp;gt; 标签不被解析导致的 href 外链化问题&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- 按钮模板：生成带图标与文字标签的链接按钮（Template:按钮）&lt;br /&gt;
-- 使用 Lua 生成 &amp;lt;a&amp;gt; 标签，避免 MediaWiki 自动把 href 中的裸 URL 外链化。&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function isExternalUrl(url)&lt;br /&gt;
	if not url then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return url:match(&amp;#039;^%s*https?://&amp;#039;) ~= nil&lt;br /&gt;
		or url:match(&amp;#039;^%s*//&amp;#039;) ~= nil&lt;br /&gt;
		or url:match(&amp;#039;^%s*ftp://&amp;#039;) ~= nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.render(frame)&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
&lt;br /&gt;
	local link     = args[&amp;#039;链接&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local external = args[&amp;#039;外部链接&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local label    = args[&amp;#039;label&amp;#039;] or args[&amp;#039;标签&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local icon     = args[&amp;#039;图标&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local image    = args[&amp;#039;图片&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local shape    = args[&amp;#039;形状&amp;#039;] or &amp;#039;圆角矩形&amp;#039;&lt;br /&gt;
	local size     = args[&amp;#039;尺寸&amp;#039;] or &amp;#039;64&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	local isExternal = (external ~= &amp;#039;&amp;#039;) or isExternalUrl(link)&lt;br /&gt;
&lt;br /&gt;
	local html = mw.html.create(&amp;#039;a&amp;#039;)&lt;br /&gt;
	html:addClass(&amp;#039;wiki-button-anchor&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	if isExternal then&lt;br /&gt;
		html:attr(&amp;#039;href&amp;#039;, link)&lt;br /&gt;
			:attr(&amp;#039;target&amp;#039;, &amp;#039;_blank&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;rel&amp;#039;, &amp;#039;noopener noreferrer&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		html:attr(&amp;#039;href&amp;#039;, mw.util.getUrl(link))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local button = html:tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
	button:addClass(&amp;#039;wiki-button&amp;#039;)&lt;br /&gt;
	button:addClass(&amp;#039;wiki-button-&amp;#039; .. shape)&lt;br /&gt;
&lt;br /&gt;
	local iconSpan = button:tag(&amp;#039;span&amp;#039;):addClass(&amp;#039;wiki-button-icon&amp;#039;)&lt;br /&gt;
	if image ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		iconSpan:wikitext(string.format(&amp;#039;[[File:%s|%spx|link=]]&amp;#039;, image, size))&lt;br /&gt;
	elseif icon ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		iconSpan:tag(&amp;#039;span&amp;#039;):addClass(&amp;#039;wiki-button-emoji&amp;#039;):wikitext(icon)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	button:tag(&amp;#039;span&amp;#039;):addClass(&amp;#039;wiki-button-label&amp;#039;):wikitext(label)&lt;br /&gt;
&lt;br /&gt;
	return tostring(html)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>DoubleCircle</name></author>
	</entry>
</feed>