Module:request category page list

From Wiktionary, the free dictionary
Jump to navigation Jump to search


local export = {}

function export.show(frame)
	local labels = {}
	local items = {}

	labels["cleanup"] = {
		box_title = "Tagged RFCs",
		top_category = "Requests for cleanup by language",
	}

	labels["deletion"] = {
		box_title = "Tagged RFDs",
		top_category = "Requests for deletion by language",
	}

	labels["verification"] = {
		box_title = "Tagged RFVs",
		top_category = "Requests for verification by language",
	}

	local arguments = frame:getParent().args
	local current_label = arguments[1]

	for key, value in pairs(labels[current_label]) do
		items[key] = value
	end
	
	-- Top div has the class tagged-rfcs, tagged-rfds, or tagged-rfvs.
	local class_name = items.box_title:lower():gsub(" ", "-")
	local full_text_top=('<div class="%s" style="float: right; background: var(--wikt-palette-paleblue,#F8F9FA); color: var(--wikt-palette-black,#000);">'
		.. '<div id="%s-header" style="background: var(--wikt-palette-lightergrey,#EEEEEE) color: var(--wikt-palette-black,#000); text-align: center; font-size: 1em; font-weight: bold;">%s</div>')
		:format(class_name, class_name, items.box_title)
	local full_text_bottom="</div>"

	local categorytree = frame:callParserFunction{
		name = "#categorytree",
		args = {
			items.top_category,
			depth = 1,
			mode = "pages",
			showcount = "on"
		}
	}

	return full_text_top .. categorytree .. full_text_bottom
end

return export