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 2009/08/24 14:15:09 UTC
svn commit: r807174 -
/maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
Author: vsiveton
Date: Mon Aug 24 12:15:08 2009
New Revision: 807174
URL: http://svn.apache.org/viewvc?rev=807174&view=rev
Log:
DOXIA-364: Guarantee the state of sinks and parsers impl
o impl init() method from r807164
o use final fields
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
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?rev=807174&r1=807173&r2=807174&view=diff
==============================================================================
--- 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 Mon Aug 24 12:15:08 2009
@@ -50,15 +50,15 @@
*
* This implies that <code>\\begin{document}</code>, <code>\\title{..}</code> will not be output.
*/
- private boolean fragmentDocument;
+ private final boolean fragmentDocument;
private boolean ignoreText;
- private LineBreaker out;
+ private final LineBreaker out;
- private String sinkCommands;
+ private final String sinkCommands;
- private String preamble;
+ private final String preamble;
private boolean titleFlag;
@@ -92,9 +92,7 @@
*/
protected LatexSink( Writer out )
{
- this.out = new LineBreaker( out );
- this.sinkCommands = defaultSinkCommands();
- this.preamble = defaultPreamble();
+ this( out, null, null );
}
/**
@@ -123,9 +121,21 @@
protected LatexSink( Writer out, String sinkCommands, String preamble, boolean fragmentDocument )
{
this.out = new LineBreaker( out );
+
+ if ( sinkCommands == null )
+ {
+ sinkCommands = defaultSinkCommands();
+ }
+ if ( preamble == null )
+ {
+ preamble = defaultPreamble();
+ }
+
this.sinkCommands = sinkCommands;
this.preamble = preamble;
this.fragmentDocument = fragmentDocument;
+
+ init();
}
// ----------------------------------------------------------------------
@@ -177,14 +187,7 @@
/** {@inheritDoc} */
public void head( SinkEventAttributes attributes )
{
- titleFlag = false;
- numberedListNesting = 0;
- verbatimFlag = false;
- figureFlag = false;
- tableFlag = false;
- gridFlag = false;
- cellJustif = null;
- cellCount = 0;
+ init();
if ( !fragmentDocument )
{
@@ -1021,7 +1024,7 @@
if ( attributes != null && attributes.isDefined( SinkEventAttributes.DECORATION ) )
{
boxed = "boxed".equals(
- (String) attributes.getAttribute( SinkEventAttributes.DECORATION ) );
+ attributes.getAttribute( SinkEventAttributes.DECORATION ) );
}
markup( EOL + "\\begin{small}" + EOL );
@@ -1362,6 +1365,8 @@
public void close()
{
out.close();
+
+ init();
}
// ----------------------------------------------------------------------
@@ -1433,4 +1438,22 @@
return "";
}
}
+
+ /** {@inheritDoc} */
+ protected void init()
+ {
+ super.init();
+
+ this.ignoreText = false;
+ this.titleFlag = false;
+ this.numberedListNesting = 0;
+ this.verbatimFlag = false;
+ this.figureFlag = false;
+ this.tableFlag = false;
+ this.gridFlag = false;
+ this.cellJustif = null;
+ this.cellCount = 0;
+ this.isTitle = false;
+ this.title = null;
+ }
}