Module:NavboxGenerator: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m use new format that allows specifying style and other attributes separately
Sur (talk | contribs)
m center titel and display by default
Line 12: Line 12:
             -- Leaf node, render Display content
             -- Leaf node, render Display content
             table.insert(result, string.format(
             table.insert(result, string.format(
                 '<div style="font-size:%d%%; padding-left:%dpx; %s">%s</div>',
                 '<div style="text-align: center; font-size:%d%%; %s">%s</div>',
                 fontSize, level * 10, data.Style or "", value
                 fontSize, data.Style or "", value
             ))
             ))
         elseif type(value) == "table" then
         elseif type(value) == "table" then
             -- Nested node, render title with optional Style and recurse
             -- Nested node, render title with optional Style and recurse
             table.insert(result, string.format(
             table.insert(result, string.format(
                 '<div style="font-size:%d%%; border:1px solid #aaa; padding:5px; margin:2px; %s">%s</div>',
                 '<div style="text-align: center; font-size:%d%%; border:1px solid #aaa; padding:5px; margin:2px; %s">%s</div>',
                 fontSize, value.Style or "", key
                 fontSize, value.Style or "", key
             ))
             ))