模块:Featured article list

求闻百科,共笔求闻

本模块用于展示主页的特色条目列表。如需让特色条目能够显示,请编辑对应的数据部分:随机展示的特色条目请参见Module:Featured article list/randoms,特定日期展示的特色条目请参见Module:Featured article list/datesC1型敞车中国铁路一型已经淘汰的敞车,属于通用敞车类型。全车共4轴,载重30吨,适用于标准轨距铁路

C1型敞车根据来源可分为三类:第一类是解放时接收的旧型车,第二类是1949~1961年间在部分旧型车图纸基础上继续改进生产的新造车,第三类则是1961年后由其他型号旧型敞车或煤车改造合并而来的改造车。本型号中的新造车是新中国成立后第一型自行生产的敞车。

C1型敞车大多可以卸掉全部立柱、墙板和车门,改做平车使用。如改装后不再恢复、按平车运用,则定型为NC1型平车

共有以下页面可以显示

当前显示的页面名称为:Qiuwen:好条目展示/中国铁路C1型敞车
上述文档内容嵌入自Module:Featured article list/doc编辑 | 历史
编者可以在本模块的沙盒创建 | 镜像和测试样例创建页面进行实验。
请将模块自身所属的分类添加在文档中。本模块的子页面
local randoms = mw.loadData 'Module:Featured article list/randoms'
local dates = mw.loadData 'Module:Featured article list/dates'
local p = {}
function p.main(frame)
	local lang = mw.language.getContentLanguage()
	local year = lang:formatDate('Y', nil, true)
	local month = lang:formatDate('n', nil, true)
	local day = lang:formatDate('j', nil, true)
	
	if dates[year] and dates[year][month] and dates[year][month][day] then
		return frame:preprocess(dates[year][month][day])
	elseif dates['any'] and dates['any'][month] and dates['any'][month][day] then
		return frame:preprocess(dates['any'][month][day])
	end
	
	local edits = mw.site.stats.edits
	local title = randoms[edits % randoms.length + 1]
	return frame:expandTemplate {title = title}
end

function p.list(frame)
	local node = mw.html.create ''
	node:wikitext '共有以下页面可以显示'
	node:newline()
	
	local ul = node:tag 'ul'
	
	for _, v in ipairs(randoms) do
		ul:tag 'li'
			:wikitext('[[' .. v .. ']]')
	end
	
	local edits = mw.site.stats.edits
	local title = randoms[edits % randoms.length + 1]
	node:wikitext('当前显示的页面名称为:[[' ..title .. ']]')
	
	return node
end

function p.listRandoms(frame)
	local node = mw.html.create ''
	node:wikitext '本站随机展示的特色条目中共有以下内容:'
	local ol = mw.html.create 'ol'
	for _, v in ipairs(randoms) do
		local li = ol:tag 'li'
		li:wikitext(string.format('[[%s]]([[Special:EditPage/%s|编辑]])', v, v))
		li:newline()
		
		local successes, result = pcall(frame.expandTemplate, frame, {title = v})
		li:wikitext('<div>' ..result.. '</div>')
	end
	return ol
end

return p