Editing Module:NavboxGeneratorGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 3: | Line 3: | ||
local function generateNavbox(data, level) | local function generateNavbox(data, level) | ||
local result = {} | local result = {} | ||
local | local boxSize = 5 - level -- Adjust this to control the box size reduction per level | ||
local fontSize = | local fontSize = 150 - (level * 20) -- Adjust to decrease font size per level | ||
for key, value in pairs(data) do | for key, value in pairs(data) do | ||
if | if type(value) == "table" then | ||
table.insert(result, string.format( | table.insert(result, string.format( | ||
'<div style=" | '<div style="font-size:%d%%; border:1px solid #aaa; padding:5px; margin:2px;">=%s=</div>', | ||
fontSize, | fontSize, key | ||
)) | )) | ||
table.insert(result, generateNavbox(value, level + 1)) -- Recursively process next level | |||
else | |||
table.insert(result, string.format( | table.insert(result, string.format( | ||
'<div style=" | '<div style="font-size:%d%%; padding-left:%dpx; margin:2px;">%s</div>', | ||
fontSize, level * 10, value | |||
)) | )) | ||
end | end | ||
end | end | ||
return | return table.concat(result, "\n") | ||
end | end | ||