跳转到内容

Module:首页分类:修订间差异

来自陋室
删除的内容 添加的内容
Maintenance script​(留言 | 贡献)
创建首页分类气泡模块
 
Maintenance script​(留言 | 贡献)
修正首页分类气泡模块输出结构
第13行: 第13行:


function p.bubbles()
function p.bubbles()
local output = {
local links = {}
⚫
'<div class="mw-mainpage-link-cloud" data-source="Module:首页分类">'
}


for _, category in ipairs( categories ) do
for _, category in ipairs( categories ) do
output[#output + 1] = string.format(
links[#links + 1] = string.format(
'[[:Category:%s|%s]]',
'[[:Category:%s|%s]]',
category.title,
category.title,
第25行: 第23行:
end
end


⚫
return '<div class="mw-mainpage-link-cloud" data-source="Module:首页分类">' ..
output[#output + 1] = '</div>'
return table.concat( output, '\n' )
table.concat( links, ' ' ) ..
'</div>'
end
end



2026年7月16日 (四) 19:21的版本

此模块的文档可以在Module:首页分类/doc创建

local p = {}

local categories = {
	{ title = '云计算与大数据', label = '云计算与大数据' },
	{ title = 'Python 后端开发', label = 'Python 后端开发' },
	{ title = 'Java 后端开发', label = 'Java 后端开发' },
	{ title = '软件测试', label = '软件测试' },
	{ title = 'Web 前端开发', label = 'Web 前端开发' },
	{ title = '物联网应用技术', label = '物联网应用技术' },
	{ title = 'AIGC', label = 'AIGC' },
	{ title = '通信技术', label = '通信技术' },
}

function p.bubbles()
	local links = {}

	for _, category in ipairs( categories ) do
		links[#links + 1] = string.format(
			'[[:Category:%s|%s]]',
			category.title,
			category.label
		)
	end

	return '<div class="mw-mainpage-link-cloud" data-source="Module:首页分类">' ..
		table.concat( links, ' ' ) ..
		'</div>'
end

return p