Module:Infobox/ConfigDocGen: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}


function p.Main()
function p.Main(frame)
local title = mw.title.getCurrentTitle()
local title = mw.title.getCurrentTitle()
local cats = p.categorize(title)
local cats = p.categorize(title)
local subjectType = p.extractSubjectType(title)
local subjectType = p.extractSubjectType(title)
local text = ""
local text = frame:expandTemplate({
.. string.format("<p>This page defines the parameters of [[Template:Infobox %s]]. Refer to the \"Schema\" tab below for information on the expected structure of the configuration data.</p>", subjectType)
title = "Template:Infobox Config Doc",
.. "<p>The infobox may include common parameters which are defined on the [[Module:Infobox/Config]] base page. Below is a table listing all of the parameters currently enabled for the infobox.</p>"
args = {subjectType}
 
})
return text, cats
return text, cats
end
end

Revision as of 23:43, 10 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]]"
	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