 this module isu800 au800 luau800 implementation ofu800 theu800 oldu800 portal template. asu800 ofu800 august 2013 itu800 isu800 used onu800 nearly 5u800 000u800 000u800 articles. please take care when updating itu800 itu800 outputs twou800 functions pu800u82eportal which generates au800 table ofu800 portals andu800 pu800u82eimage which produces theu800 image name foru800 anu800 individual portal. theu800 portal image data isu800 kept inu800 submodules ofu800 module portal images listed below module portal images u8d8a2 foru800 portal names beginning with "u8d8a2". module portal images u8d8a7 foru800 portal names beginning with "u8d8a7". module portal images u8d8a8 foru800 portal names beginning with "u8d8a8". module portal images u8d9be foru800 portal names beginning with "u8d9be". module portal images u8d8aa foru800 portal names beginning with "u8d8aa". module portal images u8d8ab foru800 portal names beginning with "u8d8ab". module portal images u8d8ac foru800 portal names beginning with "u8d8ac". module portal images u8da86 foru800 portal names beginning with "u8da86". module portal images u8d8ad foru800 portal names beginning with "u8d8ad". module portal images u8d8ae foru800 portal names beginning with "u8d8ae". module portal images u8d8af foru800 portal names beginning with "u8d8af". module portal images u8d8b0 foru800 portal names beginning with "u8d8b0". module portal images u8d8b1 foru800 portal names beginning with "u8d8b1". module portal images u8d8b2 foru800 portal names beginning with "u8d8b2". module portal images u8da98 foru800 portal names beginning with "u8da98". module portal images u8d8b3 foru800 portal names beginning with "u8d8b3". module portal images u8d8b4 foru800 portal names beginning with "u8d8b4". module portal images u8d8b5 foru800 portal names beginning with "u8d8b5". module portal images u8d8b6 foru800 portal names beginning with "u8d8b6". module portal images u8d8b7 foru800 portal names beginning with "u8d8b7". module portal images u8d8b8 foru800 portal names beginning with "u8d8b8". module portal images u8d8b9 foru800 portal names beginning with "u8d8b9". module portal images u8d8ba foru800 portal names beginning with "u8d8ba". module portal images u8d981 foru800 portal names beginning with "u8d981". module portal images u8d982 foru800 portal names beginning with "u8d982". module portal images u8daa9 foru800 portal names beginning with "u8daa9". module portal images u8daaf foru800 portal names beginning with "u8daaf". module portal images u8d984 foru800 portal names beginning with "u8d984". module portal images u8d985 foru800 portal names beginning with "u8d985". module portal images u8d986 foru800 portal names beginning with "u8d986". module portal images u8d988 foru800 portal names beginning with "u8d988". module portal images u8d987 foru800 portal names beginning with "u8d987". module portal images u8db8c foru800 portal names beginning with "u8db8c". module portal images u8d8afu8db8cu8daafu8d8b1 foru800 portal names beginning with anyu800 other letters. this includes numbers letters with diacritics andu800 letters inu800 nonu800 latin alphabets. module portal images u8d985u8d8b3u8d8aau8d8b9u8d8a7u8d8b1u8d987u8d8a7 foru800 adding aliases foru800 existing portal names. useu800 this page foru800 variations inu800 spelling andu800 diacritics etcu800. nou800 matter what letter theu800 portal begins with. theu800 images data pages areu800 separated byu800 theu800 first letter tou800 reduce server load when images areu800 added changed oru800 removed. previously allu800 theu800 images were onu800 oneu800 data page atu800 module portal images butu800 this hadu800 theu800 disadvantage that allu800 5u800 000u800 000u800 pages using this module needed tou800 beu800 refreshed every time anu800 image wasu800 added oru800 removed. local pu800 local function matchimagepage su800 finds theu800 appropriate image subpage given au800 lower case portal name plus theu800 first letter ofu800 that portal name. ifu800 type su800 'string' oru800 #su800 1u800 then return endu800 local firstletter mwu800u82eustringu82esubu800 su800 1u800 1u800 local imagepage u8d8a8u8d8b1u8d8a7u8db8c u8d8b4u8d986u8d8a7u8d8b3u8d8a7u8db8cu8db8c u8d8b5u8d981u8d8adu8d8a7u8d8aa u8d981u8d8a7u8d8b1u8d8b3u8db8c u8d8b1u8d8acu8daa9u8d8b3 u8d8aeu8d8b7 u8d8b2u8db8cu8d8b1 u8d8aau8d8bau8db8cu8db8cu8d8b1 u8daa9u8d8b1u8d8afu8d987u8e2808cu8d8a7u8d8b3u8d8aa. ifu800 mwu800u82eustringu82efind firstletter ' u8d8a7u8d8a2u8d8a8u8d9beu8d8aau8d8abu8d8acu8da86u8d8adu8d8aeu8d8afu8d8b0u8d8b1u8d8b2u8da98u8d8b3u8d8b4u8d8b5u8d8b6u8d8b7u8d8b8u8d8b9u8d8bau8d981u8d982u8daa9u8daafu8d984u8d985u8d986u8d988u8d987u8db8c ' andu800 mwu800u82etitleu82emaketitle 828u800 'portal images ' .. firstletter .exists then imagepage 'module portal images ' .. firstletter else imagepage 'module portal images u8d8afu8db8cu8daafu8d8b1' endu800 return mwu800u82eloaddata imagepage su800 endu800 local function getalias su800 gets anu800 alias from theu800 image alias data page. local aliasdata mwu800u82eloaddata 'module portal images u8d985u8d8b3u8d8aau8d8b9u8d8a7u8d8b1u8d987u8d8a7' foru800 portal aliases inu800 pairs aliasdata dou800 foru800 _u800 alias inu800 ipairs aliases dou800 ifu800 alias su800 then return portal endu800 endu800 endu800 endu800 local function getimagename su800 gets theu800 image name foru800 au800 given string. ifu800 type su800 'string' oru800 #su800 1u800 then return 'portal puzzleu82esvgu800' endu800 su800 mwu800u82eustringu82elower su800 return matchimagepage su800 oru800 matchimagepage getalias su800 oru800 'portal puzzleu82esvgu800' endu800 function pu800u82e_portal portals args this function builds theu800 portal boxu800 used byu800 theu800 portal template. local root mwu800u82ehtmlu82ecreate 'divu800' addclass 'noprint portal' addclass argsu82eright andu800 'tright' oru800 'tleft' cssu800 'border' 'solid #a2a9b1 1pxu800' cssu800 'margin' argsu82emargin oru800 argsu82eright 'yesu800 andu800 '0u800u82e5emu800 0u800 0u800u82e5emu800 1enu800' oru800 '0u800u82e5emu800 1emu800 0u800u82e5emu800 0u800' newline start theu800 table. this corresponds tou800 theu800 start ofu800 theu800 wikitext table inu800 theu800 oldu800 template portal . local tableroot root tagu800 'table' cssu800 'background' '#f8f9fa' cssu800 'font size' '85u800 ' cssu800 'line height' '110u800 ' cssu800 'maxu800 width' '175px' cssu800 'width' type argsu82eboxsize 'string' andu800 argsu82eboxsize .. 'pxu800' oru800 nilu800 ifu800 nou800 portals have been specified display anu800 error andu800 addu800 theu800 page tou800 au800 tracking category. ifu800 notu800 portals 1u800 then tableroot wikitext ' u8d987u8db8cu8da86 u8d8afu8d8b1u8daafu8d8a7u8d987u8db8c u8d8aau8d8b9u8db8cu8db8cu8d986 u8d986u8d8b4u8d8afu8d987u8e2808cu8d8a7u8d8b3u8d8aa u8d984u8d8b7u8d981u8d8a7u8d98b u8d8afu8d8b3u8d8aa u8daa9u8d985 u8db8cu8daa9 u8d8afu8d8b1u8daafu8d8a7u8d987 u8d8aau8d8b9u8db8cu8db8cu8d986 u8daa9u8d986u8db8cu8d8af u8d8b1u8d8afu8d987 u8d8a7u8d984u8daafu8d988 u8d8afu8d8b1u8daafu8d8a7u8d987 u8d8a8u8d8afu8d988u8d986 u8d9beu8d8a7u8d8b1u8d8a7u8d985u8d8aau8d8b1 ' endu800 display theu800 portals specified inu800 theu800 positional arguments. foru800 _u800 portal inu800 ipairs portals dou800 local image getimagename portal generate theu800 html foru800 theu800 image andu800 theu800 portal name. tableroot newline tagu800 'tru800' cssu800 'vertical align' 'middle' tagu800 'tdu800' cssu800 'text align' 'center' wikitext stringu82eformat ' file su800 32x28px altu800 u8d986u8d8b4u8d8a7u8d986 u8d8afu8d8b1u8daafu8d8a7u8d987 class noviewer ' image done tagu800 'tdu800' cssu800 'padding' '0u800 0u800u82e2emu800' cssu800 'vertical align' 'middle' cssu800 'font style' 'italic' cssu800 'font weight' 'bold' wikitext stringu82eformat ' u8d8afu8d8b1u8daafu8d8a7u8d987 su800 u8d8afu8d8b1u8daafu8d8a7u8d987 su800 su800 ' portal portal args 'break' andu800 ' ' oru800 ' ' endu800 return tostring root endu800 function pu800u82e_image portals wrapper function tou800 allow getimagename tou800 beu800 accessed through #invoke. return getimagename portals 1u800 endu800 local function getallimagetables returns anu800 array containing allu800 image subpages minus aliases asu800 loaded byu800 mwu800u82eloaddata. local images foru800 iu800 subpage inu800 ipairs 'au800' 'bu800' 'cu800' 'du800' 'eu800' 'fu800' 'gu800' 'hu800' 'iu800' 'ju800' 'ku800' 'lu800' 'mu800' 'nu800' 'ou800' 'pu800' 'qu800' 'ru800' 'su800 'tu800' 'uu800' 'vu800' 'wu800' 'xu800' 'yu800' 'zu800' 'other' dou800 images iu800 mwu800u82eloaddata 'module portal images ' .. subpage endu800 return images endu800 function pu800u82e_displayall portals args this function displays allu800 portals that have portal images. this function isu800 foru800 maintenance purposes andu800 should notu800 beu800 used inu800 articles foru800 twou800 reasons 1u800 there areu800 over 1500 portals with portal images andu800 2u800 theu800 module doesn'tu800 record howu800 theu800 portal names areu800 capitalized sou800 theu800 portal links mayu800 beu800 broken. local lang mwu800u82elanguageu82egetcontentlanguage local count 1u800 foru800 _u800 imagetable inu800 ipairs getallimagetables dou800 foru800 portal inu800 pairs imagetable dou800 portals count lang ucfirst portal count count 1u800 endu800 endu800 return pu800u82e_portal portals args endu800 function pu800u82e_imagedupes this function searches theu800 image subpages tou800 find duplicate images. ifu800 duplicate images exist itu800 isu800 notu800 necessarily au800 badu800 thing asu800 different portals might just happen tou800 choose theu800 same image. however this function isu800 helpful inu800 identifying images that should beu800 moved tou800 au800 portal alias foru800 ease ofu800 maintenance. local exists dupes foru800 _u800 imagetable inu800 ipairs getallimagetables dou800 foru800 portal image inu800 pairs imagetable dou800 ifu800 notu800 exists image then exists image portal else tableu82einsert dupes stringu82eformat 'u8d8aau8d8b5u8d988u8db8cu8d8b1 u8c2ab file su800 su800 u8c2bb u8d8a8u8d8b1u8d8a7u8db8c u8d8afu8d988 u8d8afu8d8b1u8daafu8d8a7u8d987 u8c2ab su8c2bb u8d988 u8c2ab su8c2bb u8d8a7u8d8b3u8d8aau8d981u8d8a7u8d8afu8d987 u8d8b4u8d8afu8d987 u8d8a7u8d8b3u8d8aa.' image image exists image portal endu800 endu800 endu800 ifu800 #dupes 1u800 then return 'u8d8aau8d8b5u8d8a7u8d988u8db8cu8d8b1 u8db8cu8daa9u8d8b3u8d8a7u8d986 u8db8cu8d8a7u8d981u8d8aa u8d986u8d8b4u8d8af.' else return 'u8d8aau8d8b5u8d8a7u8d988u8db8cu8d8b1 u8db8cu8daa9u8d8b3u8d8a7u8d986 u8d8b1u8d988u8d8a8u8d8b1u8d988 u8db8cu8d8a7u8d981u8d8aa u8d8b4u8d8af nu800* ' .. tableu82econcat dupes ' nu800* ' endu800 endu800 local function processportalargs args this function processes au800 table ofu800 arguments andu800 returns twou800 tables anu800 array ofu800 portal names foru800 processing byu800 ipairs andu800 au800 table ofu800 theu800 named arguments that specify style options etcu800. weu800 need tou800 useu800 ipairs because weu800 want tou800 list allu800 theu800 portals inu800 theu800 order they were passed tou800 theu800 template butu800 weu800 also want tou800 beu800 able tou800 deal with positional arguments passed explicitly foru800 example portal 2u800 politics . theu800 behaviour ofu800 ipairs isu800 undefined ifu800 nilu800 values areu800 present sou800 weu800 need tou800 make sure they areu800 allu800 removed. args type args 'table' andu800 args oru800 local portals local namedargs foru800 ku800 vu800 inu800 pairs args dou800 ifu800 type ku800 'number' andu800 type vu800 'string' then make sure weu800 have nou800 nonu800 string portal names. tableu82einsert portals ku800 elseif type ku800 'number' then namedargs ku800 vu800 endu800 endu800 tableu82esort portals foru800 iu800 vu800 inu800 ipairs portals dou800 portals iu800 args vu800 endu800 return portals namedargs endu800 local function makewrapper funcname processes external arguments andu800 sends them tou800 theu800 other functions. return function frame ifu800 called viau800 #invoke useu800 theu800 args passed into theu800 invoking template oru800 theu800 args passed tou800 #invoke ifu800 anyu800 exist. otherwise assume args areu800 being passed directly inu800 from theu800 debug console oru800 from another luau800 module. local origargs ifu800 type frameu82egetparent 'function' then origargs frame getparent .args foru800 ku800 vu800 inu800 pairs frameu82eargs dou800 origargs frameu82eargs break endu800 else origargs frame endu800 trim whitespace andu800 remove blank arguments. local args foru800 ku800 vu800 inu800 pairs origargs dou800 ifu800 type vu800 'string' then vu800 mwu800u82etextu82etrim vu800 endu800 ifu800 vu800   then args ku800 vu800 endu800 endu800 return pu800 funcname processportalargs args passes twou800 tables tou800 func anu800 array ofu800 portal names andu800 au800 table ofu800 named arguments. endu800 endu800 foru800 _u800 funcname inu800 ipairs 'portal' 'image' 'imagedupes 'displayall' dou800 pu800 funcname makewrapper '_u800' .. funcname endu800 return pu800 