You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2007/08/18 07:10:47 UTC
svn commit: r567233 -
/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
Author: vsiveton
Date: Fri Aug 17 22:10:45 2007
New Revision: 567233
URL: http://svn.apache.org/viewvc?view=rev&rev=567233
Log:
o fixed tableCaption() call
o used the UTF-8 charset for the copyright (safety)
Modified:
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java?view=diff&rev=567233&r1=567232&r2=567233
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java Fri Aug 17 22:10:45 2007
@@ -19,6 +19,8 @@
* under the License.
*/
+import java.io.UnsupportedEncodingException;
+
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.Sink;
@@ -365,11 +367,11 @@
sink.tableRows_();
+ sink.table_();
+
sink.tableCaption();
sink.text( "Table caption" );
sink.tableCaption_();
-
- sink.table_();
}
/**
@@ -595,10 +597,17 @@
sink.paragraph_();
sink.paragraph();
- String copyright = String.valueOf( '\u00a9' );
+ String copyright;
+ try
+ {
+ copyright = new String( String.valueOf( '\u00a9' ).getBytes( "UTF-8" ) );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ throw new IllegalArgumentException( e.getMessage() );
+ }
sink.text( "Copyright symbol: " + copyright + ", "
+ copyright + ", " + copyright + "." );
sink.paragraph_();
}
-
}
Re: svn commit: r567233 - /maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
Posted by Vincent Siveton <vi...@gmail.com>.
Thanks Lukas for the follow up.
Cheers,
Vincent
2007/8/18, Lukas Theussl <lt...@apache.org>:
> Hi Vincent,
>
> I've been thinking about the tableCaption() call: this doesn't solve the
> problem. The pdf generation will still fail if a specific parser emits
> the tableCaption within the table. This is currently still the case in
> particular for the AptParser, whose behavior the SinkTestDocument is
> supposed to mimick. As long as we don't have a mechanism to enforce the
> order of parsing events (see DOXIA-132), any sink must be flexible
> enough to deal with any (reasonable) order of events. In the current
> case, the ItextSink has to cache the tableCaption while it is parsed and
> emit it only at the end of the table.
>
> Even though it doesn't really matter where the caption is emitted (as
> long as it's the same for all parsers), I think it's more logical within
> the table, since in general a tableCaption is part of a table (just not
> for itext, nor for fo btw).
>
> I'll test and provide a fix soon.
>
> -Lukas
>
>
> vsiveton@apache.org wrote:
> > Author: vsiveton
> > Date: Fri Aug 17 22:10:45 2007
> > New Revision: 567233
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=567233
> > Log:
> > o fixed tableCaption() call
> > o used the UTF-8 charset for the copyright (safety)
> >
> > Modified:
> > maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
> >
> > Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
> > URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java?view=diff&rev=567233&r1=567232&r2=567233
> > ==============================================================================
> > --- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java (original)
> > +++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java Fri Aug 17 22:10:45 2007
> > @@ -19,6 +19,8 @@
> > * under the License.
> > */
> >
> > +import java.io.UnsupportedEncodingException;
> > +
> > import org.apache.maven.doxia.parser.Parser;
> > import org.apache.maven.doxia.sink.Sink;
> >
> > @@ -365,11 +367,11 @@
> >
> > sink.tableRows_();
> >
> > + sink.table_();
> > +
> > sink.tableCaption();
> > sink.text( "Table caption" );
> > sink.tableCaption_();
> > -
> > - sink.table_();
> > }
> >
> > /**
> > @@ -595,10 +597,17 @@
> > sink.paragraph_();
> >
> > sink.paragraph();
> > - String copyright = String.valueOf( '\u00a9' );
> > + String copyright;
> > + try
> > + {
> > + copyright = new String( String.valueOf( '\u00a9' ).getBytes( "UTF-8" ) );
> > + }
> > + catch ( UnsupportedEncodingException e )
> > + {
> > + throw new IllegalArgumentException( e.getMessage() );
> > + }
> > sink.text( "Copyright symbol: " + copyright + ", "
> > + copyright + ", " + copyright + "." );
> > sink.paragraph_();
> > }
> > -
> > }
> >
>
Re: svn commit: r567233 - /maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
Posted by Lukas Theussl <lt...@apache.org>.
Hi Vincent,
I've been thinking about the tableCaption() call: this doesn't solve the
problem. The pdf generation will still fail if a specific parser emits
the tableCaption within the table. This is currently still the case in
particular for the AptParser, whose behavior the SinkTestDocument is
supposed to mimick. As long as we don't have a mechanism to enforce the
order of parsing events (see DOXIA-132), any sink must be flexible
enough to deal with any (reasonable) order of events. In the current
case, the ItextSink has to cache the tableCaption while it is parsed and
emit it only at the end of the table.
Even though it doesn't really matter where the caption is emitted (as
long as it's the same for all parsers), I think it's more logical within
the table, since in general a tableCaption is part of a table (just not
for itext, nor for fo btw).
I'll test and provide a fix soon.
-Lukas
vsiveton@apache.org wrote:
> Author: vsiveton
> Date: Fri Aug 17 22:10:45 2007
> New Revision: 567233
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=567233
> Log:
> o fixed tableCaption() call
> o used the UTF-8 charset for the copyright (safety)
>
> Modified:
> maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
>
> Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
> URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java?view=diff&rev=567233&r1=567232&r2=567233
> ==============================================================================
> --- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java (original)
> +++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java Fri Aug 17 22:10:45 2007
> @@ -19,6 +19,8 @@
> * under the License.
> */
>
> +import java.io.UnsupportedEncodingException;
> +
> import org.apache.maven.doxia.parser.Parser;
> import org.apache.maven.doxia.sink.Sink;
>
> @@ -365,11 +367,11 @@
>
> sink.tableRows_();
>
> + sink.table_();
> +
> sink.tableCaption();
> sink.text( "Table caption" );
> sink.tableCaption_();
> -
> - sink.table_();
> }
>
> /**
> @@ -595,10 +597,17 @@
> sink.paragraph_();
>
> sink.paragraph();
> - String copyright = String.valueOf( '\u00a9' );
> + String copyright;
> + try
> + {
> + copyright = new String( String.valueOf( '\u00a9' ).getBytes( "UTF-8" ) );
> + }
> + catch ( UnsupportedEncodingException e )
> + {
> + throw new IllegalArgumentException( e.getMessage() );
> + }
> sink.text( "Copyright symbol: " + copyright + ", "
> + copyright + ", " + copyright + "." );
> sink.paragraph_();
> }
> -
> }
>