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 deze onderwijswiki beschikbaar.
localluggage={};-- This function will add all named parameters from the frame as parameters of the call object-- now it is clear that there is nothing to declare on first sight (all the names of the parameters are valid)functionluggage.carry_on(call)-- The functions from other modules that are used in this functionlocaltext,array=call.include("text","array");-- All valid parameters are stored as hooks in the configurationfor_,parameterinipairs(call.hook.PARAMETER)docall[parameter]=false;ifcall.named[parameter]andcall.named[parameter]~=""then-- If the value of the parameter is not an enumeration, it does not need a translation for internal use.ifcall.message.HOOK[string.upper(parameter)]==nilthencall[parameter]=call.named[parameter];else-- Look where in the enumeration the translated value matches the internal value. Search case-insensitive!localsearch=array.search(call.message.HOOK[string.upper(parameter)],call.named[parameter],true);ifsearchthencall[parameter]=call.hook[string.upper(parameter)][search];endendendendreturncall;end-- This function only claims the information needed for the onward journey.functionluggage.claim(call)return{pass=call.pass,message=call.message,support=call.support,debugging=call.debugging,mistake=call.mistake,help=call.help};end-- This function drops the frame and the CFG luggage into the call object for safe carrying through the right environmentfunctionluggage.drop(call,frame,CFG,environment)call.CFG=CFG;call.frame=frame;call.version=CFG.VERSION;call.template=CFG.INTERFACE_TEMPLATE[call.environment];call.language=CFG.LANGUAGE;call.language_path="language/"..call.language;call.message=call.include(call.language_path);call.hook=call.include("hook");call.style=call.include("style");call.tones=CFG.TONES;call.message.PARAM={};fori,keyinipairs(call.hook.PARAMETER)dolocalvalue=call.message.HOOK.PARAMETER[i];call.message.PARAM[string.upper(key)]=value;end-- The functions from other modules that are used in this functionlocaltext=call.include("text");call.invoker=text.trim(call.frame:getParent():getTitle());call.caller=mw.title.getCurrentTitle();-- Split the frame arguments into named and unnamed parameters and make sure they all are strings.forkey,valueinpairs(frame.args)doiftype(key)=="string"thencall.named[key]=tostring(value);elsecall.unnamed[key]=tostring(value);endend-- Make a translation of the array of valid objects by looking into the object's language file-- Store the translation into a new message object.call.message.HOOK.OBJECT={};call.message.OBJECT={};-- Look for every valid object as declared in the hook configuration if there is a language file with a object name in that languageforindex,objectnameinipairs(call.hook.OBJECT)dolocalobject_language_path=call.language_path.."/"..objectname;localobject_language=call.include(object_language_path);ifobject_language~=nilandobject_language.NAME~=nilthencall.message.HOOK.OBJECT[index]=object_language.NAME;call.message.OBJECT[string.upper(objectname)]=object_language.NAMEendendreturncall;end-- This function converts and/or extends the call parameters so it can be loaded for passing to the view.functionluggage.loading(call)-- The functions from other modules that are used in this functionlocalinventory=call.include("inventory");-- Convert and complete the values of the valid parameters passedfor_,parameterinipairs(call.hook.PARAMETER)doiftype(inventory[parameter])=="function"thencall[parameter]=inventory[parameter](call);endend-- Add messages specific to the choosen objectforindex,objectnameinipairs(call.hook.OBJECT)dolocalobject_language_path=call.language_path.."/"..objectname;localobject_language=call.include(object_language_path);ifobject_language~=nilthencall.message[string.upper(objectname)]=object_language;endend-- Extend the call variable with a content that is specific to the type of the objectlocalcontent=call.include("content/"..call.object);ifcontentthencall=content.main(call);endreturncall;endreturnluggage;