diff --git a/maven-plugins/maven-site-plugin/pom.xml b/maven-plugins/maven-site-plugin/pom.xml
index 43ab2a4b6f..cd3c623a25 100644
--- a/maven-plugins/maven-site-plugin/pom.xml
+++ b/maven-plugins/maven-site-plugin/pom.xml
@@ -48,7 +48,7 @@
plexus
plexus-site-renderer
- 1.0-alpha-1
+ 1.0-alpha-2-20050715.080727-2
org.apache.maven.wagon
diff --git a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
index 221a387f42..a407dde7af 100644
--- a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
+++ b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
@@ -548,6 +548,11 @@ public class DoxiaMojo
}
});
+ if ( ( directories == null ) || ( directories.length == 0 ) )
+ {
+ return false;
+ }
+
List indexFound = new ArrayList();
for ( int i = 0; i < directories.length; i++ )
{
diff --git a/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm b/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm
index 26d0dfd4b5..ece47f98f3 100644
--- a/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm
+++ b/maven-plugins/maven-site-plugin/src/main/resources/org/apache/maven/doxia/maven-site.vm
@@ -39,27 +39,26 @@
#end
#end
+#macro ( displayTree $display $item)
+ #if ( $item.getChildren() && $item.getChildCount() > 0 )
+ #foreach( $subitem in $item.getChildren() )
+ #set ( $subitemHref = $PathTool.calculateLink( $subitem.getAttribute( "href" ), $relativePath ) )
+ #set ( $subitemHref = $$subitemHref.replaceAll( "\\", "/" ) )
+
+ #if ( $currentFileName == $subitemHref )
+ #set ( $display = true )
+ #end
+
+ #displayTree($display $subitem)
+ #end
+ #end
+#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" ) ) && ( $item.getAttribute( "collapse" ).equalsIgnoreCase( "false" ) ) )
@@ -68,31 +67,29 @@
## By default collapsed
#set ( $collapse = "collapsed" )
#end
-
- #if ( $currentFileName == $currentItemHref )
- #set ( $collapse = "expanded" )
- #end
- #if ( $tree )
+ #if ( $currentFileName == $currentItemHref )
#set ( $collapse = "expanded" )
#end
#end
-
+
#if ( $currentFileName == $currentItemHref )
$item.getAttribute( "name" )
#else
$item.getAttribute( "name" )
#end
- #if ( $item.getChildren() )
- #if ( $item.getChildCount() > 0 )
- #if ( $collapse == "expanded" || $tree )
-
- #foreach( $subitem in $item.getChildren() )
- #menuItem( $subitem )
- #end
-
- #end
+ #if ( $item.getChildren() && $item.getChildCount() > 0 )
+ #set ( $display = false )
+ #set ( $itemTmp = $item )
+ #displayTree($display $itemTmp)
+
+ #if ( $collapse == "expanded" || $display )
+
+ #foreach( $subitem in $item.getChildren() )
+ #menuItem( $subitem )
+ #end
+
#end
#end
#end
diff --git a/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/index.apt b/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/index.apt
index bcd7ed3f96..2cb261a626 100644
--- a/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/index.apt
+++ b/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/index.apt
@@ -9,4 +9,4 @@
Site Plugin Index
- From /theta/index.apt
+ From /gamma/index.apt
diff --git a/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/two/index.apt b/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/two/index.apt
index c00dba1f3a..a7217b3268 100644
--- a/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/two/index.apt
+++ b/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test6/src/site/apt/gamma/two/index.apt
@@ -9,4 +9,4 @@
Site Plugin Index
- From /theta/two/index.apt
+ From /gamma/two/index.apt