<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://calcwiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMain</id>
	<title>Module:Main - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://calcwiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMain"/>
	<link rel="alternate" type="text/html" href="https://calcwiki.org/index.php?title=Module:Main&amp;action=history"/>
	<updated>2026-05-04T01:09:00Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://calcwiki.org/index.php?title=Module:Main&amp;diff=4109&amp;oldid=prev</id>
		<title>春上冰月：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://calcwiki.org/index.php?title=Module:Main&amp;diff=4109&amp;oldid=prev"/>
		<updated>2016-02-17T07:39:46Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
-- This module produces a link to a main article or articles. It implements the&lt;br /&gt;
-- template {{main}}.&lt;br /&gt;
-- &lt;br /&gt;
-- If the module is used in category or category talk space, it produces &amp;quot;The&lt;br /&gt;
-- main article for this category is xxx&amp;quot;. Otherwise, it produces&lt;br /&gt;
-- &amp;quot;Main article: xxx&amp;quot;.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require(&amp;#039;Module:Hatnote&amp;#039;)&lt;br /&gt;
local mTableTools -- lazily initialise&lt;br /&gt;
local mArguments -- lazily initialise&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	mTableTools = require(&amp;#039;Module:TableTools&amp;#039;)&lt;br /&gt;
	mArguments = require(&amp;#039;Module:Arguments&amp;#039;)&lt;br /&gt;
	local args = mArguments.getArgs(frame, {parentOnly = true})&lt;br /&gt;
	local pages = {}&lt;br /&gt;
	--模板版的限制&lt;br /&gt;
	local limit =10 &lt;br /&gt;
	local islimit=false&lt;br /&gt;
	local limittext = &amp;quot;&amp;lt;span class=\&amp;quot;error\&amp;quot;&amp;gt;（在模板&amp;quot;..frame:expandTemplate{title=&amp;quot;tl&amp;quot;,args={&amp;quot;main&amp;quot;}}..&amp;quot;中使用了太多的参数）&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
	--模板版的限制&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if type(k) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			if k &amp;gt; limit then &lt;br /&gt;
				islimit=true &lt;br /&gt;
				break &lt;br /&gt;
			else	&lt;br /&gt;
				local display = args[&amp;#039;l&amp;#039; .. tostring(k)]&lt;br /&gt;
				local page = {v, display}&lt;br /&gt;
				pages[k] = page&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	pages = mTableTools.compressSparseArray(pages)&lt;br /&gt;
	local options = {&lt;br /&gt;
		selfref = args.selfref&lt;br /&gt;
	}&lt;br /&gt;
	return p._main(frame,options, unpack(pages)) .. ((islimit and limittext) or &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(frame,options, ...)&lt;br /&gt;
	-- Get the list of pages. If no first page was specified we use the current&lt;br /&gt;
	-- page name.&lt;br /&gt;
	local pages = {...}&lt;br /&gt;
	local currentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
	local firstPageTable = pages[1]&lt;br /&gt;
	local firstPage&lt;br /&gt;
	if firstPageTable then&lt;br /&gt;
		firstPage = firstPageTable[1]&lt;br /&gt;
	else&lt;br /&gt;
		firstPage = currentTitle.text&lt;br /&gt;
		firstPageTable = {firstPage}&lt;br /&gt;
		pages[1] = firstPageTable&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Find the pagetype.&lt;br /&gt;
	local firstPageNs = mHatnote.findNamespaceId(firstPage)&lt;br /&gt;
	local pagetype = firstPageNs == 0 and &amp;#039;条目&amp;#039; or &amp;#039;页面&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- Make the formatted link text&lt;br /&gt;
	local links = mHatnote.formatPageTables(unpack(pages))&lt;br /&gt;
	links = mw.text.listToText(links)&lt;br /&gt;
&lt;br /&gt;
	-- Build the text.&lt;br /&gt;
	local currentNs = currentTitle.namespace&lt;br /&gt;
	local isCategoryNamespace = currentNs - currentNs % 2 == 14&lt;br /&gt;
	local stringToFormat&lt;br /&gt;
	if isCategoryNamespace then&lt;br /&gt;
		stringToFormat = &amp;#039;此[[Wikipedia:頁面分類|分类]]的主%s是%s&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		stringToFormat = &amp;#039;主%s：%s&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local text = string.format(stringToFormat, pagetype, links)&lt;br /&gt;
&lt;br /&gt;
	-- Process the options and pass the text to the _rellink function in&lt;br /&gt;
	-- [[Module:Hatnote]].&lt;br /&gt;
	--[[options = options or {}&lt;br /&gt;
	local hnOptions = {&lt;br /&gt;
		extraclasses = &amp;#039;noprint relarticle mainarticle&amp;#039; --追加noprint的css类&lt;br /&gt;
		,selfref = options.selfref&lt;br /&gt;
	}&lt;br /&gt;
	return mHatnote._hatnote(text, hnOptions)]]&lt;br /&gt;
	return frame:expandTemplate{title=&amp;quot;rellink&amp;quot;,args={text,extraclasses=&amp;#039;noprint relarticle mainarticle&amp;#039;}} --没想到Hatnote与{{rellink}}实现不同，替代品&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>春上冰月</name></author>
	</entry>
</feed>