Module:Infobox/ConfigDocGen: Difference between revisions
Jump to navigation
Jump to search
PhantomCaleb (talk | contribs) mNo edit summary |
PhantomCaleb (talk | contribs) 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({ | ||
title = "Template:Infobox Config Doc", | |||
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