Module:Dochead: Difference between revisions

Ganaram inukshuk (talk | contribs)
some cleanup; todo
Ganaram inukshuk (talk | contribs)
add header: data/datamodule; this is autodetected if it's a /data subpage.
Line 59: Line 59:
--  other modules. Such modules generally don't have a corresponding
--  other modules. Such modules generally don't have a corresponding
--  template.
--  template.
-- - data/datamodule indicates a module whose purpose is to provide data
--  values to other modules. Like library modules, these don't have a
--  corresponding template.
-- Does the module have a template?
-- Does the module have a template?
-- - dualuse, metatemplate, and noinvoke: YES (REQUIRED!!)
-- - dualuse, metatemplate, and noinvoke: YES (REQUIRED!!)
-- - metamodule/library: GENERALLY NO
-- - metamodule/library and data: GENERALLY NO
local result = ""
local result = ""
if header == "dualuse" then
if header == "dualuse" then
Line 101: Line 104:
elseif header == "library" or header == "metamodule" then
elseif header == "library" or header == "metamodule" then
result = "This module primarily serves as a library for other modules and has no corresponding template."
result = "This module primarily serves as a library for other modules and has no corresponding template."
 
elseif header == "data" or pagename:gsub("/doc$", ""):match("/data$") then
result = "This module primarily serves to provide data values for other modules and has no corresponding template."
else
else
if has_template and header ~= "" then
if has_template and header ~= "" then
Line 183: Line 189:
-- Does the template have a module?
-- Does the template have a module?
-- - dualuse and metatemplate: YES (REQUIRED!!)
-- - dualuse and metatemplate: YES (REQUIRED!!)
-- - noinvoke and metamodule/library: options don't apply to templates.
-- - noinvoke, metamodule/library, and data/datamodule: option's don't apply
--  to templates.
-- RATIONALE FOR NOINVOKE NOT APPLYING: a template may invoke functions from
-- RATIONALE FOR NOINVOKE NOT APPLYING: a template may invoke functions from
-- more than one module, but one of them must be the "main" module. Since
-- more than one module, but one of them must be the "main" module. Since
Line 222: Line 229:
end
end


elseif header == "noinvoke" or header == "library" or header == "metamodule" then
elseif header == "noinvoke" or header == "library" or header == "metamodule" or header == "data" or header == "datamodule" then
result = "This template has a header option in the wrong namespace. It should be used within the Module namespace."
result = "This template has a header option in the wrong namespace. It should be used within the Module namespace."