Deze module is nog in ontwikkeling (versie 0.0) en wordt getest.
De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over Lua Scribunto beschikbaar.
In deze module worden de configuratie instellingen gezet voor alle modules van de Module:Layout. De instellingen betreft
de locaties van alle pagina's die worden gebruikt,
het laden van die pagina's,
het linken van media,
het aanwijzen van welke pagina's te testen zijn,
de tekst bij fout-meldingen en
nog een aantal andere zaken.
Subpagina's
-- Although locally declared this variables are used as shared between different moduleslocalCFG={}CFG.VERSION="0.0";CFG.LANGUAGE="NL";CFG.INTERFACE_TEMPLATE={production="Sjabloon:Opmaak",stage="Sjabloon:Opmaak/Wachtruimte",development="Sjabloon:Opmaak/Werkplaats",sandbox="Sjabloon:Opmaak/Zandbak"};CFG.LOCATIONS={"","Configuration/","Model/","Interface/","View/","Library/"}-- Search in these pathsCFG.ENVIRONMENTS={"sandbox","development","stage","production"}-- Valid environments in searchorderCFG.TONES=10;-- Number of tones in color-- This function returns submodules based on the title(s) given in the arguments and the current environment-- Titles may use Title/Subtitle as an argumentfunctionCFG.INCLUDE(environment,...)-- : unpack of LUA submodules-- The variable number of arguments are the module nameslocalmodules={...};localfound_environment=nil;forindex,valueinipairs(CFG.ENVIRONMENTS)doifvalue==environmentthenfound_environment=index;break;endendlocalincludes={};-- Store loading modules in the includes array-- Look starting from the environment up to the production environment for changed modules.-- If no environment is found then use the production environmentfori=found_environmentor#CFG.ENVIRONMENTS,#CFG.ENVIRONMENTSdoenvironment=CFG.ENVIRONMENTS[i]:gsub("^%l",string.upper);-- The convention for the path is uppercase firstforindex,modulenameinipairs(modules)do-- Loop over the arguments with the module name as valueif(includes[index]==nil)then-- Convert the input string into one that has capitalized first characters in the path.-- With the string.gmatch() function iterate over the segments of the modulename separated by slashes. -- For each segment, capitalize the first letter and sets the rest of the segment to lowercase.-- It then inserts the modified segment into a table. -- Finally, the table.concat() function is used to concatenate the table into a single output string, using the slash as the separator.localpath_segments={};forsegmentinstring.gmatch(modulename,"([^/]+)")do-- Capitalize the first letter and add the rest of the segment as lowercaselocalcapitalized=string.upper(string.sub(segment,1,1))..string.lower(string.sub(segment,2));table.insert(path_segments,capitalized);endmodulename=table.concat(path_segments,"/");for_,locationinipairs(CFG.LOCATIONS)dolocaltitle_path="Module:Layout/"..environment.."/"..location..modulename;ifmw.title.new(title_path).existsthenincludes[index]=require(title_path);break;endendendendendreturnunpack(includes);-- Unpack the table and return them as separate valuesendreturnCFG;