Module:Infobox/ConfigDocGen: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
No edit summary
m (PhantomCaleb moved page Module:Infobox/DocGen to Module:Infobox/ConfigDocGen without leaving a redirect)
(No difference)

Revision as of 18:16, 21 April 2024

This module generates documentation for Module:Infobox/Config and its subpages.


local p = {}

function p.Main(frame)
	local title = mw.title.getCurrentTitle()
	local cats = p.categorize(title)
	local subjectType = p.extractSubjectType(title)
	
	local text = frame:expandTemplate({
		title = "Template:Infobox Config Doc",
		args = {subjectType}
	})
	
	return text, cats
end

function p.categorize(title)
	if title.subpageText == "Documentation" then
		return "[[Category:Module Data Documentation]]"
	else
		return "[[Category:Module Data]][[Category:Infobox configuration pages]]"
	end
end

function p.extractSubjectType(title)
	if title.subpageText == "Documentation" then
		return mw.title.new(title.baseText).subpageText
	else
		return title.subpageText
	end
end

return p