Author: ltheussl Date: Tue May 12 18:36:51 2009 New Revision: 774013 URL: http://svn.apache.org/viewvc?rev=774013&view=rev Log: [DOXIA-272] allow to specify from/toDepth for *all* sections
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java maven/doxia/site/src/site/apt/macros/index.apt 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=774013&r1=774012&r2=774013&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 May 12 18:36:51 2009 @@ -40,8 +40,7 @@ * The input parameters for this macro are: * <dl> * <dt>section</dt> - * <dd>Display a TOC for the specified section only or all sections if 0 - * (in this case, other parameters are ignored).<br/> + * <dd>Display a TOC for the specified section only, or all sections if 0.<br/> * Positive int, not mandatory, 0 by default.</dd> * <dt>fromDepth</dt> * <dd>Minimal depth of entries to display in the TOC. @@ -103,16 +102,12 @@ Parser parser = (Parser) request.getParameter( "parser" ); section = getInt( request, "section", 0 ); + fromDepth = getInt( request, "fromDepth", 0 ); + toDepth = getInt( request, "toDepth", DEFAULT_DEPTH ); - if ( section == 0 ) + if ( fromDepth > toDepth ) { - fromDepth = 0; - toDepth = DEFAULT_DEPTH; - } - else - { - fromDepth = getInt( request, "fromDepth", 0 ); - toDepth = getInt( request, "toDepth", DEFAULT_DEPTH ); + return; } IndexEntry index = new IndexEntry( "index" ); @@ -127,8 +122,7 @@ throw new MacroExecutionException( "ParseException: " + e.getMessage(), e ); } - if ( index.getChildEntries().size() > 0 - && ( ( fromDepth <= toDepth ) || ( section == 0 ) ) ) + if ( index.getChildEntries().size() > 0 ) { sink.list( getAttributesFromMap( request.getParameters() ) ); Modified: maven/doxia/site/src/site/apt/macros/index.apt URL: http://svn.apache.org/viewvc/maven/doxia/site/src/site/apt/macros/index.apt?rev=774013&r1=774012&r2=774013&view=diff ============================================================================== --- maven/doxia/site/src/site/apt/macros/index.apt (original) +++ maven/doxia/site/src/site/apt/macros/index.apt Tue May 12 18:36:51 2009 @@ -181,7 +181,7 @@ *-----------+--------------+ || Parameter || Description | *-----------+--------------+ -| section | Display a TOC for the specified section only, or all sections if 0 (in this case, other parameters are ignored). Positive int, not mandatory, 0 by default. +| section | Display a TOC for the specified section only, or all sections if 0. Positive int, not mandatory, 0 by default. *-----------+--------------+ | fromDepth | Minimum section depth to include in the TOC (sections are depth 1, sub-sections depth 2, etc.). Positive int, not mandatory, 0 by default. *-----------+--------------+