Author: ltheussl
Date: Sat Sep 8 00:38:56 2007
New Revision: 573795
URL: http://svn.apache.org/viewvc?rev=573795&view=rev
Log:
Javadocs
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=573795&r1=573794&r2=573795&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
Sat Sep 8 00:38:56 2007
@@ -79,16 +79,36 @@
//
// ----------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * @param out The writer to use.
+ */
public LatexSink( Writer out )
{
this( out, defaultSinkCommands(), defaultPreamble() );
}
+ /**
+ * Constructor.
+ *
+ * @param out The writer to use.
+ * @param sinkCommands A String representation of commands that go before
\documentclass.
+ * @param preamble A String representation of commands that go between
\documentclass and \begin{document}.
+ */
public LatexSink( Writer out, String sinkCommands, String preamble )
{
this( out, sinkCommands, preamble, false );
}
+ /**
+ * Constructor.
+ *
+ * @param out The writer to use.
+ * @param sinkCommands A String representation of commands that go before
\documentclass.
+ * @param preamble A String representation of commands that go between
\documentclass and \begin{document}.
+ * @param fragmentDocument If this receives events that that are only part
of a document.
+ * Typically, headers are omitted if this is true. */
public LatexSink( Writer out, String sinkCommands, String preamble,
boolean fragmentDocument )
{
this.out = new LineBreaker( out );
@@ -101,16 +121,31 @@
// Overridables
// ----------------------------------------------------------------------
+ /**
+ * Returns a default \documentclass declaration.
+ *
+ * @return String.
+ */
protected String getDocumentStart()
{
return "\\documentclass[a4paper]{article}" + EOL + EOL;
}
+ /**
+ * Returns a default \begin{document} declaration.
+ *
+ * @return String.
+ */
protected String getDocumentBegin()
{
return "\\begin{document}" + EOL + EOL;
}
+ /**
+ * Returns a default \end{document} declaration.
+ *
+ * @return String.
+ */
protected String getDocumentEnd()
{
return "\\end{document}" + EOL;
@@ -120,6 +155,9 @@
// Sink Implementation
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void head()
{
titleFlag = false;
@@ -144,6 +182,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void body()
{
if ( titleFlag )
@@ -160,6 +201,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void body_()
{
if ( !fragmentDocument )
@@ -174,11 +218,17 @@
// Section Title 1
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle1()
{
isTitle = true;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle1_()
{
isTitle = false;
@@ -195,11 +245,17 @@
// Section Title 2
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle2()
{
isTitle = true;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle2_()
{
isTitle = false;
@@ -216,11 +272,17 @@
// Section Title 3
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle3()
{
isTitle = true;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle3_()
{
isTitle = false;
@@ -237,11 +299,17 @@
// Section Title 4
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle4()
{
isTitle = true;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle4_()
{
isTitle = false;
@@ -258,11 +326,17 @@
// Section Title 5
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle5()
{
isTitle = true;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle5_()
{
isTitle = false;
@@ -279,21 +353,33 @@
//
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void list()
{
markup( "\\begin{plist}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void list_()
{
markup( "\\end{plist}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void listItem()
{
markup( "\\item{} " );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void numberedList( int numbering )
{
++numberedListNesting;
@@ -339,51 +425,78 @@
markup( "\\renewcommand{\\the" + counter + "}{\\" + style + "{" +
counter + "}}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void numberedList_()
{
markup( "\\end{pnumberedlist}" + EOL + EOL );
--numberedListNesting;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void numberedListItem()
{
markup( "\\item{} " );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void definitionList()
{
markup( "\\begin{pdefinitionlist}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void definitionList_()
{
markup( "\\end{pdefinitionlist}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void figure()
{
figureFlag = true;
markup( "\\begin{pfigure}" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void figure_()
{
markup( "\\end{pfigure}" + EOL + EOL );
figureFlag = false;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void table()
{
tableFlag = true;
markup( "\\begin{ptable}" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void table_()
{
markup( "\\end{ptable}" + EOL + EOL );
tableFlag = false;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableRows( int[] justification, boolean grid )
{
@@ -421,6 +534,9 @@
cellJustif = justification;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableRows_()
{
markup( "\\end{ptablerows}" + EOL );
@@ -428,11 +544,17 @@
cellJustif = null;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableRow()
{
cellCount = 0;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableRow_()
{
markup( "\\\\" + EOL );
@@ -444,6 +566,9 @@
lastCellWasHeader = false;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void title()
{
if ( !fragmentDocument )
@@ -457,6 +582,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void title_()
{
if ( !fragmentDocument )
@@ -469,6 +597,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void author()
{
if ( !fragmentDocument )
@@ -481,6 +612,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void author_()
{
if ( !fragmentDocument )
@@ -493,6 +627,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void date()
{
if ( !fragmentDocument )
@@ -505,6 +642,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void date_()
{
if ( !fragmentDocument )
@@ -517,17 +657,26 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void sectionTitle_()
{
// TODO: closing bracket?
markup( "}" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void paragraph_()
{
markup( EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void verbatim( boolean boxed )
{
if ( boxed )
@@ -544,6 +693,9 @@
boxFlag = boxed;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void verbatim_()
{
markup( EOL + "\\end{verbatim}" + EOL );
@@ -560,41 +712,65 @@
boxFlag = false;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void definedTerm()
{
markup( "\\item[\\mbox{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void definedTerm_()
{
markup( "}] " );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void figureCaption()
{
markup( "\\pfigurecaption{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void figureCaption_()
{
markup( "}" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableCell()
{
tableCell( false );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableCell_()
{
tableCell_( false );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableHeaderCell()
{
tableCell( true );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableHeaderCell_()
{
tableCell_( true );
@@ -602,6 +778,11 @@
private boolean lastCellWasHeader = false;
+ /**
+ * Starts a table cell.
+ *
+ * @param header True if this is a header cell.
+ */
public void tableCell( boolean header )
{
lastCellWasHeader = header;
@@ -628,97 +809,156 @@
markup( "\\begin{pcell}{" + justif + "}" );
}
+ /**
+ * Ends a table cell.
+ *
+ * @param header True if this is a header cell.
+ */
public void tableCell_( boolean header )
{
markup( "\\end{pcell}" );
++cellCount;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableCaption()
{
markup( "\\ptablecaption{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void tableCaption_()
{
markup( "}" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void figureGraphics( String name )
{
markup( "\\pfiguregraphics{" + name + "}" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void horizontalRule()
{
markup( "\\phorizontalrule" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void pageBreak()
{
markup( "\\newpage" + EOL + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void anchor( String name )
{
markup( "\\panchor{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void anchor_()
{
markup( "}" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void link( String name )
{
markup( "\\plink{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void link_()
{
markup( "}" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void italic()
{
markup( "\\pitalic{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void italic_()
{
markup( "}" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void bold()
{
markup( "\\pbold{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void bold_()
{
markup( "}" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void monospaced()
{
markup( "\\pmonospaced{" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void monospaced_()
{
markup( "}" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void lineBreak()
{
markup( ( figureFlag || tableFlag || titleFlag ) ? "\\\\" + EOL :
"\\newline" + EOL );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void nonBreakingSpace()
{
markup( "~" );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void text( String text )
{
if ( ignoreText )
@@ -741,6 +981,11 @@
// -----------------------------------------------------------------------
+ /**
+ * Writes the text, preserving whitespace.
+ *
+ * @param text the text to write.
+ */
protected void markup( String text )
{
if ( text != null )
@@ -749,11 +994,21 @@
}
}
+ /**
+ * Writes the text, without preserving whitespace.
+ *
+ * @param text the text to write.
+ */
protected void content( String text )
{
out.write( escaped( text ), /*preserveSpace*/ false );
}
+ /**
+ * Writes the text, preserving whitespace.
+ *
+ * @param text the text to write.
+ */
protected void verbatimContent( String text )
{
out.write( text, /*preserveSpace*/ true );
@@ -761,6 +1016,12 @@
// -----------------------------------------------------------------------
+ /**
+ * Escapes special characters.
+ *
+ * @param text The text to escape.
+ * @return The text with special characters replaced.
+ */
protected static String escaped( String text )
{
int length = text.length();
@@ -821,11 +1082,17 @@
//
// ----------------------------------------------------------------------
+ /**
+ * [EMAIL PROTECTED]
+ */
public void flush()
{
out.flush();
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void close()
{
out.close();
@@ -835,18 +1102,35 @@
//
// ----------------------------------------------------------------------
+ /**
+ * Returns the default sink commands from a resource.
+ *
+ * @throws java.io.IOException if the resource file cannot be read.
+ * @return InputStream
+ */
public static InputStream getDefaultSinkCommands()
throws IOException
{
return LatexSink.class.getResource( "default_sink_commands.tex"
).openStream();
}
+ /**
+ * Returns the default preamble from a resource.
+ *
+ * @return InputStream
+ * @throws java.io.IOException if the resource file cannot be read.
+ */
public static InputStream getDefaultPreamble()
throws IOException
{
return LatexSink.class.getResource( "default_preamble.tex"
).openStream();
}
+ /**
+ * Returns the default sink commands.
+ *
+ * @return String.
+ */
public static String defaultSinkCommands()
{
String commands = "";
@@ -863,6 +1147,11 @@
return commands;
}
+ /**
+ * Returns the default preamble.
+ *
+ * @return String.
+ */
public static String defaultPreamble()
{
String preamble = "";