Module:SCOTUS-termlist-entry
Appearance
Implements {{SCOTUS-termlist-entry}}
local p = {}
-- Color palette and wikitext for the opinion arguments. Each group is only mentioned once, e.g. majority stands for majority,
-- majority1, majority2, majority3, majority4 and majority5
-- The color comes first in the table, then wikitext for numbered values and finally wikitext for non-numbered values
-- Numbers in the wikitext are taken from the values themselves (e.g. majority1 has the wikitext "1" plus whatever wikitext that is
-- mentioned here.
-- Examples: plurality has the wikitext of "*" and the color "#00CD00"
-- plurality1 has the wikitext of "1*" - "1" is taken from the value itself and "*" comes from this table. It has
-- the color "#00CD00"
local palette = {
majority = {"#00CD00", "", "*"},
plurality = {"#00CD00", "*", "*"},
concurrence = {"#00B2EE", "", "*"},
concurrencewithoutopinion = {"#00B2EE", "", "-"},
concurrencedissent = {"#B23AEE", "", "*"},
dissent = {"red", "", "*"},
dissentwithoutopinion = {"red", "", "-"},
joinmajority = {"#93DB70", "", "*"},
partjoinmajority = {"#93DB70", "*", "*"},
joinplurality = {"#93DB70", "", "*"},
partjoinplurality = {"#93DB70", "*", "*"},
joinconcurrence = {"#79CDCD", "", "*"},
partjoinconcurrence = {"#79CDCD", "*", "*"},
joinconcurrencedissent = {"#CC99CC", "", "*"},
partjoinconcurrencedissent = {"#CC99CC", "*", "*"},
joindissent = {"#EE9572", "", "*"},
partjoindissent = {"#EE9572", "*", "*"},
didnotparticipate = {"white", "", "*"},
}
function p.main()
local subtable = mw.html.create("table")
subtable
:css({
width = "100%",
height = "3.7em",
margin = "0px",
cellspacing = "0",
})
:tag("tr")
local secuential = mw.html.create("td")
secuential
:css({
["min-width"] = minwidth,
["text-align"] = "center",
["boarder-right"] = "1px solid lightgray",
bgcolor = backgroundcolor
})
:wikitext(opiniontext)
:done()
local width = {
[1] = "24px",
[2] = "16px",
[3] = "12px",
[4] = "9px",
}
local z = 1
while i < 6 and args["option" .. i] ~= nil do
z = z + 1
end
local i = 1
while i < 6 and args["option" .. i] ~= nil do
if string.find(args["option" .. i], "%d$") then
opiniontext = string.match(args["option" .. i], "%d$") .. (palette["option" .. i][2] or "")
else
opiniontext = (palette["option" .. i][3] or "")
end
minwidth = width[z]
backgroundcolor = palette[string.match(args["option" .. i], "^%a+")]
subtable:node(secuential)
i = i + 1
end
-- :node(spankey)
local spankey = mw.html.create("span")
spankey
:addClass("sortkey")
:attr("display", "none")
:wikitext(args.sortcode or "")
:done()
end
return p