Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java Fri Feb 22 05:33:30 2008 @@ -143,21 +143,21 @@ protected String getTitleBlock( String title ) { String attribs = getConfig().getAttributeString( "doc.header.title" ); - return "<fo:block" + attribs + ">" + title + "</fo:block>"; + return EOL + "<fo:block" + attribs + ">" + title + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ protected String getAuthorBlock( String author ) { String attribs = getConfig().getAttributeString( "doc.header.author" ); - return "<fo:block" + attribs + ">" + author + "</fo:block>"; + return EOL + "<fo:block" + attribs + ">" + author + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ protected String getDateBlock( String date ) { String attribs = getConfig().getAttributeString( "doc.header.date" ); - return "<fo:block" + attribs + ">" + date + "</fo:block>"; + return EOL + "<fo:block" + attribs + ">" + date + "</fo:block>" + EOL; } // TODO @@ -176,7 +176,7 @@ /** [EMAIL PROTECTED] */ protected String getBodyBlock() { - return "</fo:flow></fo:page-sequence></fo:root>"; + return EOL + "</fo:flow>" + EOL + "</fo:page-sequence>" + EOL + "</fo:root>" + EOL; } /** [EMAIL PROTECTED] */ @@ -190,8 +190,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h1" ); - return "<fo:block" + attribs + "><fo:block" + attrib2 + ">1 " - + title + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + + attrib2 + ">1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -199,8 +199,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h2" ); - return "<fo:block" + attribs + "><fo:block" + attrib2 + ">0.1 " - + title + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + + attrib2 + ">0.1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -208,8 +208,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h3" ); - return "<fo:block" + attribs + "><fo:block" + attrib2 + ">0.0.1 " - + title + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + + attrib2 + ">0.0.1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -217,8 +217,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h4" ); - return "<fo:block" + attribs + "><fo:block" + attrib2 + ">" - + title + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + + attrib2 + ">" + title + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -226,8 +226,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h5" ); - return "<fo:block" + attribs + "><fo:block" + attrib2 + ">" - + title + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + + attrib2 + ">" + title + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -235,10 +235,10 @@ { String attribs = getConfig().getAttributeString( "list" ); String itemAttribs = getConfig().getAttributeString( "list.item" ); - return "<fo:list-block" + attribs + "><fo:list-item" + itemAttribs - + "><fo:list-item-label><fo:block>•</fo:block></fo:list-item-label><fo:list-item-body" - + itemAttribs + "><fo:block>" + item - + "</fo:block></fo:list-item-body></fo:list-item></fo:list-block>"; + return EOL + EOL + "<fo:list-block" + attribs + ">" + EOL + "<fo:list-item" + itemAttribs + + "><fo:list-item-label><fo:block>•</fo:block></fo:list-item-label>" + EOL + EOL + "<fo:list-item-body" + + itemAttribs + ">" + EOL + "<fo:block>" + item + + "</fo:block>" + EOL + "</fo:list-item-body>" + EOL + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -246,11 +246,11 @@ { String attribs = getConfig().getAttributeString( "list" ); String itemAttribs = getConfig().getAttributeString( "list.item" ); - return "<fo:list-block" + attribs + "><fo:list-item" + itemAttribs - + "><fo:list-item-label><fo:block>i</fo:block></fo:list-item-label>" + return EOL + EOL + "<fo:list-block" + attribs + ">" + EOL + "<fo:list-item" + itemAttribs + + ">" + EOL + "<fo:list-item-label>" + EOL + "<fo:block>i</fo:block>" + EOL + "</fo:list-item-label>" + EOL + EOL + "<fo:list-item-body" + itemAttribs - + "><fo:block>" + item + "</fo:block></fo:list-item-body>" - + "</fo:list-item></fo:list-block>"; + + ">" + EOL + "<fo:block>" + item + "</fo:block>" + EOL + "</fo:list-item-body>" + EOL + + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -259,9 +259,9 @@ String dlAtts = getConfig().getAttributeString( "dl" ); String dtAtts = getConfig().getAttributeString( "dt" ); String ddAtts = getConfig().getAttributeString( "dd" ); - return "<fo:block" + dlAtts + "><fo:block" + dtAtts + ">" + definum - + "</fo:block><fo:block" + ddAtts + ">" + definition - + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + dlAtts + ">" + EOL + "<fo:block" + dtAtts + ">" + definum + + "</fo:block>" + EOL + EOL + EOL + "<fo:block" + ddAtts + ">" + definition + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -270,9 +270,9 @@ String dlAtts = getConfig().getAttributeString( "figure.display" ); String dtAtts = getConfig().getAttributeString( "figure.graphics" ); String ddAtts = getConfig().getAttributeString( "figure.caption" ); - return "<fo:block" + dlAtts + "><fo:external-graphic" + dtAtts - + " src=\"" + source + "\"/><fo:block" + ddAtts - + ">" + caption + "</fo:block></fo:block>"; + return EOL + EOL + "<fo:block" + dlAtts + "><fo:external-graphic" + dtAtts + + " src=\"" + source + "\"/>" + EOL + EOL + "<fo:block" + ddAtts + + ">" + caption + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ @@ -282,49 +282,49 @@ String dtAtts = getConfig().getAttributeString( "table.layout" ); String ddAtts = getConfig().getAttributeString( "table.body.row" ); String deAtts = getConfig().getAttributeString( "table.body.cell" ); - return "<fo:block" + dlAtts + "><fo:table" + dtAtts + ">" + return EOL + EOL + "<fo:block" + dlAtts + ">" + EOL + "<fo:table" + dtAtts + ">" + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" - + "<fo:table-column column-width=\"1in\"/>" - + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" - + "<fo:table-body><fo:table-row" + ddAtts + + EOL + "<fo:table-column column-width=\"1in\"/>" + + EOL + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" + + EOL + EOL + "<fo:table-body>" + EOL + "<fo:table-row" + ddAtts + "><fo:table-cell column-number=\"2\"" + deAtts - + "><fo:block text-align=\"center\">" + cell - + "</fo:block></fo:table-cell></fo:table-row></fo:table-body>" - + caption + "</fo:table></fo:block>"; + + ">" + EOL + "<fo:block text-align=\"center\">" + EOL + cell + + "</fo:block>" + EOL + "</fo:table-cell>" + EOL + "</fo:table-row>" + EOL + "</fo:table-body>" + + EOL + caption + "</fo:table>" + EOL + "</fo:block>"+ EOL; } /** [EMAIL PROTECTED] */ protected String getParagraphBlock( String text ) { String attribs = getConfig().getAttributeString( "normal.paragraph" ); - return "<fo:block" + attribs + ">" + text + "</fo:block>"; + return EOL + "<fo:block" + attribs + ">" + text + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ protected String getVerbatimBlock( String text ) { String attribs = getConfig().getAttributeString( "body.source" ); - return "<fo:block" + attribs + ">" + text + "</fo:block>"; + return EOL + "<fo:block" + attribs + ">" + text + "</fo:block>" + EOL; } /** [EMAIL PROTECTED] */ protected String getHorizontalRuleBlock() { String attribs = getConfig().getAttributeString( "body.rule" ); - return "<fo:block><fo:leader" + attribs + " /></fo:block>"; + return EOL + EOL + "<fo:block>" + EOL + "<fo:leader" + attribs + " /></fo:block>" + EOL; } /** [EMAIL PROTECTED] */ protected String getPageBreakBlock() { - return "<fo:block break-before=\"page\" />"; + return EOL + "<fo:block break-before=\"page\" />" + EOL; } /** [EMAIL PROTECTED] */ protected String getAnchorBlock( String anchor ) { // assume that anchor doesn't start with # - return "<fo:inline id=\"#" + anchor + "\">" + anchor + "</fo:inline>"; + return EOL + "<fo:inline id=\"#" + anchor + "\">" + anchor + "</fo:inline>"; } /** [EMAIL PROTECTED] */ @@ -332,7 +332,7 @@ { String attribs = getConfig().getAttributeString( "href.internal" ); // assume that link doesn't start with # - return "<fo:basic-link internal-destination=\"#" + link + "\"><fo:inline" + return EOL + "<fo:basic-link internal-destination=\"#" + link + "\">" + EOL + "<fo:inline" + attribs + ">" + text + "</fo:inline></fo:basic-link>"; } @@ -340,27 +340,27 @@ protected String getItalicBlock( String text ) { String attribs = getConfig().getAttributeString( "italic" ); - return "<fo:inline" + attribs + ">" + text + "</fo:inline>"; + return EOL + "<fo:inline" + attribs + ">" + text + "</fo:inline>"; } /** [EMAIL PROTECTED] */ protected String getBoldBlock( String text ) { String attribs = getConfig().getAttributeString( "bold" ); - return "<fo:inline" + attribs + ">" + text + "</fo:inline>"; + return EOL + "<fo:inline" + attribs + ">" + text + "</fo:inline>"; } /** [EMAIL PROTECTED] */ protected String getMonospacedBlock( String text ) { String attribs = getConfig().getAttributeString( "monospace" ); - return "<fo:inline" + attribs + ">" + text + "</fo:inline>"; + return EOL + "<fo:inline" + attribs + ">" + text + "</fo:inline>"; } /** [EMAIL PROTECTED] */ protected String getLineBreakBlock() { - return "<fo:block />"; + return EOL + EOL + "<fo:block />"; } /** [EMAIL PROTECTED] */
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=630198&r1=630197&r2=630198&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 Fri Feb 22 05:33:30 2008 @@ -1024,7 +1024,7 @@ * @param text The text to escape. * @return The text with special characters replaced. */ - protected static String escaped( String text ) + public static String escaped( String text ) { int length = text.length(); StringBuffer buffer = new StringBuffer( length ); Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/test/java/org/apache/maven/doxia/module/latex/LatexSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/test/java/org/apache/maven/doxia/module/latex/LatexSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/test/java/org/apache/maven/doxia/module/latex/LatexSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/test/java/org/apache/maven/doxia/module/latex/LatexSinkTest.java Fri Feb 22 05:33:30 2008 @@ -47,126 +47,130 @@ /** [EMAIL PROTECTED] */ protected String getTitleBlock( String title ) { - return "\\ptitle{" + title + "}"; + return "\\ptitle{" + LatexSink.escaped( title ) + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getAuthorBlock( String author ) { - return "\\pauthor{" + author + "}"; + return "\\pauthor{" + LatexSink.escaped( author ) + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getDateBlock( String date ) { - return "\\pdate{" + date + "}"; + return "\\pdate{" + LatexSink.escaped( date ) + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getHeadBlock() { return ((LatexSink) getSink()).defaultSinkCommands() - + "\\documentclass[a4paper]{article}" + + "\\documentclass[a4paper]{article}" + EOL + EOL + ((LatexSink) getSink()).defaultPreamble() - + "\\begin{document}"; + + "\\begin{document}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getBodyBlock() { - return "\\end{document}"; + return "\\end{document}" + EOL; } /** [EMAIL PROTECTED] */ protected String getSectionTitleBlock( String title ) { // TODO: closing bracket? - return title + "}"; + return title + "}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getSection1Block( String title ) { - return "\\psectioni{" + title + "}"; + return "\\psectioni{" + title + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getSection2Block( String title ) { - return "\\psectionii{" + title + "}"; + return "\\psectionii{" + title + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getSection3Block( String title ) { - return "\\psectioniii{" + title + "}"; + return "\\psectioniii{" + title + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getSection4Block( String title ) { - return "\\psectioniv{" + title + "}"; + return "\\psectioniv{" + title + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getSection5Block( String title ) { - return "\\psectionv{" + title + "}"; + return "\\psectionv{" + title + "}" + EOL; } /** [EMAIL PROTECTED] */ protected String getListBlock( String item ) { - return "\\begin{plist}\\item{} " + item + "\\end{plist}"; + return "\\begin{plist}" + EOL + EOL + "\\item{} " + LatexSink.escaped( item ) + "\\end{plist}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getNumberedListBlock( String item ) { - return "\\begin{pnumberedlist}\\renewcommand{\\theenumi}{\\roman{enumi}}\\item{} " + item + "\\end{pnumberedlist}"; + return "\\begin{pnumberedlist}" + EOL + "\\renewcommand{\\theenumi}{\\roman{enumi}}" + EOL + EOL + "\\item{} " + + LatexSink.escaped( item ) + "\\end{pnumberedlist}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getDefinitionListBlock( String definum, String definition ) { - return "\\begin{pdefinitionlist}\\item[\\mbox{" + definum + "}] " + definition + "\\end{pdefinitionlist}"; + return "\\begin{pdefinitionlist}" + EOL + EOL + "\\item[\\mbox{" + definum + "}] " + definition + "\\end{pdefinitionlist}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getFigureBlock( String source, String caption ) { - return "\\begin{pfigure}\\pfiguregraphics{" + source + "}\\pfigurecaption{" + caption + "}\\end{pfigure}"; + return "\\begin{pfigure}" + EOL + "\\pfiguregraphics{" + source + "}" + EOL + "\\pfigurecaption{" + + LatexSink.escaped( caption ) + "}" + EOL + "\\end{pfigure}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getTableBlock( String cell, String caption ) { // TODO: something's wrong - return "\\begin{ptable}\\begin{ptablerows}{c}\\begin{pcell}{c}cell\\end{pcell}\\\\\\end{ptablerows}\\ptablecaption{" + caption + "}\\end{ptable}"; + return "\\begin{ptable}" + EOL + "\\begin{ptablerows}{c}" + EOL + "\\begin{pcell}{c}cell\\end{pcell}\\\\" + + EOL + "\\end{ptablerows}" + EOL + "\\ptablecaption{" + LatexSink.escaped( caption ) + "}" + + EOL + "\\end{ptable}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getParagraphBlock( String text ) { - return text; + return text + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getVerbatimBlock( String text ) { - return "\\begin{pverbatimbox}\\begin{verbatim}" + text + "\\end{verbatim}\\end{pverbatimbox}"; + return "\\begin{pverbatimbox}" + EOL + "\\begin{verbatim}" + EOL + text + EOL + "\\end{verbatim}" + EOL + "\\end{pverbatimbox}" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getHorizontalRuleBlock() { - return "\\phorizontalrule"; + return "\\phorizontalrule" + EOL + EOL; } /** [EMAIL PROTECTED] */ protected String getPageBreakBlock() { - return "\\newpage"; + return "\\newpage" + EOL + EOL; } /** [EMAIL PROTECTED] */ @@ -202,7 +206,7 @@ /** [EMAIL PROTECTED] */ protected String getLineBreakBlock() { - return "\\newline"; + return "\\newline" + EOL; } /** [EMAIL PROTECTED] */ @@ -215,7 +219,7 @@ protected String getTextBlock( String text ) { // TODO: how to retrieve those outside the sink? - return "\\textasciitilde , =, \\symbol{45}, +, *, [, ], \\symbol{60}, \\symbol{62}, \\{,\\}, \\textbackslash"; + return "\\textasciitilde" + EOL + ",\\_=,\\_\\symbol{45},\\_+,\\_*,\\_[,\\_],\\_\\symbol{60},\\_\\symbol{62},\\_\\{,\\_\\},\\_\\textbackslash"; } /** [EMAIL PROTECTED] */ Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java Fri Feb 22 05:33:30 2008 @@ -66,7 +66,7 @@ /** [EMAIL PROTECTED] */ protected String getHeadBlock() { - return "<?xml version=\"1.0\" ?><document><properties></properties>"; + return "<?xml version=\"1.0\" ?>" + EOL + "<document><properties></properties>"; } /** [EMAIL PROTECTED] */ @@ -226,7 +226,7 @@ /** [EMAIL PROTECTED] */ protected String getRawTextBlock( String text ) { - return "~, =, -, +, *, [, ], <, >, {, }, \\"; + return "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\"; } Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java Fri Feb 22 05:33:30 2008 @@ -239,7 +239,7 @@ protected String getTextBlock( String text ) { // TODO: need to be able to retreive those from outside the sink - return "~, =, -, +, *, [, ], <, >, {, }, \\"; + return "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\"; } /** [EMAIL PROTECTED] */
