Beautified Velocity template

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2005-07-15 01:56:03 +00:00
parent cd2f81534e
commit 28cee4f515
2 changed files with 59 additions and 14 deletions

View File

@ -40,18 +40,45 @@
#end
#macro ( menuItem $item )
#set ( $collapse = "none" )
#set ( $currentItemHref = $PathTool.calculateLink( $item.getAttribute( "href" ), $relativePath ) )
#set ( $currentFileName = $currentFileName.replaceAll( "\\", "/" ) )
#set ( $currentItemHref = $currentItemHref.replaceAll( "\\", "/" ) )
#set ( $currentFileNameLastSlash = $currentFileName.lastIndexOf( "/" ) )
#if ( $currentFileNameLastSlash != -1)
#set ( $currentFileNameTmp = $currentFileName.substring( 0, $currentFileNameLastSlash ) )
#else
#set ( $currentFileNameTmp = $currentFileName.substring( 0, $currentFileName.lengh() ) )
#end
#set ( $currentItemHrefLastSlash = $currentItemHref.lastIndexOf( "/" ) )
#if ( $currentItemHrefLastSlash != -1)
#set ( $currentItemHrefTmp = $currentItemHref.substring( 0, $currentItemHrefLastSlash ) )
#else
#set ( $currentItemHrefTmp = $currentItemHref.substring( 0, $currentItemHref.lengh() ) )
#end
#set ( $tree = $currentFileNameTmp && $currentItemHrefTmp && $currentFileNameTmp.startsWith( $currentItemHrefTmp ) )
#if ( $item.getChildCount() > 0 )
#if ( $item.getAttribute( "collapse" ) == "true" )
#set ( $collapse = "collapsed" )
#if ( ( $item.getAttribute( "collapse" ) ) && ( $item.getAttribute( "collapse" ).equalsIgnoreCase( "false" ) ) )
#set ( $collapse = "expanded" )
#else
## By default collapsed
#set ( $collapse = "collapsed" )
#end
#if ( $currentFileName == $currentItemHref )
#set ( $collapse = "expanded" )
#end
#if ( $tree )
#set ( $collapse = "expanded" )
#end
#else
#set ( $collapse = "none" )
#end
#set ( $currentItemHref = $PathTool.calculateLink( $item.getAttribute( "href" ), $relativePath ) )
<li class="$collapse">
#if ( $currentFileName.replaceAll('\\', '/') == $currentItemHref )
<li class="$collapse" $currentFileName $currentItemHref>
#if ( $currentFileName == $currentItemHref )
<strong><a href="$currentItemHref">$item.getAttribute( "name" )</a></strong>
#else
<a href="$currentItemHref">$item.getAttribute( "name" )</a>
@ -59,12 +86,12 @@
</li>
#if ( $item.getChildren() )
#if ( $item.getChildCount() > 0 )
#if ( $collapse != "collapsed" )
<ul>
#foreach( $subitem in $item.getChildren() )
#menuItem( $subitem )
#end
</ul>
#if ( $collapse == "expanded" || $tree )
<ul>
#foreach( $subitem in $item.getChildren() )
#menuItem( $subitem )
#end
</ul>
#end
#end
#end

View File

@ -37,7 +37,7 @@
<!-- Standalone item -->
<item name="Item" href="/item.html" />
<!-- Uncollapsed Submenu -->
<!-- Collapsed Submenu (default) -->
<item name="Alpha" href="/alpha/index.html">
<item name="Alpha One" href="/alpha/one/index.html"/>
<item name="Alpha Two" href="/alpha/two/index.html"/>
@ -48,6 +48,24 @@
<item name="Beta One" href="/beta/one/index.html" collapse="true"/>
<item name="Beta Two" href="/beta/two/index.html" collapse="true"/>
</item>
<!-- UnCollapsed Submenu -->
<item name="Theta" href="/theta/index.html" collapse="false">
<item name="Theta One" href="/theta/one/index.html"/>
<item name="Theta Two" href="/theta/two/index.html"/>
</item>
<!-- Collapsed/UnCollapsed Submenus -->
<item name="Gamma" href="/gamma/index.html">
<item name="Gamma One" href="/gamma/one/index.html">
<item name="Gamma One-One" href="/gamma/one/one/index.html"/>
<item name="Gamma One-Two" href="/gamma/one/two/index.html"/>
</item>
<item name="Gamma Two" href="/gamma/two/index.html" collapse="false">
<item name="Gamma Two-One" href="/gamma/two/one/index.html"/>
<item name="Gamma Two-Two" href="/gamma/two/two/index.html"/>
</item>
</item>
</menu>
${reports}
</body>