Module:SCOTUS-termlist-entry explained

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, then wikitext for non-numbered values, -- and finally, human-friendly text that is output to screen reading software used by blind and low vision users.-- 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".-- Both plurality and plurality1 output the text "delivered the court's opinion" to screen readers. local palette =

function p.main(frame) local pframe = frame:getParent local args = pframe.args if args.case then args.case = "" .. args.case .. "" else args.case = nil end if args["case1"] then args["case1"] = "" .. args["case1"] .. "" else args["case1"] = nil end if args["case-article"] then args["case-article"] = "" .. args["case-display"] .. "" else args["case-article"] = nil end if args.page ~= nil and mw.text.trim(args.page) ~= "" then args.page = args.page else args.page = "___" end local entry = mw.html.create("tr") entry :tag("td") :css :wikitext(args["#"]) :newline :newline :tag("td") :css :tag("small") :wikitext((args.case or "") .. (args["case1"] or "") .. (args["case-article"] or "") .. "," .. (args.note or "") .. '

' .. args.volume .. " U.S. " .. (args.page) .. '') :done :done :tag("td") :css :tag("small") :wikitext(args["argue-date"] or "") :done :done :tag("td") :css :tag("small") :wikitext(args["decision-date"]) local width = local x = 1 while x < 9 or args["justice" .. x .. "-opinion1"] ~= nil do local z = 1 local entrysupp = mw.html.create("td") entrysupp :css :attr("data-sort-value", args["justice" .. x .. "-sortcode"]) local entrysuppend = '' if args["justice" .. x .. "-opinion1"] ~= nil then local subtable = mw.html.create("table") subtable :css :attr("cellspacing", "0") while z < 6 and args["justice" .. x .. "-opinion" .. z] ~= nil and mw.text.trim(args["justice" .. x .. "-opinion" .. z]) ~= "" do z = z + 1 end local i = 1 while i < 6 and args["justice" .. x .. "-opinion" .. i] ~= nil and mw.text.trim(args["justice" .. x .. "-opinion" .. i]) ~= "" do if string.find(mw.text.trim(args["justice" .. x .. "-opinion" .. i]), "%d$") then opiniontext = string.match(args["justice" .. x .. "-opinion" .. i], "%d") .. (palette[string.match(args["justice" .. x .. "-opinion" .. i], "%a+")][2] or "") else opiniontext = (palette[mw.text.trim(args["justice" .. x .. "-opinion" .. i]) or "def"][3] or "") end opinion = mw.text.trim(args["justice" .. x .. "-opinion" .. i], "%d$") arialabel = 'aria-label="justice ' .. x .. ' ' .. palette[opinion][4] .. '" ' secuential = '' .. opiniontext .. '' subtable:node(secuential) i = i + 1 end entrysupp:node(subtable) end entry:node(entrysupp) entry:node(entrysuppend) x = x + 1 end return tostring(entry)end

return p