Module:Infobox ET: Difference between revisions

Plumtree (talk | contribs)
m Bugfix
Plumtree (talk | contribs)
Using Module:Infobox to build the infobox
Line 5: Line 5:
local l = require('Module:Limits')
local l = require('Module:Limits')
local ET = require('Module:ET')
local ET = require('Module:ET')
local infobox = require('Module:Infobox')


-- towards is one of: -1 (floor), 0 (nearest), 1 (ceil)
-- towards is one of: -1 (floor), 0 (nearest), 1 (ceil)
Line 155: Line 156:
end
end


local header = '<table style="width: 100%; margin: 0"><tr>'
return infobox.build(
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">'
'[[' .. et.suffix .. '|' .. tuning .. ']]',
.. prev_one
infobox_data,
.. '</td>'
prev_one,
.. '<td style="width: 70%; padding-left: 1em; padding-right: 1em; text-align: center">'
next_one
.. '[[' .. et.suffix .. '|' .. tuning .. ']]'
)
.. '</td>'
.. '<td style="width: 15%; text-align: right; white-space: nowrap; font-size: smaller">'
.. next_one
.. '</td>'
.. '</tr></table>'
local s = '<div style="\n' ..
'border: 1px solid #999;\n' ..
'margin: 0;\n' ..
'margin-left: 1em;\n' ..
'margin-bottom: 0.5em;\n' ..
'padding: 0.5em;\n' ..
'background-color: #f0f0f0;\n' ..
'min-width: 15em;\n' ..
'float: right;\n' ..
'">\n' ..
'{| width="100%" style="border-collapse: collapse;"\n' ..
'|+ style="font-weight: bold" | ' .. header .. '\n'
for i, entry in ipairs(infobox_data) do
local caption = entry[1]
local text = entry[2]
s = s .. '|-\n' ..
'| style="text-align:right; padding-right: 0.25em" | ' .. caption .. '\n' ..
'| style="background-color: white; padding-left: 0.25em; font-weight: bold" | ' .. text .. '\n'
end
s = s .. '|}</div>'
return s
end
end


return p
return p