maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r555344 - in /maven/doxia/doxia/trunk/doxia-modules: doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/ doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/ doxia-module-rtf/src/mai...
Date Wed, 11 Jul 2007 17:52:35 GMT
Author: ltheussl
Date: Wed Jul 11 10:52:31 2007
New Revision: 555344

URL: http://svn.apache.org/viewvc?view=rev&rev=555344
Log:
DOXIA-73 (part), submitted by Juan F. Codagnone. Small fixes for table parsing.

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java?view=diff&rev=555344&r1=555343&r2=555344
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
Wed Jul 11 10:52:31 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.doxia.parser.Parser;
 import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
 import org.apache.maven.doxia.sink.Sink;
 
@@ -36,10 +37,24 @@
     public  void before(  Sink sink )
     {
         sink.table();
+        sink.tableRows( getJustification(), false );
     }
 
     public  void after(  Sink sink )
     {
+        sink.tableRows_();
         sink.table_();
+    }
+    
+    private final int [] getJustification() {
+        final AbstractFatherBlock b = 
+            ((AbstractFatherBlock)getBlocks().get( 0 ));
+        int[] justification = new int[b.getBlocks().size()];
+        for ( int i = 0; i < justification.length; i++ )
+        {
+            justification[i] = Parser.JUSTIFY_CENTER;
+        }
+        
+        return justification;
     }
 }

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java?view=diff&rev=555344&r1=555343&r2=555344
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
Wed Jul 11 10:52:31 2007
@@ -435,11 +435,12 @@
     public void tableRow_()
     {
         markup( "\\\\" + EOL );
-        if ( gridFlag )
+        if ( gridFlag || lastCellWasHeader )
         {
             markup( "\\hline" + EOL );
         }
         cellCount = 0;
+        lastCellWasHeader = false;
     }
 
     public void title()
@@ -579,6 +580,30 @@
 
     public void tableCell()
     {
+        tableCell( false );
+    }
+    
+    public void tableCell_()
+    {
+        tableCell_( false );
+    }
+
+    public void tableHeaderCell()
+    {
+        tableCell( true );
+    }
+    
+    public void tableHeaderCell_()
+    {
+        tableCell_( true );
+    }
+    
+    private boolean lastCellWasHeader = false;
+    
+    public void tableCell( boolean header )
+    {
+        lastCellWasHeader = header;
+        
         if ( cellCount > 0 )
         {
             markup( " &" + EOL );
@@ -601,7 +626,7 @@
         markup( "\\begin{pcell}{" + justif + "}" );
     }
 
-    public void tableCell_()
+    public void tableCell_( boolean header )
     {
         markup( "\\end{pcell}" );
         ++cellCount;

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java?view=diff&rev=555344&r1=555343&r2=555344
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
Wed Jul 11 10:52:31 2007
@@ -857,6 +857,16 @@
         table.add( row );
     }
 
+    public void tableHeaderCell()
+    {
+        tableCell();
+    }
+   
+    public void tableHeaderCell_()
+    {
+        tableCell_();
+    }
+    
     public void tableCell()
     {
         cell = new Cell();

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java?view=diff&rev=555344&r1=555343&r2=555344
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
Wed Jul 11 10:52:31 2007
@@ -77,9 +77,9 @@
     public final void before( final Sink sink )
     {
         sectionStart( sink );
-        sink.sectionTitle();
+        sectionTitle( sink );
         sink.text( title );
-        sink.sectionTitle_();
+        sectionTitle_( sink );
 
     }
 
@@ -182,4 +182,15 @@
         return sb.toString();
     }
 
+    /** @param sink */
+    private void sectionTitle( final Sink sink ) 
+    {
+        invokeVoidVoid( sink, "sectionTitle" + level );
+    }
+    
+    /** @param sink */
+    private void sectionTitle_( final Sink sink ) 
+    {
+        invokeVoidVoid( sink, "sectionTitle" + level + "_" );
+    }
 }

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java?view=diff&rev=555344&r1=555343&r2=555344
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
Wed Jul 11 10:52:31 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.doxia.parser.Parser;
 import org.apache.maven.doxia.sink.Sink;
 
 
@@ -49,6 +50,7 @@
     public final void before( final Sink sink )
     {
         sink.table();
+        sink.tableRows( getJustification(), false );
     }
 
     /**
@@ -57,6 +59,19 @@
     
     public final void after( final Sink sink )
     {
+        sink.tableRows_();
         sink.table_();
+    }
+    
+    
+    private final int [] getJustification() {
+        int[] justification = new int[((AbstractFatherBlock)getBlocks()[0]).
+                                      getBlocks().length];
+        for ( int i = 0; i < justification.length; i++ )
+        {
+            justification[i] = Parser.JUSTIFY_CENTER;
+        }
+        
+        return justification;
     }
 }



Mime
View raw message