Module:Infobox: Difference between revisions
No edit summary |
No edit summary |
||
| Line 73: | Line 73: | ||
local has_adjacent_y = (prev_y and #prev_y > 0) or (next_y and #next_y > 0) | local has_adjacent_y = (prev_y and #prev_y > 0) or (next_y and #next_y > 0) | ||
if | if prev_y then -- prev y | ||
s = s .. '< | s = s .. '<table style="width: 100%; margin: 0"><tr>' | ||
.. '<td></td><td style="\n' | |||
.. 'width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' | |||
.. prev_y | |||
.. '\n</td><td></td>' | |||
.. '\n<tr>' | |||
elseif has_adjacent_x then -- no prev y, has adjacent x | |||
s = | s = s .. '<table style="width: 100%; margin: 0"><tr>' | ||
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' | |||
.. (prev_x or '') | |||
.. '</td>' | |||
.. '<td style="width: 70%; padding-left: 1em; padding-right: 1em; text-align: center">' | |||
.. title | |||
.. '</td>' | |||
.. '<td style="width: 15%; text-align: right; white-space: nowrap; font-size: smaller">' | |||
.. (next_x or '') | |||
.. '</td>' | |||
.. '</tr>' | |||
elseif next_y then -- no prev y, no adjacent x, so first row should be title in center | |||
s = s .. '<table style="width: 100%; margin: 0"><tr>' | |||
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' | |||
.. '</td>' | |||
.. '<td style="width: 70%; padding-left: 1em; padding-right: 1em; text-align: center">' | |||
.. title | |||
.. '</td>' | |||
.. '<td style="width: 15%; text-align: right; white-space: nowrap; font-size: smaller">' | |||
.. '</td>' | |||
.. '</tr>' | |||
.. '<tr><td></td><td style="\n' | |||
.. 'width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' | |||
.. next_y | |||
.. '\n</td><td></td></tr></table>' | |||
else | else | ||
s = s .. title | s = s .. title | ||
end | end | ||
s = s .. '\n' | s = s .. '\n' | ||