Module:Infobox: Difference between revisions

Inthar (talk | contribs)
No edit summary
Inthar (talk | contribs)
No edit summary
Line 1: Line 1:
local p = {}
local p = {}


local function put_adjacent_x_links(s, prev_x, next_x)
local function put_adjacent_x_links(title, s, prev_x, next_x)
return s .. '<table style="width: 100%; margin: 0"><tr>'
return s .. '<table style="width: 100%; margin: 0"><tr>'
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">'
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">'
Line 32: Line 32:
local has_adjacent = (prev_link and #prev_link > 0) or (next_link and #next_link > 0)
local has_adjacent = (prev_link and #prev_link > 0) or (next_link and #next_link > 0)
if has_adjacent then
if has_adjacent then
s = s .. '<table style="width: 100%; margin: 0"><tr>'
put_adjacent_x_links(title, s, prev_x, next_x)
.. '<td style="width: 15%; text-align: left; white-space: nowrap; font-size: smaller">'
.. (prev_link 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_link or '')
.. '</td>'
.. '</tr></table>'
else
else
s = s .. title
s = s .. title
Line 87: Line 77:
end
end
if has_adjacent_x then
if has_adjacent_x then
put_adjacent_x_links(s, prev_x, next_x)
put_adjacent_x_links(title, s, prev_x, next_x)
else
else
s = s .. title
s = s .. title