Module:Infobox: Difference between revisions

Inthar (talk | contribs)
No edit summary
Inthar (talk | contribs)
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 has_adjacent_y and prev_y then
if prev_y then -- prev y
s = s .. '<div style="\n' ..
s = s .. '<table style="width: 100%; margin: 0"><tr>'
'width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' ..
.. '<td></td><td style="\n'  
prev_y ..  
.. 'width: 15%; text-align: left; white-space: nowrap; font-size: smaller">'
'\n</div>' ..
.. prev_y
'\n'
.. '\n</td><td></td>'  
end
.. '\n<tr>'
if has_adjacent_x then
elseif has_adjacent_x then -- no prev y, has adjacent x
s = put_adjacent_x_links(title, s, prev_x, next_x)
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
if has_adjacent_y and next_y then
s = s .. '<div style="\n' ..
'width: 15%; text-align: left; white-space: nowrap; font-size: smaller">' ..
next_y ..
'\n</div>' ..
'\n'
end
end
s = s .. '\n'
s = s .. '\n'