 this module implements shortcut . setu800 constants local config_module 'module shortcut config' load required modules local checktype require 'libraryutil' .checktype local yesno require 'module yesno' local pu800 local function message msgu800 ... return mwu800u82emessageu82enewrawmessage msgu800 ... plain endu800 local function makecategorylink catu800 return mwu800u82eustringu82eformat ' su800 su800 ' mwu800u82esiteu82enamespaces 14u800 .name catu800 endu800 function pu800u82e_main shortcuts options frame cfgu800 checktype '_main' 1u800 shortcuts 'table' checktype '_main' 2u800 options 'table' true options options oru800 frame frame oru800 mwu800u82egetcurrentframe cfgu800 cfgu800 oru800 mwu800u82eloaddata config_module local templatemode optionsu82etemplate oru800 options 'u8d8a7u8d984u8daafu8d988' andu800 yesno optionsu82etemplate oru800 yesno options 'u8d8a7u8d984u8daafu8d988' local redirectmode optionsu82eredirect oru800 options 'u8d8aau8d8bau8db8cu8db8cu8d8b1u8d985u8d8b3u8db8cu8d8b1' andu800 yesno optionsu82eredirect oru800 yesno options 'u8d8aau8d8bau8db8cu8db8cu8d8b1u8d985u8d8b3u8db8cu8d8b1' local iscategorized notu800 optionsu82ecategory oru800 notu800 options 'u8d8b1u8d8afu8d987' oru800 yesno optionsu82ecategory false oru800 yesno options 'u8d8b1u8d8afu8d987' false validate shortcuts foru800 iu800 shortcut inu800 ipairs shortcuts dou800 ifu800 type shortcut 'string' oru800 #shortcut 1u800 then error message cfgu800 'invalid shortcut error' iu800 2u800 endu800 endu800 make theu800 list items. these areu800 theu800 shortcuts plus anyu800 extra lines such asu800 optionsu82emsgu800. local listitems foru800 iu800 shortcut inu800 ipairs shortcuts dou800 local templatepath prefix ifu800 templatemode then namespace detection local titleobj mwu800u82etitleu82enewu800 shortcut 10u800 ifu800 titleobju82enamespace 10u800 then templatepath titleobju82efulltext else templatepath shortcut endu800 prefix options 'preu800' .. iu800 oru800 optionsu82epreu800 oru800 options 'u8d9beu8db8cu8d8b4u8d988u8d986u8d8af' oru800   endu800 ifu800 optionsu82etarget oru800 options 'u8d985u8d982u8d8b5u8d8af' andu800 yesno optionsu82etarget oru800 yesno options 'u8d985u8d982u8d8b5u8d8af' then listitems iu800 templatemode andu800 mwu800u82eustringu82eformat "&#123u800;&#123u800; su800 su800 su800 &#125u800;&#125u800;" prefix templatepath shortcut oru800 mwu800u82eustringu82eformat " su800 " shortcut else listitems iu800 frame expandtemplate title 'u8d8aau8d8bau8db8cu8db8cu8d8b1u8d985u8d8b3u8db8cu8d8b1 u8d985u8d985u8d986u8d988u8d8b9' args templatemode andu800 templatepath shortcut oru800 shortcut shortcut ifu800 templatemode then listitems iu800 mwu800u82eustringu82eformat "&#123u800;&#123u800; su800 su800&#125u800;&#125u800;" prefix listitems iu800 endu800 endu800 endu800 tableu82einsert listitems optionsu82emsgu800 oru800 options 'u8d9beu8db8cu8d8a7u8d985' return anu800 error ifu800 weu800 have nothing tou800 display ifu800 #listitems 1u800 then local msgu800 cfgu800 'nou800 content error' msgu800 mwu800u82eustringu82eformat ' su800 ' msgu800 ifu800 iscategorized andu800 cfgu800 'nou800 content error category' then msgu800 msgu800 .. makecategorylink cfgu800 'nou800 content error category' endu800 return msgu800 endu800 local root mwu800u82ehtmlu82ecreate root wikitext frame extensiontag name 'templatestyles args srcu800 'u8d985u8db8cu8d8a7u8d986u8d8a8u8d8b1 stylesu82ecssu800 anchors local anchordiv root tagu800 'divu800' addclass 'module shortcutanchordiv' foru800 iu800 shortcut inu800 ipairs shortcuts dou800 local anchor mwu800u82euriu800u82eanchorencode shortcut anchordiv tagu800 'span' attr 'idu800' anchor endu800 shortcut heading local shortcutheading dou800 local nshortcuts #shortcuts ifu800 nshortcuts 0u800 then local headingmsg options 'shortcut heading' oru800 redirectmode andu800 cfgu800 'redirect heading' oru800 cfgu800 'shortcut heading' shortcutheading message headingmsg nshortcuts shortcutheading frame preprocess shortcutheading endu800 endu800 shortcut boxu800 local shortcutlist root tagu800 'divu800' addclass 'module shortcutboxplain plainlist noprint' attr 'role' 'note' ifu800 optionsu82efloat andu800 optionsu82efloat lower 'right' oru800 optionsu82efloat 'u8d8b1u8d8a7u8d8b3u8d8aa' oru800 options 'u8d8b4u8d986u8d8a7u8d988u8d8b1' andu800 options 'u8d8b4u8d986u8d8a7u8d988u8d8b1' lower 'right' oru800 options 'u8d8b4u8d986u8d8a7u8d988u8d8b1' 'u8d8b1u8d8a7u8d8b3u8d8aa' then shortcutlist addclass 'module shortcutboxright' endu800 ifu800 optionsu82eclear andu800 optionsu82eclear   oru800 options 'u8d9beu8d8a7u8daa9u8e2808cu8daa9u8d986' andu800 options 'u8d9beu8d8a7u8daa9u8e2808cu8daa9u8d986'   then shortcutlist cssu800 'clear' optionsu82eclear oru800 options 'u8d9beu8d8a7u8daa9u8e2808cu8daa9u8d986' endu800 ifu800 shortcutheading then shortcutlist tagu800 'divu800' addclass 'module shortcutlist' wikitext shortcutheading endu800 local ublu800 require 'module list' .unbulleted listitems shortcutlist wikitext ublu800 return tostring root endu800 function pu800u82emain frame local args require 'module arguments .getargs frame separate shortcuts from options local shortcuts options foru800 ku800 vu800 inu800 pairs args dou800 ifu800 type ku800 'number' then shortcuts ku800 vu800 else options ku800 vu800 endu800 endu800 compress theu800 shortcut array which mayu800 contain nils. local function compressarray tu800 local nums retu800 foru800 ku800 inu800 pairs tu800 dou800 nums #nums 1u800 ku800 endu800 tableu82esort nums foru800 iu800 numu800 inu800 ipairs nums dou800 retu800 iu800 tu800 numu800 endu800 return retu800 endu800 shortcuts compressarray shortcuts return pu800u82e_main shortcuts options frame endu800 return pu800 