Module:United States legal citation templates

local p = {} --p stands for package

function tableRow(data, paramMax) local templates = {} for k, t in pairs(data.templates) do		table.insert(templates, "") end local templateCell = " " .. table.concat(templates, ", ") .. " "	local parameters = {} for k = 1, #data.parameters, 1 do		if k < #data.parameters then table.insert(parameters, " " .. data.parameters[k] .. " ") else table.insert(parameters, "" .. data.parameters[k] .. " ") end end local description = " " .. data.description .. " "	return " " .. templateCell .. table.concat(parameters) .. description .. " " end

function p.templates_table local rowData = { {templates = {"usc-sd"}, parameters = {'title', '(section)', '(part)', '(chapter)', '(subtitle)', '(subchapter)', '(posttitle)', '(endtext)', '(plainlinks)', '(pipe)'}, description = "United States Code via Cornell University's Legal Information Institute"}, {templates = {"UnitedStatesCode", "USC", "usc"}, parameters = {'title', 'section', '(end of section range)', '(pipe)'}, description = "USC via Cornell"}, {templates = {"UnitedStatesCode2", "USC2", "usc2"}, parameters = {'title', 'section', 'description'}, description = "USC via Cornell: description of the section"}, {templates = {"UnitedStatesCodeSec", "USCSec"}, parameters = {'title', 'section', '(pipe)'}, description = "USC via Cornell: when citing one of a series of USC sections, where it would be redundant to display the full citation for each section, this template can be used to display only the section number."}, {templates = {"UnitedStatesCodeSub", "USCSub"}, parameters = {'title', 'section', '(levels of "sub")'}, description = "Access to subsection/paragraph/subparagraph/clause/... to allow correct hyperlinking to the anchors embedded in the Cornell pages."}, {templates = {"USCSub2", "uscsub2"}, parameters = {'title', 'section', '(levels of "sub")'}, description = "Combines 'USCSec' and 'USCSub', eliminating redundancy when citing subsections / subparagraphs / &c."}, {templates = {"usc-clause"}, parameters = {'title', 'section', 'clause'}, description = "USC via Cornell: allows clauses"}, {templates = {"usc-title-chap", "usctc"}, parameters = {'title', 'chapter', '(subchapter)', '(pipe)'}, description = "USC via Cornell: title/chapter links"}, {templates = {"USStat", "usstat"}, parameters = {'volume', 'page'}, description = "Statutes at Large via the Library of Congress, the Government Printing Office, or Google Books"}, {templates = {"USPL", "uspl"}, parameters = {'congress', 'ordinal law'}, description = "Public Law via GPO Access"}, {templates = {"USStatute"}, parameters = {'congress', 'ordinal law', '(volume)', '(page)'}, description = "Combines USPL and USStat, then add optional Year, Month , Day "}, {templates = {"USBill"}, parameters = {'congress', 'bill type (S, SJ, HR, HJ)', 'bill number (1–?)', '(pipe)'}, description = "Congressional bills via THOMAS"}, {templates = {"USHRollCall", "USHVote"}, parameters = {'year', 'vote'}, description = "House Roll call vote via Clerk.House.gov"}, {templates = {"USSRollCall", "USSVote"}, parameters = {'congress', 'session', 'vote'}, description = "Senate Roll call vote via Senate.gov"}, {templates = {"USCongRec"}, parameters = {'year', 'section', 'page', '(date)'}, description = "Congressional Record via GPO Access"}, {templates = {"Federal Register", "USFR", "USFedReg"}, parameters = {'volume', 'page'}, description = "Federal Register via GPO Access"}, {templates = {"Federal reporter"}, parameters = {'series', 'volume', 'case', '(+ optional parameters)'}, description = "Federal Reporter via Wikisource or OpenJurist"}, {templates = {"CodeFedReg", "USCFR"}, parameters = {'volume', 'part', 'section', '(clause)'}, description = "Code of Federal Regulations via GPO Access"}, {templates = {"ExecutiveOrder"}, parameters = {'number'}, description = "Executive Orders via Wikisource"}, {templates = {"USSG"}, parameters = {'chapter', 'section'}, description = "U.S. Federal Sentencing Guidelines (2009) via the U.S. Sentencing Commission website"}, {templates = {"USSGSub"}, parameters = {'chapter', 'section', '(up to 3 levels of "sub")'}, description = "U.S. Federal Sentencing Guidelines (2009) via the U.S. Sentencing Commission website"}, }	local paramMax = 0 for k, data in pairs(rowData) do		if #data.parameters > paramMax then paramMax = #data.parameters end end local tableRows = {} for k, data in pairs(rowData) do		table.insert(tableRows, tableRow(data, paramMax)) end local tableStart = " " end

return p