Module:Infobox: Difference between revisions
ArrowHead294 (talk | contribs) No edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 2: | Line 2: | ||
function p.build(title, entries, prev_link, next_link) | function p.build(title, entries, prev_link, next_link) | ||
local s = | local s = "<div style=\"" | ||
.. "border: 1px solid #999; " | .. "border: 1px solid #999; " | ||
.. "margin: 0; " | .. "margin: 0; " | ||
| Line 13: | Line 13: | ||
.. "max-width: 100%; " | .. "max-width: 100%; " | ||
.. "overflow: auto; " | .. "overflow: auto; " | ||
.. | .. "\">\n" | ||
.. | .. "{| width=\"100%\" style=\"border-collapse: collapse;\"\n" | ||
.. | .. "|+ style=\"font-size: 105%; font-weight: bold; text-align: center;\" | " | ||
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 | s = s | ||
.. | .. "<table style=\"width: 100%; margin: 0;\"><tr>" | ||
.. | .. "<td style=\"width: 15%; text-align: left; white-space: nowrap; font-size: smaller;\">" | ||
.. (prev_link or "") | .. (prev_link or "") | ||
.. "</td>" | .. "</td>" | ||
.. | .. "<td style=\"width: 70%; padding-left: 1em; padding-right: 1em; text-align: center;\">" | ||
.. title | .. title | ||
.. "</td>" | .. "</td>" | ||
.. | .. "<td style=\"width: 15%; text-align: right; white-space: nowrap; font-size: smaller;\">" | ||
.. (next_link or "") | .. (next_link or "") | ||
.. "</td>" | .. "</td>" | ||
| Line 40: | Line 40: | ||
s = s | s = s | ||
.. "|-\n" | .. "|-\n" | ||
.. | .. "| style=\"text-align: right; padding-right: 0.25em;\" | " | ||
.. caption | .. caption | ||
.. "\n" | .. "\n" | ||
.. | .. "| style=\"background-color: white; padding-left: 0.25em; font-weight: bold;\" | " | ||
.. text | .. text | ||
.. "\n" | .. "\n" | ||
elseif #entry == 1 then | elseif #entry == 1 then | ||
local text = entry[1] | local text = entry[1] | ||
s = s .. "|-\n" .. | s = s .. "|-\n" .. "| colspan=\"2\" style=\"text-align: center;\" | ".. text .. "\n" | ||
end | end | ||
end | end | ||
| Line 62: | Line 62: | ||
function p.build_multilink(title, entries, adjacent_links) | function p.build_multilink(title, entries, adjacent_links) | ||
-- Boilerplate stuff | -- Boilerplate stuff | ||
local s = | local s = "<div style=\"" | ||
.. "border: 1px solid #999; " | .. "border: 1px solid #999; " | ||
.. "margin: 0; " | .. "margin: 0; " | ||
| Line 72: | Line 72: | ||
.. "float: right; " | .. "float: right; " | ||
.. "max-width: 100%; " | .. "max-width: 100%; " | ||
.. "overflow: auto; " | .. "overflow: auto;" | ||
.. | .. "\">\n" | ||
.. | .. "{| width=\"100%\" style=\"border-collapse: collapse;\"\n" | ||
.. | .. "|+ style=\"font-size: 105%; font-weight: bold; text-align: center;\" | " | ||
-- Adjacent links | -- Adjacent links | ||
| Line 100: | Line 100: | ||
if adjacent_links == nil then | if adjacent_links == nil then | ||
s = s .. title | s = s .. title | ||
s = s .. | s = s .. "\n" | ||
elseif #adjacent_links == 2 then | elseif #adjacent_links == 2 then | ||
local prev_link = adjacent_links[1] | local prev_link = adjacent_links[1] | ||
local next_link = adjacent_links[2] | local next_link = adjacent_links[2] | ||
s = s | s = s | ||
.. | .. "<table style=\"width: 100%; margin: 0;\"><tr>" | ||
.. | .. "<td style=\"width: 15%; text-align: left; white-space: nowrap; font-size: smaller;\">" | ||
.. (prev_link or "") | .. (prev_link or "") | ||
.. "</td>" | .. "</td>" | ||
.. | .. "<td style=\"width: 70%; padding-left: 1em; padding-right: 1em; text-align: center;\">" | ||
.. title | .. title | ||
.. "</td>" | .. "</td>" | ||
.. | .. "<td style=\"width: 15%; text-align: right; white-space: nowrap; font-size: smaller;\">" | ||
.. (next_link or "") | .. (next_link or "") | ||
.. "</td>" | .. "</td>" | ||
.. "</tr></table>" | .. "</tr></table>" | ||
s = s .. | s = s .. "\n" | ||
elseif #adjacent_links == 8 then | elseif #adjacent_links == 8 then | ||
-- First row | -- First row | ||
s = s .. | s = s .. "<table style=\"width: 100%; margin: 0;\"><tr>" | ||
.. | .. "<td style=\"width: 15%; text-align: left; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[1] or "") | .. (adjacent_links[1] or "") | ||
.. | .. "</td>" | ||
.. | .. "<td style=\"width: 75%; padding-left: 1em; padding-right: 1em; text-align: center; font-size: smaller;\">" | ||
.. (adjacent_links[2] or "") | .. (adjacent_links[2] or "") | ||
.. | .. "\n</td><td style=\"width: 15%; text-align: right; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[3] or "") | .. (adjacent_links[3] or "") | ||
.. | .. "</td>" | ||
-- Second row | -- Second row | ||
.. | .. "\n<tr>" | ||
.. | .. "<td style=\"width: 15%; text-align: left; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[4] or "") | .. (adjacent_links[4] or "") | ||
.. | .. "</td>" | ||
.. | .. "<td style=\"width: 75%; padding-left: 1em; padding-right: 1em; text-align: center;\">" | ||
.. title | .. title | ||
.. | .. "</td>" | ||
.. | .. "<td style=\"width: 15%; text-align: right; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[5] or "") | .. (adjacent_links[5] or "") | ||
.. | .. "</td>" | ||
.. | .. "</tr>" | ||
.. | .. "<tr>" | ||
-- Third row | -- Third row | ||
.. | .. "<td style=\"width: 15%; text-align: left; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[6] or "") | .. (adjacent_links[6] or "") | ||
.. | .. "</td><td style=\"width: 75%; padding-left: 1em; padding-right: 1em; text-align: center; font-size: smaller;\">" | ||
.. (adjacent_links[7] or "") | .. (adjacent_links[7] or "") | ||
.. | .. "\n</td>" | ||
.. | .. "<td style=\"width: 15%; text-align: right; white-space: nowrap; font-size: smaller;\">" | ||
.. (adjacent_links[8] or "") | .. (adjacent_links[8] or "") | ||
.. | .. "</td>" | ||
.. | .. "</tr>" | ||
.. | .. "</table>" | ||
s = s .. | s = s .. "\n" | ||
else | else | ||
s = s .. title | s = s .. title | ||
s = s .. | s = s .. "\n" | ||
end | end | ||
| Line 174: | Line 172: | ||
s = s | s = s | ||
.. "|-\n" | .. "|-\n" | ||
.. | .. "| style=\"text-align: right; padding-right: 0.25em;\" | " | ||
.. caption | .. caption | ||
.. "\n" | .. "\n" | ||
.. | .. "| style=\"background-color: white; padding-left: 0.25em; font-weight: bold;\" | " | ||
.. text | .. text | ||
.. "\n" | .. "\n" | ||
elseif #entry == 1 then | elseif #entry == 1 then | ||
local text = entry[1] | local text = entry[1] | ||
s = s .. "|-\n" .. | s = s .. "|-\n" .. "| colspan=\"2\" style=\"text-align: center;\" | " .. text .. "\n" | ||
end | end | ||
end | end | ||