maven-doxia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Venisse <emman...@venisse.net>
Subject Re: [PATCH] some twiki patches
Date Wed, 23 Aug 2006 06:22:54 GMT
Please, attach your patch to an issue.

Emmanuel

Juan F. Codagnone a écrit :
> Hi,
> 
> I have some random fixes for the twiki parser  (table related) and for the 
> rest of the Sinks.
> 
> juanpatches.diff is the whole diff, and the juanpatches.tar.gz has the 
> incrementals patches with a comment.
> 
> Regards,
>    Juan.
> 
> ------------------------------------------------------------------------
> r2 | juan | 2006-08-20 22:16:12 -0300 (Sun, 20 Aug 2006) | 4 lines
> Changed paths:
>    
> M /branches/433103/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
> 
> document start should be the first thing in a \latex file.
> 
> (if not it triggers ! LaTeX Error: \usepackage before \documentclass.)
> 
> ------------------------------------------------------------------------
> r3 | juan | 2006-08-20 22:18:55 -0300 (Sun, 20 Aug 2006) | 5 lines
> Changed paths:
>    
> M /branches/433103/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
> 
> twiki parser generated sectionTitle events in all the sections. 
> The only Sink that supports that behavior is xdoc.
> 
>  Now it generates sectionTitle1, sectionTitle2, ...
> 
> ------------------------------------------------------------------------
> r6 | juan | 2006-08-21 00:49:33 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
> 
> Sink#tableRows must be called after Sink#table and before Sink#tableRow
> ------------------------------------------------------------------------
> r7 | juan | 2006-08-21 00:50:02 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-core/src/main/java/org/apache/maven/doxia/validation/AdvicedSink.java
> 
> dupe
> ------------------------------------------------------------------------
> r8 | juan | 2006-08-21 01:03:09 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
> 
> implement tableCell and tableCell_
> ------------------------------------------------------------------------
> r9 | juan | 2006-08-21 01:15:30 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
> 
> implement tableHeaderCell and tableHeaderCell_ to avoid NPE
> ------------------------------------------------------------------------
> r10 | juan | 2006-08-21 01:33:30 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
> 
> something was wrong in rev6.
> ------------------------------------------------------------------------
> r11 | juan | 2006-08-21 01:41:12 -0300 (Mon, 21 Aug 2006) | 1 line
> Changed paths:
>    
> M /branches/433103/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
> 
> port revisions 6 and 10 to confluence.
> ------------------------------------------------------------------------
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
> ===================================================================
> --- doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java	(revision
433332)
> +++ doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java	(working
copy)
> @@ -854,6 +854,16 @@
>          table.add( row );
>      }
>  
> +    public void tableHeaderCell()
> +    {
> +        tableCell();
> +    }
> +   
> +    public void tableHeaderCell_()
> +    {
> +        tableCell_();
> +    }
> +    
>      public void tableCell()
>      {
>          cell = new Cell();
> Index: doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
> ===================================================================
> --- doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java	(revision
433332)
> +++ doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java	(working
copy)
> @@ -130,12 +130,12 @@
>  
>          if ( !fragmentDocument )
>          {
> +            markup( getDocumentStart() );
> +            
>              markup( sinkCommands );
>  
>              markup( preamble );
>  
> -            markup( getDocumentStart() );
> -
>              markup( getDocumentBegin() );
>          }
>      }
> @@ -432,11 +432,12 @@
>      public void tableRow_()
>      {
>          markup( "\\\\" + EOL );
> -        if ( gridFlag )
> +        if ( gridFlag || lastCellWasHeader )
>          {
>              markup( "\\hline" + EOL );
>          }
>          cellCount = 0;
> +        lastCellWasHeader = false;
>      }
>  
>      public void title()
> @@ -576,6 +577,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 );
> @@ -598,7 +623,7 @@
>          markup( "\\begin{pcell}{" + justif + "}" );
>      }
>  
> -    public void tableCell_()
> +    public void tableCell_( boolean header )
>      {
>          markup( "\\end{pcell}" );
>          ++cellCount;
> Index: doxia-core/src/main/java/org/apache/maven/doxia/validation/AdvicedSink.java
> ===================================================================
> --- doxia-core/src/main/java/org/apache/maven/doxia/validation/AdvicedSink.java	(revision
433332)
> +++ doxia-core/src/main/java/org/apache/maven/doxia/validation/AdvicedSink.java	(working
copy)
> @@ -987,7 +987,6 @@
>          M_FIGURECAPTION = CLASS.getMethod( "figureCaption", null );
>          M_FIGURECAPTION_ = CLASS.getMethod( "figureCaption_", null );
>          M_TABLECELL = CLASS.getMethod( "tableCell", null );
> -        M_TABLECELL = CLASS.getMethod( "tableCell", null );
>          M_TABLECELL_ = CLASS.getMethod( "tableCell_", null );
>          M_TABLEHEADERCELL = CLASS.getMethod( "tableHeaderCell", null );
>          M_TABLEHEADERCELL = CLASS.getMethod( "tableHeaderCell", null );
> Index: doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
> ===================================================================
> --- doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
(revision 433332)
> +++ doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
(working copy)
> @@ -16,6 +16,7 @@
>   * limitations under the License.
>   */
>  
> +import org.apache.maven.doxia.module.apt.AptParser;
>  import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
>  import org.apache.maven.doxia.sink.Sink;
>  
> @@ -33,10 +34,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] = AptParser.JUSTIFY_CENTER;
> +        }
> +        
> +        return justification;
> +    }
>  }
> Index: doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
> ===================================================================
> --- doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
(revision 433332)
> +++ doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/TableBlock.java
(working copy)
> @@ -15,6 +15,7 @@
>   */
>  package org.apache.maven.doxia.module.twiki.parser;
>  
> +import org.apache.maven.doxia.module.apt.AptParser;
>  import org.apache.maven.doxia.sink.Sink;
>  
>  
> @@ -45,6 +46,7 @@
>      public final void before( final Sink sink )
>      {
>          sink.table();
> +        sink.tableRows( getJustification(), false );
>      }
>  
>      /**
> @@ -53,6 +55,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] = AptParser.JUSTIFY_CENTER;
> +        }
> +        
> +        return justification;
> +    }
>  }
> Index: doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
> ===================================================================
> --- doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
(revision 433332)
> +++ doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
(working copy)
> @@ -73,9 +73,9 @@
>      public final void before( final Sink sink )
>      {
>          sectionStart( sink );
> -        sink.sectionTitle();
> +        sectionTitle( sink );
>          sink.text( title );
> -        sink.sectionTitle_();
> +        sectionTitle_( sink );
>  
>      }
>  
> @@ -178,4 +178,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 + "_" );
> +    }
>  }


Mime
View raw message