You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vs...@apache.org on 2005/07/15 03:56:05 UTC

svn commit: r219151 - in /maven/components/trunk/maven-plugins/maven-site-plugin/src: main/resources/org/apache/maven/doxia/maven-site.vm test/projects/site-plugin-test6/src/site/site.xml

Author: vsiveton
Date: Thu Jul 14 18:56:03 2005
New Revision: 219151

URL: http://svn.apache.org/viewcvs?rev=219151&view=rev
Log:
Beautified Velocity template

Modified:
    maven/components/trunk/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm
    maven/components/trunk/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/site.xml

Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm?rev=219151&r1=219150&r2=219151&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm (original)
+++ maven/components/trunk/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm Thu Jul 14 18:56:03 2005
@@ -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

Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/site.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/site.xml?rev=219151&r1=219150&r2=219151&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/site.xml (original)
+++ maven/components/trunk/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/site.xml Thu Jul 14 18:56:03 2005
@@ -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>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org