NestedMenuParser
A fragment of the Garden of Remembering
div container div portal h3 header div body ul li li li div portal h3 header div body ul li li li ... div container (not part) ul menu li menuitem span header ul submenu li ... li menuitem span link li menuitem span link ... * SEARCH * Navigation ** mainpage|mainpage-description ** special:allpages|Page index ** recentchanges-url|recentchanges ** randompage-url|randompage ** special:version|Version information * Other wikis ** compendium-link|Compendium ** test-link|Test wiki ** Numbered versions *** link|1.19 *** link|1.21 *** link|1.22 * TOOLBOX * LANGUAGES /* parse and print navigation elements as a series of nested lists */ function renderNavigation ( $navigationData, $nestDepth = 2, $doToolbox = false, $doLanguages = false, $doSearch = false ) { parse data add toolbox, languages, search if needed print data to appropriate nesting level } create new block $prevline = 0 #indentation level foreach line if indent > $prevline && <= maxdepth new block $lineisstart = true $prevline++ if indent < $prevline $prevline-- close last block do line close block