模块:TWRSideNavBox
跳到导航
跳到搜索
local p = {} itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" function p.assemblyFixedNavBox( frame ) local returnString = "" itemString = itemString:gsub("{{FULLPAGENAME}}", frame.args["pagename"]) for k, v in pairs(frame.args) do splitPoint = v:find("::") -- Format of each element: "<File Name>::<Anchor>" -- with no spaces in both sides of the backslash if splitPoint ~= nil and splitPoint > 1 then name1 = v:sub(1, splitPoint - 1) name2 = v:sub(splitPoint + 2) if name1:find("%.%w+$") ~= nil then segment = itemString:gsub("{{{1}}}", name1) else -- If no file extension is found, assumes PNG by default segment = itemString:gsub("{{{1}}}", name1 .. ".png") end segment = segment:gsub("{{{2}}}", name2) returnString = returnString .. segment end end return "{|\n" .. returnString .. "|}" end return p