Module:Legislationuk-NIParl explained

local p =

function p.main(frame) local args if frame:getParent.args[1 ] then args = frame:getParent.args else args = frame.args end local input = "" local divider = "|" local o = "

Short titleCitationRoyal assent
Long title

" local h = for i = 1, 2 do h[i ] = mw.ustring.char(i + 57343) end for i, _ in pairs(args) do input = args[i ] if mw.ustring.find(input, "") then input = mw.ustring.gsub(input, "%[%[(.*)|(.*)%]%]", "%[%[%1" .. h[ 1 ] .. "%2%]%]") input = mw.ustring.gsub(input, "style=", h[2 ]) local leg = local s = "" local c = 1 local par input = mw.ustring.sub(input, mw.ustring.find(input, "|") + 1) while input ~= "" do if mw.ustring.find(input, "|") then divider = "|" else divider = "}" end s = mw.ustring.sub(input, 1, mw.ustring.find(input, divider) - 1) if mw.ustring.find(s, "=") then par = mw.ustring.sub(s, 1, mw.ustring.find(s, "=") - 1) leg[par ] = mw.ustring.sub(s, mw.ustring.find(s, "=") + 1) else par = c leg[c ] = mw.ustring.sub(input, 1, mw.ustring.find(input, divider) - 1) c = c + 1 end leg[par ] = mw.ustring.gsub(leg[par ], "%[%[(.*)" .. h[ 1 ] .. "(.*)%]%]", "%[%[%1|%2%]%]") leg[par ] = mw.ustring.gsub(leg[par ], h[2 ], "style=") if divider

"|" then input = mw.ustring.sub(input, mw.ustring.find(input, "|") + 1) else input = "" end end o = o .. p.act(leg) end end o = o .. "

" .. frame:expandTemplate return oend

function p.act(args) local data = mw.loadData("Module:Legislationuk/data") local legShortTitle = args[1 ] or "" local link = args["link" ] or "" local legNote1 = args["note1" ] or "" local legType = args[2 ] or "" local legNumber = args[3 ] or "" local legRegnalArabicCitation = args[4 ] or "" local legNote2 = args["note2" ] or "" local legDate = args[5 ] or "" local legNote3 = args["note3" ] or "" local maintained = args["maintained" ] or "" local archived = args["archived" ] or "" local repealed = args["repealed" ] or "" local legLongTitle = args[6 ] or "" local legNote4 = args["note4" ] or "" local url = args["url" ] or "" legDate = os.time local o = "

"y" then o = o .. "f2cece;border-color:#bfa3a3" else o = o .. "ececec" end o = o .. " data-sort-value=\"" if mw.ustring.find(legShortTitle, "%(No%..*%d+%)") then o = o .. mw.ustring.gsub(legShortTitle, "(.*)%(No%..*(%d+)%) (.*)", "%1%3% %2") else o = o .. legShortTitle .. " 1\"" end o = o .. ">

\'\'\'" end o = o .. legShortTitle .. "\'\'\'" .. legNote1 if repealed

"y" then o = o .. " (repealed)" end o = o .. "

" if maintained

"y" then local lt = if lt[legType ] and legDate and legNumber then local url = "https://www.legislation.gov.uk/" .. lt[legType ] .. "/" .. os.date("%Y", legDate) .. "/" .. legNumber .. "/contents" o = o .. "" end end local s if maintained

"y" and archived ~= "n" then o = o .. "" end s = " " if archived ~= "n" then local lt = if legType

"apni" and legDate < os.time then s = "" end local lt2 = url = "https://archives.parliament.uk/collections/getrecord/GB61_HL_PO_" .. lt[legType ] .. "_1_" .. os.date("%Y", legDate) .. "_" .. (s or "") .. "c" .. lt2[legType ] o = o .. "" end o = o .. "

"y" then o = o .. "style=background:#fff5f5;border-color:#bfa3a3 " end o = o .. "data-sort-value=" if legType

"apni" and legDate >= os.time then o = o .. os.time + legNumber elseif legDate >= os.time then o = o .. os.time + legNumber else for _, t in ipairs(data) do if tonumber(legDate) >= tonumber(t.sDate.date) and tonumber(legDate) <= tonumber(t.eDate.date) then o = o .. tonumber(t.sDate.date) + legNumber end end end o = o .. ">

" o = o .. legRegnalArabicCitation local lt = o = o .. legNote2 .. "

"y" then o = o .. " style=background:#fff5f5;border-color:#bfa3a3" end o = o .. ">

" .. os.date("*t", legDate).day .. " " .. os.date("%B %Y", legDate) .. legNote3 .. "

"y" then o = o .. " style=background:#fff5f5;border-color:#bfa3a3" end o = o .. ">

" if legLongTitle ~= "" then o = o .. legLongTitle .. legNote4 else o = o .. " " end o = o .. "

