Module:PHLawAmend/abbrs

local p = {}

--Abbreviation, the long title (put a space at the end), the category name p.main = { Act = {"Act No. ", "Acts of the Philippines"}, AO = {"Administrative Order No. ", "Administrative Orders of the Philippines by "}, BAA = {"Bangsamoro Autonomy Act No. ", "Bangsamoro Autonomy Acts"}, BP = {"Batas Pambansa Blg. ", "Batas Pambansa"}, CA = {"Commonwealth Act No. ", "Commonwealth Acts of the Philippines"}, EO = {"Executive Order No. ", "Executive Orders of the Philippines by "}, GO = {"General Order No. ", "General Orders of the Philippines by "}, LOI = {"Letter of Instruction No. ", "Letter of Instructions of the Philippines by "}, LOImp = {"Letter of Implementation No. ", "Letter of Implementations of the Philippines"}, MC = {"Memorandum Circular No. ", "Memorandum Circulars of the Philippines by "}, MO = {"Memorandum Order No. ", "Memorandum Orders of the Philippines by "}, PD = {"Presidential Decree No. ", "Presidential Decrees of the Philippines"}, PP = {"Proclamation No. ", "Presidential Proclamations of the Philippines by "}, RA = {"Republic Act No. ", "Republic Acts of the Philippines"}, SO = {"Special Order No. ", "Special Orders of the Philippines by "}, }

-- Abbreviation, the long name, first year, last year p.presidents = { EA = {"Emilio Aguinaldo", 1899, 1901}, MLQ = {"Manuel Luis Quezon", 1935, 1944}, JPL = {"Jose Paciano Laurel", 1943, 1945}, SO = {"Sergio Osmeña", 1944, 1946}, MAR = {"Manuel Roxas", 1946, 1948}, EQ = {"Elpidio Quirino", 1948, 1953}, RM = {"Ramon Magsaysay", 1953, 1957}, CPG = {"Carlos Polestico Garcia", 1957, 1961}, DPM = {"Diosdado Macapagal", 1961, 1965}, FEM = {"Ferdinand Marcos", 1965, 1986}, CCA = {"Corazon Aquino", 1986, 1992}, FVR = {"Fidel Valdez Ramos", 1992, 1998}, JEE = {"Joseph Estrada", 1998, 2001}, GMA = {"Gloria Macapagal-Arroyo", 2001, 2010}, BSA = {"Benigno Aquino III", 2010, 2016}, RRD = {"Rodrigo Duterte", 2016, 2022}, BBM = {"Bongbong Marcos", 2022, os.date("%Y")}, }

p.getAbbr = function (long, includeNumber) -- Removes the law number to get the name if string.find(long, "%d+") then numberPosition = string.find(long, "%d+") name = string.sub(long, 0, numberPosition-1) end for k, v in pairs( p.main ) do   	if (v[1] == name) then return k..(includeNumber and string.sub(long, numberPosition-1, #long) or "") end end end

return p