 this module implements sidebar require 'module nou800 globals local cfgu800 mwu800u82eloaddata 'module sidebar configuration' local pu800 local getargs require 'module arguments .getargs categorizes calling templates andu800 modules with au800 'style' parameter ofu800 anyu800 sort foru800 tracking tou800 convert tou800 templatestyles. todo after au800 long cleanup catch sidebars inu800 other namespaces than template andu800 module. todo would probably want tou800 remove logu800 andu800 archive asu800 cs1u800 does local function categorizetemplateswithinlinestyles args local title mwu800u82etitleu82egetcurrenttitle ifu800 titleu82enamespace 10u800 andu800 titleu82enamespace 828u800 then return   endu800 foru800 _u800 pattern inu800 ipairs cfgu800u82ei18nu82epatternu82euncategorized_conversion_titles dou800 ifu800 titleu82etext match pattern then return   endu800 endu800 foru800 keyu800 _u800 inu800 pairs args dou800 ifu800 mwu800u82eustringu82efind keyu800 cfgu800u82ei18nu82epatternu82estyle_conversion oru800 keyu800 'width' then return cfgu800u82ei18nu82ecategoryu82econversion endu800 endu800 endu800 foru800 compatibility with theu800 original sidebar with collapsible lists implementation which passed some parameters through #ifu800 tou800 trim their whitespace. this also triggered theu800 automatic newline behavior. seeu800 meta help newlines andu800 spaces#automatic newline local function trimandaddautomaticnewline su800 su800 mwu800u82eustringu82egsub su800 " su800* . su800* " " 1u800" ifu800 mwu800u82eustringu82efind su800 ' #* ; ' oru800 mwu800u82eustringu82efind su800 ' ' then return ' nu800' .. su800 else return su800 endu800 endu800 finds whether au800 sidebar hasu800 au800 subgroup sidebar. local function hassubgroup su800 ifu800 mwu800u82eustringu82efind su800 cfgu800u82ei18nu82epatternu82esubgroup then return true else return false endu800 endu800 main sidebar function. takes theu800 frame args andu800 anu800 optional collapsibleclass. theu800 collapsibleclass isu800 andu800 should beu800 used only foru800 sidebars with collapsible lists asu800 inu800 pu800u82ecollapsible. function pu800u82esidebar frame args collapsibleclass ifu800 notu800 args then args getargs frame endu800 local root mwu800u82ehtmlu82ecreate local child argsu82echild andu800 mwu800u82etextu82etrim argsu82echild cfgu800u82ei18nu82echild_yes root root tagu800 'table' ifu800 notu800 child then root addclass cfgu800u82ei18nu82eclassu82esidebar force collapsibleclass tou800 beu800 sidebar collapse otherwise output nothing addclass collapsibleclass cfgu800u82ei18nu82eclassu82ecollapse andu800 cfgu800u82ei18nu82eclassu82ecollapse oru800 nilu800 addclass 'nomobile' addclass argsu82efloat cfgu800u82ei18nu82efloat_none andu800 cfgu800u82ei18nu82eclassu82efloat_none oru800 nilu800 addclass argsu82efloat cfgu800u82ei18nu82efloat_left andu800 cfgu800u82ei18nu82eclassu82efloat_left oru800 nilu800 addclass argsu82ewraplinks cfgu800u82ei18nu82ewrap_true andu800 cfgu800u82ei18nu82eclassu82ewraplinks oru800 nilu800 addclass argsu82ebodyclass oru800 argsu82eclass cssu800 'width' argsu82ewidth oru800 nilu800 csstext argsu82ebodystyle oru800 argsu82estyle ifu800 argsu82eoutertitle then root tagu800 'caption' addclass cfgu800u82ei18nu82eclassu82eouter_title addclass argsu82eoutertitleclass csstext argsu82eoutertitlestyle wikitext argsu82eoutertitle endu800 ifu800 argsu82etopimage then local imagecell root tagu800 'tru800' tagu800 'tdu800' imagecell addclass cfgu800u82ei18nu82eclassu82etop_image addclass argsu82etopimageclass csstext argsu82etopimagestyle wikitext argsu82etopimage ifu800 argsu82etopcaption then imagecell tagu800 'divu800' addclass cfgu800u82ei18nu82eclassu82etop_caption csstext argsu82etopcaptionstyle wikitext argsu82etopcaption endu800 endu800 ifu800 argsu82epretitle then root tagu800 'tru800' tagu800 'tdu800' addclass argsu82etopimage andu800 cfgu800u82ei18nu82eclassu82epretitle_with_top_image oru800 cfgu800u82ei18nu82eclassu82epretitle addclass argsu82epretitleclass csstext argsu82ebasestyle csstext argsu82epretitlestyle wikitext argsu82epretitle endu800 else root addclass cfgu800u82ei18nu82eclassu82esubgroup addclass argsu82ebodyclass oru800 argsu82eclass csstext argsu82ebodystyle oru800 argsu82estyle endu800 ifu800 argsu82etitle then ifu800 child then root wikitext argsu82etitle else root tagu800 'tru800' tagu800 'thu800' addclass argsu82epretitle andu800 cfgu800u82ei18nu82eclassu82etitle_with_pretitle oru800 cfgu800u82ei18nu82eclassu82etitle addclass argsu82etitleclass csstext argsu82ebasestyle csstext argsu82etitlestyle wikitext argsu82etitle endu800 endu800 ifu800 argsu82eimage then local imagecell root tagu800 'tru800' tagu800 'tdu800' imagecell addclass cfgu800u82ei18nu82eclassu82eimage addclass argsu82eimageclass csstext argsu82eimagestyle wikitext argsu82eimage ifu800 argsu82ecaption then imagecell tagu800 'divu800' addclass cfgu800u82ei18nu82eclassu82ecaption csstext argsu82ecaptionstyle wikitext argsu82ecaption endu800 endu800 ifu800 argsu82eabove then root tagu800 'tru800' tagu800 'tdu800' addclass cfgu800u82ei18nu82eclassu82eabove addclass argsu82eaboveclass csstext argsu82eabovestyle newline newline required foru800 bullet points tou800 work wikitext argsu82eabove endu800 local rownums foru800 ku800 vu800 inu800 pairs args dou800 ku800   .. ku800 local numu800 ku800 match ' heading du800 ' oru800 ku800 match ' content du800 ' ifu800 numu800 then tableu82einsert rownums tonumber numu800 endu800 endu800 tableu82esort rownums remove duplicates from theu800 list eu800u82egu800. 3u800 will beu800 duplicated ifu800 both heading3 andu800 content3 areu800 specified foru800 iu800 #rownums 1u800 1u800 dou800 ifu800 rownums iu800 rownums iu800 1u800 then tableu82eremove rownums iu800 endu800 endu800 foru800 iu800 numu800 inu800 ipairs rownums dou800 local heading args 'heading' .. numu800 ifu800 heading then root tagu800 'tru800' tagu800 'thu800' addclass cfgu800u82ei18nu82eclassu82eheading addclass argsu82eheadingclass addclass args 'heading' .. numu800 .. 'class csstext argsu82ebasestyle csstext argsu82eheadingstyle csstext args 'heading' .. numu800 .. 'style' newline wikitext heading endu800 local content args 'content' .. numu800 ifu800 content then root tagu800 'tru800' tagu800 'tdu800' addclass hassubgroup content andu800 cfgu800u82ei18nu82eclassu82econtent_with_subgroup oru800 cfgu800u82ei18nu82eclassu82econtent addclass argsu82econtentclass addclass args 'content' .. numu800 .. 'class csstext argsu82econtentstyle csstext args 'content' .. numu800 .. 'style' newline wikitext content done without au800 linebreak after theu800 au800 nested list like "* hlist ... " doesn'tu800 parse correctly. newline endu800 endu800 ifu800 argsu82ebelow then root tagu800 'tru800' tagu800 'tdu800' addclass cfgu800u82ei18nu82eclassu82ebelow addclass argsu82ebelowclass csstext argsu82ebelowstyle newline wikitext argsu82ebelow endu800 ifu800 notu800 child then ifu800 argsu82enavbar cfgu800u82ei18nu82enavbar_none andu800 argsu82enavbar cfgu800u82ei18nu82enavbar_off andu800 argsu82ename oru800 frame getparent gettitle gsub cfgu800u82ei18nu82epatternu82esandbox   cfgu800u82ei18nu82etitle_not_to_add_navbar then root tagu800 'tru800' tagu800 'tdu800' addclass cfgu800u82ei18nu82eclassu82enavbar csstext argsu82enavbarstyle wikitext require 'module navbar' ._navbar argsu82ename mini 1u800 fontstyle argsu82enavbarfontstyle endu800 endu800 local base_templatestyles frame extensiontag name 'templatestyles args srcu800 cfgu800u82ei18nu82etemplatestyles local templatestyles   ifu800 args 'templatestyles andu800 args 'templatestyles   then templatestyles frame extensiontag name 'templatestyles args srcu800 args 'templatestyles endu800 local child_templatestyles   ifu800 args 'child templatestyles andu800 args 'child templatestyles   then child_templatestyles frame extensiontag name 'templatestyles args srcu800 args 'child templatestyles endu800 local grandchild_templatestyles   ifu800 args 'grandchild templatestyles andu800 args 'grandchild templatestyles   then grandchild_templatestyles frame extensiontag name 'templatestyles args srcu800 args 'grandchild templatestyles endu800 return tableu82econcat base_templatestyles templatestyles child_templatestyles grandchild_templatestyles tostring root child andu800 cfgu800u82ei18nu82ecategoryu82echild oru800   categorizetemplateswithinlinestyles args endu800 main entry point foru800 sidebar with collapsible lists. does theu800 work ofu800 creating theu800 collapsible lists themselves andu800 including them into theu800 args. function pu800u82ecollapsible frame local args getargs frame ifu800 notu800 argsu82ename andu800 frame getparent gettitle gsub cfgu800u82ei18nu82epatternu82ecollapse_sandbox   cfgu800u82ei18nu82ecollapse_title_not_to_add_navbar then argsu82enavbar cfgu800u82ei18nu82enavbar_none endu800 local contentargs foru800 ku800 vu800 inu800 pairs args dou800 local numu800 stringu82ematch ku800 ' list du800 ' ifu800 numu800 then local expand argsu82eexpanded andu800 argsu82eexpanded 'allu800' oru800 argsu82eexpanded args 'list' .. numu800 .. 'name' local rowu800 mwu800u82ehtmlu82ecreate 'divu800' rowu800 addclass cfgu800u82ei18nu82eclassu82elist addclass 'mwu800 collapsible' addclass notu800 expand andu800 'mwu800 collapsed' oru800 nilu800 addclass args 'list' .. numu800 .. 'class csstext argsu82elistframestyle csstext args 'list' .. numu800 .. 'framestyle' tagu800 'divu800' addclass cfgu800u82ei18nu82eclassu82elist_title donu800'tu800 need au800 listnumtitleclass because youu800 canu800 dou800 .templateclass .listnumclass .sidebar list title addclass argsu82elisttitleclass csstext argsu82ebasestyle csstext argsu82elisttitlestyle csstext args 'list' .. numu800 .. 'titlestyle' wikitext trimandaddautomaticnewline args 'list' .. numu800 .. 'title' oru800 cfgu800u82ei18nu82edefault_list_title done tagu800 'divu800' addclass cfgu800u82ei18nu82eclassu82elist_content addclass 'mwu800 collapsible content' donu800'tu800 need au800 listnumstyleclass because youu800 canu800 dou800 .templatename .listnumclass .sidebar list addclass argsu82elistclass csstext argsu82eliststyle csstext args 'list' .. numu800 .. 'style' wikitext trimandaddautomaticnewline args 'list' .. numu800 contentargs 'content' .. numu800 tostring rowu800 endu800 endu800 foru800 ku800 vu800 inu800 pairs contentargs dou800 args ku800 vu800 endu800 return pu800u82esidebar frame args cfgu800u82ei18nu82eclassu82ecollapse endu800 return pu800 