Module:Infobox interval region: Difference between revisions
No edit summary |
m Cleanup and style |
||
(3 intermediate revisions by one other user not shown) | |||
Line 21: | Line 21: | ||
local centsupperStrict = frame.args["centsUpper"] | local centsupperStrict = frame.args["centsUpper"] | ||
local subregions = frame.args["subregions"] | local subregions = frame.args["subregions"] | ||
local superregions = frame.args["superregions"] | |||
local prevRegion = frame.args["prevRegion"] | local prevRegion = frame.args["prevRegion"] | ||
local nextRegion = frame.args["nextRegion"] | local nextRegion = frame.args["nextRegion"] | ||
Line 40: | Line 41: | ||
local data = {} | local data = {} | ||
table.insert(data, { | |||
"Name", | |||
name | |||
}) | |||
if centslower == nil or centslower == "" then | if centslower == nil or centslower == "" then | ||
Line 56: | Line 54: | ||
table.insert(data, { | table.insert(data, { | ||
"Lower bound", | "Lower bound", | ||
centslower .. "¢ | centslower .. "¢ – " .. centslowerStrict .. "¢" | ||
}) | }) | ||
end | end | ||
Line 68: | Line 66: | ||
table.insert(data, { | table.insert(data, { | ||
"Upper bound", | "Upper bound", | ||
centsupperStrict .. "¢ | centsupperStrict .. "¢ – " .. centsupper .. "¢" | ||
}) | }) | ||
end | end | ||
if moses ~= nil and moses ~= "" then | |||
table.insert(data, { | table.insert(data, { | ||
"Generated [[MOS]]es", | "Generated [[MOS]]es", | ||
Line 96: | Line 75: | ||
}) | }) | ||
end | end | ||
table.insert(data, { | |||
string.format("<div style=\"margin-top: 0.6em;\"><b>%s</b></div>", " | string.format("<div style=\"margin-top: 0.6em;\"><b>%s</b></div>", "Example [[JI]] intervals") | ||
}) | }) | ||
if complement ~= nil and complement ~= "" then | local jidata = "" | ||
local q = 0 | |||
for k, v in pairs(ji) do | |||
if q == 1 then | |||
jidata = jidata .. "<br>" | |||
end | |||
jidata = jidata .. "[[" .. rat.as_ratio(v) .. "]] (" .. math.floor(rat.cents(v)*10 + 0.5)/10 .. "¢)" | |||
q = 1 | |||
end | |||
table.insert(data, { | |||
"Intervals", | |||
jidata | |||
}) | |||
table.insert(data, { | |||
string.format("<div style=\"margin-top: 0.6em;\"><b>%s</b></div>", "Related regions") | |||
}) | |||
if complement ~= nil and complement ~= "" then | |||
table.insert(data, { | table.insert(data, { | ||
"[[Complement]]", | "[[Complement]]", | ||
complement | complement | ||
}) | }) | ||
end | |||
if subregions ~= nil and subregions ~= "" then | |||
table.insert(data, { | table.insert(data, { | ||
"Subregions", | "Subregions", | ||
subregions | subregions | ||
}) | }) | ||
end | end | ||
if superregions ~= nil and superregions ~= "" then | |||
table.insert(data, { | |||
"Superregion(s)", | |||
superregions | |||
}) | |||
end | |||
local args = { | local args = { | ||
["Adjacent Links"] = { " | ["Adjacent Links"] = { "← "..(prevRegion or ""), (nextRegion or "").." →" }, | ||
["Title"] = "Interval region", | ["Title"] = "Interval region", | ||
["Rows"] = data, | ["Rows"] = data, | ||
Line 118: | Line 119: | ||
local result = infobox._infobox(args) | local result = infobox._infobox(args) | ||
return frame:preprocess(debugg == true and "<pre>" .. result .. "</pre>" or result) | return frame:preprocess(debugg == true and "<pre>" .. result .. "</pre>" or result) |