maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r732143 - /maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
Date Tue, 06 Jan 2009 22:03:43 GMT
Author: ltheussl
Date: Tue Jan  6 14:03:42 2009
New Revision: 732143

URL: http://svn.apache.org/viewvc?rev=732143&view=rev
Log:
[DOXIA-246] TOC macro: higher entries are ignored

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java?rev=732143&r1=732142&r2=732143&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
Tue Jan  6 14:03:42 2009
@@ -31,6 +31,7 @@
 import org.apache.maven.doxia.parser.ParseException;
 import org.apache.maven.doxia.parser.Parser;
 import org.apache.maven.doxia.sink.Sink;
+
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -119,7 +120,7 @@
 
             if ( index.getChildEntries().size() > 0 )
             {
-                if ( ( fromDepth < section ) || ( section == 0 ) )
+                if ( ( fromDepth <= section ) || ( section == 0 ) )
                 {
                     sink.list();
                 }
@@ -129,11 +130,11 @@
                     IndexEntry sectionIndex = (IndexEntry) it.next();
                     if ( ( i == section ) || ( section == 0 ) )
                     {
-                        writeSubSectionN( sink, sectionIndex, i );
+                        writeSubSectionN( sink, sectionIndex, 1 );
                     }
                     i++;
                 }
-                if ( ( fromDepth < section ) || ( section == 0 ) )
+                if ( ( fromDepth <= section ) || ( section == 0 ) )
                 {
                     sink.list_();
                 }
@@ -152,7 +153,7 @@
      */
     private void writeSubSectionN( Sink sink, IndexEntry sectionIndex, int n )
     {
-        if ( fromDepth < n )
+        if ( fromDepth <= n )
         {
             sink.listItem();
             sink.link( "#" + HtmlTools.encodeId( sectionIndex.getId() ) );
@@ -160,18 +161,18 @@
             sink.link_();
         }
 
-        if ( toDepth >= n )
+        if ( toDepth > n )
         {
             if ( sectionIndex.getChildEntries().size() > 0 )
             {
-                if ( fromDepth < ( n + 1 ) )
+                if ( fromDepth <= n )
                 {
                     sink.list();
                 }
                 for ( Iterator it = sectionIndex.getChildEntries().iterator(); it.hasNext();
)
                 {
                     IndexEntry subsectionIndex = (IndexEntry) it.next();
-                    if ( n == DEFAULT_DEPTH )
+                    if ( n == toDepth - 1 )
                     {
                         sink.listItem();
                         sink.link( "#" + HtmlTools.encodeId( subsectionIndex.getId() ) );
@@ -184,14 +185,14 @@
                         writeSubSectionN( sink, subsectionIndex, n + 1 );
                     }
                 }
-                if ( fromDepth < ( n + 1 ) )
+                if ( fromDepth <= n )
                 {
                     sink.list_();
                 }
             }
         }
 
-        if ( fromDepth < n )
+        if ( fromDepth <= n )
         {
             sink.listItem_();
         }
@@ -215,6 +216,7 @@
         }
 
         int i;
+
         try
         {
             i = Integer.parseInt( value );



Mime
View raw message