Module:Legislationuk-NIParl
Appearance
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 = "<table class=\"wikitable sortable\"style=\"border-style:none none none none\"><tr><th colspan=3>Short title<th style=\"min-width:200px;\">Citation<th class=unsortable>[[Royal assent]]<tr class=expand-child><th colspan=5>Long title<tr class=expand-child><th colspan=5 style=\"background:#fff;border-style:none none none none\"><div style=min-height:0.25em></div>"
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, "{{|" ) and 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 .. "</table>" .. frame:expandTemplate{ title = "notelist" }
return o
end
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 {day = tonumber( mw.ustring.sub( legDate, 1, 2 ) ), month = tonumber( mw.ustring.sub( legDate, 4, 5 ) ), year = tonumber( mw.ustring.sub( legDate, 7 ) ) }
local o = "<tr><td colspan=3 style=background:#"
if repealed == "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 .. "><div style=display:flex;align-items:center;width:42em;max-width:51vw class=box><div style=flex-grow:9>\'\'\'[["
if link ~= "" then o = o .. link .. "|" end
o = o .. legShortTitle .. "]]\'\'\'" .. legNote1
if repealed == "y" then o = o .. " (repealed)" end
o = o .. "</div><div style=float:right;min-width:"
if maintained == "y" and archived ~= "n" then o = o .. "4.5" else o = o .. "2.25" end
o = o .. "em;max-width:"
if maintained == "y" and archived ~= "n" then o = o .. "4.5" else o = o .. "2.25" end
o = o .. "em>"
if maintained == "y" then
local lt = { ["apni"] = "apni" }
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 .. "[[File:Legislation.gov.uk External.svg|29x14px|link=" .. url .. "|Act text]]"
end
end
local s
if maintained == "y" and archived ~= "n" then o = o .. "<wbr>" end
s = " "
if archived ~= "n" then
local lt = { [ "apni" ] = "APNI"}
if legType == "apni" and legDate < os.time {day=1, month=1, year=1943} then
s = ""
end
local lt2 = { [ "apni" ] = legNumber }
url = "https://archives.parliament.uk/collections/getrecord/GB61_HL_PO_" .. lt[ legType ] .. "_1_" .. os.date( "%Y", legDate ) .. "_" .. (s or "") .. "c" .. lt2[ legType ]
o = o .. "[[File:Parliamentary Archives External.svg|27x19px|link=" .. url .. "|Information in the Parliamentary Archives]]"
end
o = o .. "</div></div><td "
if repealed == "y" then o = o .. "style=background:#fff5f5;border-color:#bfa3a3 " end
o = o .. "data-sort-value="
if legType == "apni" and legDate >= os.time{ day = 1, month = 1, year = 1947 } then
o = o .. os.time{ day = 1, month = 1, year = tonumber (os.date( "%Y", legDate ) ) } + legNumber
elseif legDate >= os.time{ day = 1, month = 1, year = 1963 } then
o = o .. os.time{ day = 1, month = 1, year = tonumber (os.date( "%Y", legDate ) ) } + 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 .. "><div style=width:10em;max-width:18vw><span class=nowrap>"
o = o .. legRegnalArabicCitation
local lt = { [ "apni" ] = "".. legNumber .."", }
o = o .. legNote2 .. "</span></div><td"
if repealed == "y" then o = o .. " style=background:#fff5f5;border-color:#bfa3a3" end
o = o .. "><div style=width:9em;max-width:18vw>" .. os.date("*t", legDate).day .. " " .. os.date("%B %Y", legDate ) .. legNote3 .. "</div><tr class=expand-child><td colspan=5"
if repealed == "y" then o = o .. " style=background:#fff5f5;border-color:#bfa3a3" end
o = o .. "><div style=max-width:fit-content"
o = o .. ";max-height:9em;overflow:auto>"
if legLongTitle ~= "" then o = o .. legLongTitle .. legNote4 else o = o .. " " end
o = o .. "</div>"
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{po, poIsShortTitle, poNote1, poLongTitle, poNote2, poYearOffset, legDate }
c = c + 1
po = args[ "po" .. c ]
end
o = o .. "<tr class=expand-child><td colspan=5 style=\"border-style:none none none none;background:#fff\"><div style=min-height:.25em></div>"
return o
end
function p.po( args )
local frame = mw.getCurrentFrame()
local o = "<tr class=expand-child><td style=\"background:#fff;width:1em;border-style:none solid none none\"> <td style=background:#f5fdff;max-width:61em colspan=4><div"
if args[ 2 ] ~= "n" then
o = 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 ] .. ".", { name = mw.hash.hashValue( "crc32b", args[ 1 ] ), group = "lower-alpha" } )
end
if args[ 5 ] and args[ 5 ] ~= "" then
return o .. "<div style=max-height:7em;overflow:auto>" .. 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
end
end
function p.ordinal( args )
local ordinal, digit = {"st", "nd", "rd"}, 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"
end
end
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( "{{DEFAULTSORT:List of acts of the Parliament of Northern Ireland, " .. inputNumber .."}}" )
o = o .. " " .. frame:expandTemplate{ title = "Use British English", args = { date = "July 2021" } } .. " " .. frame:expandTemplate{ title = "Use dmy dates", args = { date = "July 2021" } } .. " " .. frame:expandTemplate{ title = "Short description", args = { "None" } } .. " "
o = o .. frame:expandTemplate{ title = "British legislation lists", args = { "devolved" } }
o = o .. "\n\n" .. "This is a list of [[Act of the Parliament of Northern Ireland|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 [[Devolution in the United Kingdom|devolved]] matters in relation to [[Northern Ireland]] under the authority of the [[Government of Ireland Act 1920]]." .. frame:extensionTag( "ref", "{{citation|title=Government of Ireland Act 1920|page=10 & 11 Geo. 5. c. 67, s. 1 |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/Geo5/10-11/67}}." )
inputNumber = tonumber( inputNumber )
o = o .. "\n__TOC__\n"
if inputNumber >= 1943 then
o = o .. "passed since 1943 are [[Citation of United Kingdom legislation|cited]] by calendar year," .. frame:extensionTag( "ref", "{{citation|title=Interpretation Act (Northern Ireland) 1954 |page=1954 c. 33 (N.I.) |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/Eliz2/10-11/34/section/1}}." )
o = o .. " the [[Regnal years of English monarchs|regnal year(s)]] in which the relevant "
o = o .. "[[Legislative session|parliamentary session]]"
o = o .. " was held." .. frame:extensionTag( "ref", "{{citation|author1=Law Commission|author2=Scottish Law Commission|title=Report on the Interpretation Act 1889 and certain other enactments relating to the construction and operation of Acts of Parliament and other instruments|page=(Cmnd. 7235; Law Com. No. 90; Scot Law Com. No. 53, 1978) para. 7A |no-pp=yes|url=https://www.scotlawcom.gov.uk/files/8512/7989/6586/rep53.pdf}}; cf. {{citation|title=An Act for shortening the Language used in Acts of Parliament|page=13 & 14 Vict. c. 21, s. 3 (now rep.) |no-pp=yes|url=https://archives.parliament.uk/collections/getrecord/GB61_HL_PO_PU_1_1850_13and14V1n40}} and the {{citation|title=Interpretation Act 1889|page=52 & 53 Vict. c. 63, s. 35(1) (now rep.) |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/1889/63/contents}}." )
else
o = o .. "passed before 1943 are [[Citation of United Kingdom legislation|cited]] by the [[Regnal years of English monarchs|regnal year(s)]] in which the relevant "
o = o .. "[[Legislative session|parliamentary session]]"
o = o .. " was held," .. frame:extensionTag( "ref", "{{citation|author1=Law Commission|author2=Scottish Law Commission|title=Report on the Interpretation Act 1954 and certain other enactments relating to the construction and operation of Acts of Parliament and other instruments|page=(Cmnd. 7235; Law Com. No. 90; Scot Law Com. No. 53, 1978) para. 7A |no-pp=yes|url=https://www.scotlawcom.gov.uk/files/8512/7989/6586/rep53.pdf}}; cf. {{citation|title=An Act for shortening the Language used in Acts of Parliament|page=13 & 14 Vict. c. 21, s. 3 (now rep.) |no-pp=yes|url=https://archives.parliament.uk/collections/getrecord/GB61_HL_PO_PU_1_1850_13and14V1n40}} and the {{citation|title=Interpretation Act 1889|page=52 & 53 Vict. c. 63, s. 35(1) (now rep.) |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/1889/63/contents}}." ) .. " as opposed to the convention used for later acts of citing the calendar year." .. frame:extensionTag( "ref", "{{citation|title=Acts of Parliament Numbering and Citation Act 1962|page=10 & 11 Eliz. 2. c. 34, s. 1 |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/Eliz2/10-11/34/section/1}}." )
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", "{{citation|title=Interpretation Act (Northern Ireland) 1954|page=1954 c. 33 (N.I.), ss. 1(a) & 47(1) |no-pp=yes|url=https://www.legislation.gov.uk/apni/1954/33/contents}}; {{citation|title=Interpretation Act 1978|page=1978 c. 30, ss. 19(1) & 24(1) |no-pp=yes|url=https://www.legislation.gov.uk/ukpga/1978/30/contents}}." ) .. " 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 [[Citation of United Kingdom legislation|cited]] by the [[Regnal years of English monarchs|regnal year(s)]] in which the relevant [[Legislative session|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[[File:Cib-gov-uk_(CoreUI_Icons_v1.0.0).svg|18x18px|link=]] indicates that an act"
o = o .." is available to view at [[legislation.gov.uk]], and "
o = o .. "[[File:Crowned_Portcullis.svg|18x18px|link=]]"
o = o .. " indicates the location of the original "
o = o .. "act"
o = o .. " in the "
o = o .. "[[Parliamentary Archives]]."
return o
end
return p