[maven-doxia] branch master updated: [DOXIA-564] fixed TOC numbering (TOC entry & sub-items)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-doxia] branch master updated: [DOXIA-564] fixed TOC numbering (TOC entry & sub-items)

hboutemy
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git


The following commit(s) were added to refs/heads/master by this push:
     new a983dcd  [DOXIA-564] fixed TOC numbering (TOC entry & sub-items)
a983dcd is described below

commit a983dcd5eb299b339875e03ea90f27de49dde4c8
Author: Hervé Boutemy <[hidden email]>
AuthorDate: Sun Nov 5 20:18:27 2017 +0100

    [DOXIA-564] fixed TOC numbering (TOC entry & sub-items)
---
 .../apache/maven/doxia/module/fo/FoAggregateSink.java    | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
index 4bbc9bd..8afab2c 100644
--- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
+++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
@@ -956,6 +956,8 @@ public class FoAggregateSink
 
         tocStack.push( new NumberedListItem( NUMBERING_DECIMAL ) );
 
+        boolean printToc = ( level == 1 );
+
         for ( DocumentTOCItem tocItem : tocItems )
         {
             String ref = getIdName( tocItem.getRef() );
@@ -976,8 +978,16 @@ public class FoAggregateSink
             writeStartTag( BLOCK_TAG, "toc.number.style" );
 
             NumberedListItem current = tocStack.peek();
-            current.next();
-            write( currentTocNumber() );
+            if ( printToc )
+            {
+                // MPDF-59: no entry numbering for first, since it's the "Table of Contents"
+                printToc = false;
+            }
+            else
+            {
+                current.next();
+                write( currentTocNumber() );
+            }
 
             writeEndTag( BLOCK_TAG );
             writeEndTag( TABLE_CELL_TAG );
@@ -1019,7 +1029,7 @@ public class FoAggregateSink
 
         for ( int i = 1; i < tocStack.size(); i++ )
         {
-            ch.append( "." + tocStack.get( i ).getListItemSymbol() );
+            ch.append( tocStack.get( i ).getListItemSymbol() );
         }
 
         return ch.toString();

--
To stop receiving notification emails like this one, please contact
['"[hidden email]" <[hidden email]>'].