Module:Navbox

p={}

function p.machine(frame) if mw.title.getCurrentTitle.nsText== "Template" and mw.title.getCurrentTitle.text==string.gsub(frame.args["name"], "%s+", "").."Menu" then return docPage(frame); else return machineNavbox(frame); end end

function machineNavbox(frame) title = ""..frame.args["name"].." Products"; body = ""; local index=1; while(frame.args[index]) do		item= mw.text.trim(frame.args[index]); body = body .. frame:expandTemplate({title="BigIcon",args={item,["point"]=item}}); index = index+1; end; return frame:expandTemplate({title="NavMenu",args={title=title,body=body,related="Products"}}); end

function docPage(frame) str = "Documentation for this template \n"; str = str..";Description\n" str = str.."This template is used as a navigation box at the bottom of articles about the products of the "..frame.args["name"]..".\n\n" str = str.. "Do not use this template directly. In stead, please make sure the page is listed in the correctsection of the source at, and then include that template in the desired page. Doing this will produce:\n" str = str .. machineNavbox(frame).."\n"; str = str .. " This text comes from Module:Navbox, from the function called .  "; str = str..""; return str; end

return p;