" local c = 1 local n = 0 local po = args["po1" ] while po do local poIsShortTitle = args["po" .. c .. "short" ] local poNote1 = args["po" .. c .. "note1" ] or "" local poYearOffset = args["po" .. c .. "year" ] or "" local poIsLongTitle = args["po" .. c .. "long" ] local poLongTitle if poIsLongTitle

"n" then poLongTitle = "" n = n + 1 else poLongTitle = args[c + 5 - n ] end local poNote2 = args["po" .. c .. "note2" ] or "" o = o .. p.po c = c + 1 po = args["po" .. c ] end o = o .. "

" return oend

function p.po(args) local frame = mw.getCurrentFrame local o = " 

\'\'\'" .. args[1 ] .. "\'\'\'" .. (args[3 ] or ) if args[7 ]

"y" then o = o .. frame:extensionTag("ref", "Although passed in " .. os.date("%Y", args[7 ]) .. ", the short title is specified as the " .. args[1 ] .. ".",) end if args[5 ] and args[5 ] ~= "" then return o .. "

" .. args[5 ] .. (args[6 ] or ) else return o end else o = o .. " style=max-height:8.25em;overflow:auto>" .. (args[1 ] or ) .. (args[3 ] or ) return o endend

function p.ordinal(args) local ordinal, digit =, mw.ustring.sub(args, -1) if tonumber(digit) > 0 and tonumber(digit) <= 3 and mw.ustring.sub(args, -2) ~= 11 and mw.ustring.sub(args, -2) ~= 12 and mw.ustring.sub(args, -2) ~= 13 then return args .. ordinal[tonumber(digit) ] else return args .. "th" endend

function p.header(frame) local pargs = frame:getParent.args local args = frame.args local inputType = pargs[1 ] or args[1 ] or "" local inputState = pargs["state" ] or args["state" ] or "" local inputNumber = tonumber(pargs[2 ]) or tonumber(args[2 ]) or "" local inputSession = pargs["session" ] or args["session" ] or "" local actsPublic = tonumber(pargs[3 ]) or tonumber(args[3 ]) or 0 local actsLocal = tonumber(pargs[4 ]) or tonumber(args[4 ]) or 0 local actsPrivate = tonumber(pargs[5 ]) or tonumber(args[5 ]) or 0 local currentSession = "" local o = "" if inputState

"scotland" or inputState

"wales" or inputState

"northern ireland" then inputType = "year" inputNumber = tonumber(pargs[1 ]) or tonumber(args[1 ]) or 0 actsPublic = tonumber(pargs[2 ]) or tonumber(args[2 ]) or 0 actsLocal = tonumber(pargs[3 ]) or tonumber(args[3 ]) or 0 end local acts = actsPublic + actsLocal + actsPrivate o = o .. frame:preprocess("") o = o .. " " .. frame:expandTemplate .. " " .. frame:expandTemplate .. " " .. frame:expandTemplate .. " " o = o .. frame:expandTemplate o = o .. "\n\n" .. "This is a list of acts of the Parliament of Northern Ireland " o = o .. " passed in " .. inputNumber .. "." o = o .. " Acts of the Parliament of Northern Ireland are enacted by the Parliament of Northern Ireland, which has legislative authority over devolved matters in relation to Northern Ireland under the authority of the Government of Ireland Act 1920." .. frame:extensionTag("ref", ".") inputNumber = tonumber(inputNumber) o = o .. "\n__TOC__\n" if inputNumber >= 1943 then o = o .. "passed since 1943 are cited by calendar year," .. frame:extensionTag("ref", ".") o = o .. " the regnal year(s) in which the relevant " o = o .. "parliamentary session" o = o .. " was held." .. frame:extensionTag("ref", "; cf. and the .") else o = o .. "passed before 1943 are cited by the regnal year(s) in which the relevant " o = o .. "parliamentary session" o = o .. " was held," .. frame:extensionTag("ref", "; cf. and the .") .. " as opposed to the convention used for later acts of citing the calendar year." .. frame:extensionTag("ref", ".") end o = o .. " Each " o = o .. " passed in a respective " if inputNumber >= 1943 then o = o .. "year" else o = o .. "session" end o = o .. " is " if inputNumber >= 1943 then o = o .. "given a chapter number (abbreviated \"c.\") denoted by Arabic numerals," .. frame:extensionTag("ref", "; .") .. " and citations are usually followed by the suffix \"(N.I.)\" so as to prevent confusion with acts of Parliament of the United Kingdom." else o = o .. "passed before 1943 are cited by the regnal year(s) in which the relevant parliamentary session" end o = o .. "\n\n" o = o .. " of the Parliament of Northern Ireland " if acts

1 then o = o .. "was" else o = o .. "were" end o = o .. " passed " o = o .. "in " .. inputNumber local actsPublicString = "" local actsLocalString = "" local actsPrivateString = "" o = o .. "." o = o .. "\n\n indicates that an act" o = o .." is available to view at legislation.gov.uk, and " o = o .. "" o = o .. " indicates the location of the original " o = o .. "act" o = o .. " in the " o = o .. "Parliamentary Archives." return oend

return p