#end
#set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
- #if ($currentItemHref)
- #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) )
+ #set ( $seen = false )
+ #foreach ( $entry in $stack )
+ #if ( $entry.uri == $currentItemHref )
+ #set ( $seen = true )
+ #end
#end
- #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
- #set ( $sinkhole = $page.put("name", $menu.name) )
- #set ( $sinkhole = $page.put("uri", $currentItemHref) )
- #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) )
- #set ( $sinkhole = $stack.push( $page ) )
+ #if ( !$seen )
+ #if ($currentItemHref)
+ #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) )
+ #end
- #if ($menu.title)
- #set( $sinkhole = $page.put("title", $menu.title) )
- #end
- #if ($menu.alt)
- #set( $sinkhole = $page.put("alt", $menu.alt) )
- #end
- #if ($menu.img)
- #set( $sinkhole = $page.put("img", $menu.img) )
- #end
+ #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
+ #set ( $sinkhole = $page.put("name", $menu.name) )
+ #set ( $sinkhole = $page.put("uri", $currentItemHref) )
+ #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) )
+ #set ( $sinkhole = $stack.push( $page ) )
- #foreach ( $item in $menu.items )
- #buildPages ( $item )
- #end
+ #if ($menu.title)
+ #set( $sinkhole = $page.put("title", $menu.title) )
+ #end
+ #if ($menu.alt)
+ #set( $sinkhole = $page.put("alt", $menu.alt) )
+ #end
+ #if ($menu.img)
+ #set( $sinkhole = $page.put("img", $menu.img) )
+ #end
- #set ( $page = $stack.pop() )
- #if ( $page.uri != "" )
-
- #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
- #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
- #set ( $sinkhole = $crumb.put("uri", $page.uri) )
- #set ( $sinkhole = $crumb.put("name", $page.name) )
- #set ( $sinkhole = $crumbs.push($crumb) )
- #foreach ( $entry in $stack )
- #if ( $entry.uri != "" )
- #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
- #set ( $sinkhole = $crumb.put("uri", $entry.uri) )
- #set ( $sinkhole = $crumb.put("name", $entry.name) )
- #set ( $sinkhole = $crumbs.push($crumb) )
- #end
+ #foreach ( $item in $menu.items )
+ #buildPages ( $item )
#end
- #set ( $sinkhole = $page.put("crumbs", $crumbs) )
- #if ( $pages.containsKey($page.uri) )
- #set ( $childs = $pages.get($page.uri).childs )
- #set ( $sinkhole = $page.put("childs", $childs) )
+ #set ( $page = $stack.pop() )
+ #if ( $page.uri != "" )
+
+ #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
+ #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
+ #set ( $sinkhole = $crumb.put("uri", $page.uri) )
+ #set ( $sinkhole = $crumb.put("name", $page.name) )
+ #set ( $sinkhole = $crumbs.push($crumb) )
+ #foreach ( $entry in $stack )
+ #if ( $entry.uri != "" )
+ #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
+ #set ( $sinkhole = $crumb.put("uri", $entry.uri) )
+ #set ( $sinkhole = $crumb.put("name", $entry.name) )
+ #set ( $sinkhole = $crumbs.push($crumb) )
+ #end
+ #end
+ #set ( $sinkhole = $page.put("crumbs", $crumbs) )
- <!-- OVERWRITING PAGE - uri: $page.uri -->
- #else
+ #if ( $pages.containsKey($page.uri) )
+ #set ( $childs = $pages.get($page.uri).childs )
+ #set ( $sinkhole = $page.put("childs", $childs) )
- <!-- NEW PAGE - - - - - uri: $page.uri -->
- #end
+ <!-- OVERWRITING PAGE - uri: $page.uri / name: $page.name -->
+ #else
- #set ( $sinkhole = $pages.put($page.uri, $page) )
+ <!-- NEW PAGE - - - - - uri: $page.uri / name: $page.name -->
+ #end
- #else
+ #set ( $sinkhole = $pages.put($page.uri, $page) )
- <!-- DONE WITH MENUE - - #if($page.name)$page.name-->#else(no name)-->
- #set( $siteTitle = $menu.title )
- #set( $siteAlt = $menu.alt )
- #set( $siteImg = $menu.img )
- #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) )
- #end
+ #else
+
+ <!-- DONE WITH MENUE - - #if($page.name)$page.name-->#else(no name)-->
+ #set( $siteTitle = $menu.title )
+ #set( $siteAlt = $menu.alt )
+ #set( $siteImg = $menu.img )
+ #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) )
+ #end
+ #end
+ #else
+ <!-- Skipping already seen entry: uri=$currentItemHref, name=$menu.name -->
#end
#end