| Line 1: |
Line 1: |
| | local p = {} | | local p = {} |
| | | | |
| − | function p.main() | + | function p.main(frame) |
| − | return "InfoboxAlt OK" | + | local args = frame:getParent().args |
| | + | local title = args.title or args.name or "" |
| | + | |
| | + | local rows = {} |
| | + | |
| | + | for k, v in pairs(args) do |
| | + | if k ~= "title" and k ~= "name" and v ~= "" then |
| | + | table.insert(rows, |
| | + | string.format( |
| | + | '<tr><th class="infobox-label">%s</th><td class="infobox-data">%s</td></tr>', |
| | + | k, |
| | + | v |
| | + | ) |
| | + | ) |
| | + | end |
| | + | end |
| | + | |
| | + | table.sort(rows) |
| | + | |
| | + | return string.format([[ |
| | + | <table class="infobox"> |
| | + | <caption class="infobox-title">%s</caption> |
| | + | %s |
| | + | </table> |
| | + | ]], title, table.concat(rows, "\n")) |
| | end | | end |
| | | | |
| | return p | | return p |