Author: carlos Date: Thu Apr 27 16:20:29 2006 New Revision: 397676 URL: http://svn.apache.org/viewcvs?rev=397676&view=rev Log: [DOXIA-59] Doxia creates files with inconsistent new lines. Use system line separator instead of \n
Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/SinkDescriptorReader.java maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java maven/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java maven/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/GenericListBlockParser.java Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.macro; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,17 +27,19 @@ public class EchoMacro extends AbstractMacro { + private static final String EOL = System.getProperty( "line.separator" ); + public void execute( Sink sink, MacroRequest request ) { sink.verbatim( true ); - sink.text( "echo\n" ); + sink.text( "echo" + EOL ); for ( Iterator i = request.getParameters().keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); - sink.text( key + " ---> " + request.getParameter( key ) + "\n" ); + sink.text( key + " ---> " + request.getParameter( key ) + EOL ); } sink.verbatim_(); Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.apt; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,8 @@ public class AptParser extends AbstractParser { + private static final String EOL = System.getProperty( "line.separator" ); + private static final int TITLE = 0; private static final int SECTION1 = 1; @@ -1279,7 +1281,7 @@ break; } - buffer.append( '\n' ); + buffer.append( EOL ); buffer.append( l ); AptParser.this.nextLine(); @@ -1383,7 +1385,7 @@ public void traverse() throws AptParseException { - StringTokenizer lines = new StringTokenizer( text, "\n" ); + StringTokenizer lines = new StringTokenizer( text, EOL ); int separator = -1; boolean firstLine = true; boolean title = false; @@ -1684,7 +1686,7 @@ buffer.append( c ); } } - buffer.append( '\n' ); + buffer.append( EOL ); AptParser.this.nextLine(); } Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.docbook; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ public class DocBookSink extends SinkAdapter { + private static final String EOL = System.getProperty( "line.separator" ); + public static final String DEFAULT_SGML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.1//EN"; public static final String DEFAULT_XML_PUBLIC_ID = "-//OASIS//DTD DocBook XML V4.1.2//EN"; @@ -326,11 +328,11 @@ { markup( " encoding=\"" + encoding + "\"" ); } - markup( " ?>\n" ); + markup( " ?>" + EOL ); if ( styleSheet != null ) { - markup( "<?xml-stylesheet type=\"text/css\"\n" + "href=\"" + styleSheet + "\" ?>\n" ); + markup( "<?xml-stylesheet type=\"text/css\"" + EOL + "href=\"" + styleSheet + "\" ?>" + EOL ); } } @@ -359,11 +361,11 @@ } if ( sysId == null ) { - markup( ">\n" ); + markup( ">" + EOL ); } else { - markup( "\n\"" + sysId + "\">\n" ); + markup( EOL + "\"" + sysId + "\">" + EOL ); } markup( "<article" ); @@ -371,21 +373,21 @@ { markup( " lang=\"" + lang + "\"" ); } - markup( ">\n" ); + markup( ">" + EOL ); } public void head_() { if ( hasTitle ) { - markup( "</articleinfo>\n" ); + markup( "</articleinfo>" + EOL ); hasTitle = false; } } public void title() { - markup( "<articleinfo>\n" ); + markup( "<articleinfo>" + EOL ); hasTitle = true; markup( "<title>" ); @@ -393,7 +395,7 @@ public void title_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void author() @@ -404,7 +406,7 @@ public void author_() { - markup( "</corpauthor>\n" ); + markup( "</corpauthor>" + EOL ); authorDateFlag = false; } @@ -416,65 +418,65 @@ public void date_() { - markup( "</date>\n" ); + markup( "</date>" + EOL ); authorDateFlag = false; } public void body_() { - markup( "</article>\n" ); + markup( "</article>" + EOL ); out.flush(); resetState(); } public void section1() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section1_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section2() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section2_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section3() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section3_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section4() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section4_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section5() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section5_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void sectionTitle() @@ -484,27 +486,27 @@ public void sectionTitle_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void list() { - markup( "<itemizedlist>\n" ); + markup( "<itemizedlist>" + EOL ); } public void list_() { - markup( "</itemizedlist>\n" ); + markup( "</itemizedlist>" + EOL ); } public void listItem() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void listItem_() { - markup( "</listitem>\n" ); + markup( "</listitem>" + EOL ); } public void numberedList( int numbering ) @@ -528,42 +530,42 @@ default: numeration = "arabic"; } - markup( "<orderedlist numeration=\"" + numeration + "\">\n" ); + markup( "<orderedlist numeration=\"" + numeration + "\">" + EOL ); } public void numberedList_() { - markup( "</orderedlist>\n" ); + markup( "</orderedlist>" + EOL ); } public void numberedListItem() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void numberedListItem_() { - markup( "</listitem>\n" ); + markup( "</listitem>" + EOL ); } public void definitionList() { - markup( "<variablelist>\n" ); + markup( "<variablelist>" + EOL ); } public void definitionList_() { - markup( "</variablelist>\n" ); + markup( "</variablelist>" + EOL ); } public void definitionListItem() { - markup( "<varlistentry>\n" ); + markup( "<varlistentry>" + EOL ); } public void definitionListItem_() { - markup( "</varlistentry>\n" ); + markup( "</varlistentry>" + EOL ); } public void definedTerm() @@ -573,17 +575,17 @@ public void definedTerm_() { - markup( "</term>\n" ); + markup( "</term>" + EOL ); } public void definition() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void definition_() { - markup( "</listitem>\n" ); + markup( "</listitem>" + EOL ); } public void paragraph() @@ -593,7 +595,7 @@ public void paragraph_() { - markup( "</para>\n" ); + markup( "</para>" + EOL ); } public void verbatim( boolean boxed ) @@ -604,18 +606,18 @@ public void verbatim_() { - markup( "</programlisting>\n" ); + markup( "</programlisting>" + EOL ); verbatimFlag = false; } public void horizontalRule() { - markup( horizontalRuleElement + '\n' ); + markup( horizontalRuleElement + EOL ); } public void pageBreak() { - markup( pageBreakElement + '\n' ); + markup( pageBreakElement + EOL ); } public void figure_() @@ -633,18 +635,18 @@ format = "JPEG"; } - markup( "<mediaobject>\n<imageobject>\n" ); + markup( "<mediaobject>" + EOL + "<imageobject>" + EOL ); markup( - "<imagedata format=\"" + format + "\"\nfileref=\"" + escapeSGML( graphicsFileName, xmlMode ) + '\"' ); + "<imagedata format=\"" + format + "\"" + EOL + "fileref=\"" + escapeSGML( graphicsFileName, xmlMode ) + '\"' ); if ( xmlMode ) { - markup( "/>\n" ); + markup( "/>" + EOL ); } else { - markup( ">\n" ); + markup( ">" + EOL ); } - markup( "</imageobject>\n</mediaobject>\n" ); + markup( "</imageobject>" + EOL + "</mediaobject>" + EOL ); graphicsFileName = null; } } @@ -656,15 +658,15 @@ public void figureCaption() { - markup( "<figure>\n" ); + markup( "<figure>" + EOL ); markup( "<title>" ); } public void figureCaption_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); graphicElement(); - markup( "</figure>\n" ); + markup( "</figure>" + EOL ); } public void table() @@ -680,7 +682,7 @@ // Formal table+title already written to original destination --- out.write( tableRows, /*preserveSpace*/ true ); - markup( "</table>\n" ); + markup( "</table>" + EOL ); } else { @@ -697,9 +699,9 @@ sep = 0; } - markup( "<informaltable frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" ); + markup( "<informaltable frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">" + EOL ); out.write( tableRows, /*preserveSpace*/ true ); - markup( "</informaltable>\n" ); + markup( "</informaltable>" + EOL ); } tableRows = null; @@ -716,7 +718,7 @@ savedOut = out; out = new LineBreaker( new StringWriter() ); - markup( "<tgroup cols=\"" + justification.length + "\">\n" ); + markup( "<tgroup cols=\"" + justification.length + "\">" + EOL ); for ( int i = 0; i < justification.length; ++i ) { String justif; @@ -736,21 +738,21 @@ markup( "<colspec align=\"" + justif + "\"" ); if ( xmlMode ) { - markup( "/>\n" ); + markup( "/>" + EOL ); } else { - markup( ">\n" ); + markup( ">" + EOL ); } } - markup( "<tbody>\n" ); + markup( "<tbody>" + EOL ); } public void tableRows_() { - markup( "</tbody>\n" ); - markup( "</tgroup>\n" ); + markup( "</tbody>" + EOL ); + markup( "</tgroup>" + EOL ); // Remember diverted output and restore original destination --- out.flush(); @@ -760,12 +762,12 @@ public void tableRow() { - markup( "<row>\n" ); + markup( "<row>" + EOL ); } public void tableRow_() { - markup( "</row>\n" ); + markup( "</row>" + EOL ); } public void tableCell() @@ -775,7 +777,7 @@ public void tableCell_() { - markup( "</para></entry>\n" ); + markup( "</para></entry>" + EOL ); } public void tableCaption() @@ -795,13 +797,13 @@ sep = 0; } - markup( "<table frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" ); + markup( "<table frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">" + EOL ); markup( "<title>" ); } public void tableCaption_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void anchor( String name ) @@ -886,7 +888,7 @@ public void lineBreak() { - markup( lineBreakElement + '\n' ); + markup( lineBreakElement + EOL ); } public void nonBreakingSpace() Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.latex; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,8 @@ public class LatexSink extends SinkAdapter { + private static final String EOL = System.getProperty( "line.separator" ); + private LineBreaker out; private String preamble; @@ -86,7 +88,7 @@ cellCount = 0; markup( preamble ); - markup( "\\begin{document}\n\n" ); + markup( "\\begin{document}" + EOL + EOL ); } public void body() @@ -94,13 +96,13 @@ if ( titleFlag ) { titleFlag = false; - markup( "\\pmaketitle\n\n" ); + markup( "\\pmaketitle" + EOL + EOL ); } } public void body_() { - markup( "\\end{document}\n\n" ); + markup( "\\end{document}" + EOL + EOL ); out.flush(); } @@ -131,12 +133,12 @@ public void list() { - markup( "\\begin{plist}\n\n" ); + markup( "\\begin{plist}" + EOL + EOL ); } public void list_() { - markup( "\\end{plist}\n\n" ); + markup( "\\end{plist}" + EOL + EOL ); } public void listItem() @@ -185,13 +187,13 @@ style = "arabic"; } - markup( "\\begin{pnumberedlist}\n" ); - markup( "\\renewcommand{\\the" + counter + "}{\\" + style + "{" + counter + "}}\n\n" ); + markup( "\\begin{pnumberedlist}" + EOL ); + markup( "\\renewcommand{\\the" + counter + "}{\\" + style + "{" + counter + "}}" + EOL + EOL ); } public void numberedList_() { - markup( "\\end{pnumberedlist}\n\n" ); + markup( "\\end{pnumberedlist}" + EOL + EOL ); --numberedListNesting; } @@ -202,35 +204,35 @@ public void definitionList() { - markup( "\\begin{pdefinitionlist}\n\n" ); + markup( "\\begin{pdefinitionlist}" + EOL + EOL ); } public void definitionList_() { - markup( "\\end{pdefinitionlist}\n\n" ); + markup( "\\end{pdefinitionlist}" + EOL + EOL ); } public void figure() { figureFlag = true; - markup( "\\begin{pfigure}\n" ); + markup( "\\begin{pfigure}" + EOL ); } public void figure_() { - markup( "\\end{pfigure}\n\n" ); + markup( "\\end{pfigure}" + EOL + EOL ); figureFlag = false; } public void table() { tableFlag = true; - markup( "\\begin{ptable}\n" ); + markup( "\\begin{ptable}" + EOL ); } public void table_() { - markup( "\\end{ptable}\n\n" ); + markup( "\\end{ptable}" + EOL + EOL ); tableFlag = false; } @@ -262,10 +264,10 @@ justif.append( '|' ); } - markup( "\\begin{ptablerows}{" + justif.toString() + "}\n" ); + markup( "\\begin{ptablerows}{" + justif.toString() + "}" + EOL ); if ( grid ) { - markup( "\\hline\n" ); + markup( "\\hline" + EOL ); } gridFlag = grid; cellJustif = justification; @@ -273,7 +275,7 @@ public void tableRows_() { - markup( "\\end{ptablerows}\n" ); + markup( "\\end{ptablerows}" + EOL ); gridFlag = false; cellJustif = null; } @@ -285,10 +287,10 @@ public void tableRow_() { - markup( "\\\\\n" ); + markup( "\\\\" + EOL ); if ( gridFlag ) { - markup( "\\hline\n" ); + markup( "\\hline" + EOL ); } cellCount = 0; } @@ -301,7 +303,7 @@ public void title_() { - markup( "}\n" ); + markup( "}" + EOL ); } public void author() @@ -311,7 +313,7 @@ public void author_() { - markup( "}\n" ); + markup( "}" + EOL ); } public void date() @@ -321,30 +323,30 @@ public void date_() { - markup( "}\n" ); + markup( "}" + EOL ); } public void sectionTitle_() { - markup( "}\n\n" ); + markup( "}" + EOL + EOL ); } public void paragraph_() { - markup( "\n\n" ); + markup( EOL + EOL ); } public void verbatim( boolean boxed ) { if ( boxed ) { - markup( "\\begin{pverbatimbox}\n" ); + markup( "\\begin{pverbatimbox}" + EOL ); } else { - markup( "\\begin{pverbatim}\n" ); + markup( "\\begin{pverbatim}" + EOL ); } - markup( "\\begin{verbatim}\n" ); + markup( "\\begin{verbatim}" + EOL ); verbatimFlag = true; boxFlag = boxed; @@ -352,14 +354,14 @@ public void verbatim_() { - markup( "\n\\end{verbatim}\n" ); + markup( EOL + "\\end{verbatim}" + EOL ); if ( boxFlag ) { - markup( "\\end{pverbatimbox}\n\n" ); + markup( "\\end{pverbatimbox}" + EOL + EOL ); } else { - markup( "\\end{pverbatim}\n\n" ); + markup( "\\end{pverbatim}" + EOL + EOL ); } verbatimFlag = false; @@ -383,14 +385,14 @@ public void figureCaption_() { - markup( "}\n" ); + markup( "}" + EOL ); } public void tableCell() { if ( cellCount > 0 ) { - markup( " &\n" ); + markup( " &" + EOL ); } char justif; @@ -423,22 +425,22 @@ public void tableCaption_() { - markup( "}\n" ); + markup( "}" + EOL ); } public void figureGraphics( String name ) { - markup( "\\pfiguregraphics{" + name + "}\n" ); + markup( "\\pfiguregraphics{" + name + "}" + EOL ); } public void horizontalRule() { - markup( "\\phorizontalrule\n\n" ); + markup( "\\phorizontalrule" + EOL + EOL ); } public void pageBreak() { - markup( "\\newpage\n\n" ); + markup( "\\newpage" + EOL + EOL ); } public void anchor( String name ) @@ -493,7 +495,7 @@ public void lineBreak() { - markup( ( figureFlag || tableFlag || titleFlag ) ? "\\\\\n" : "\\newline\n" ); + markup( ( figureFlag || tableFlag || titleFlag ) ? "\\\\" + EOL : "\\newline" + EOL ); } public void nonBreakingSpace() @@ -590,42 +592,55 @@ // ----------------------------------------------------------------------- - private static final String defaultPreamble = "\\newcommand{\\ptitle}[1]{\\title{#1}}\n" + - "\\newcommand{\\pauthor}[1]{\\author{#1}}\n" + "\\newcommand{\\pdate}[1]{\\date{#1}}\n" + - "\\newcommand{\\pmaketitle}{\\maketitle}\n" + "\\newcommand{\\psectioni}[1]{\\section{#1}}\n" + - "\\newcommand{\\psectionii}[1]{\\subsection{#1}}\n" + "\\newcommand{\\psectioniii}[1]{\\subsubsection{#1}}\n" + - "\\newcommand{\\psectioniv}[1]{\\paragraph{#1}}\n" + "\\newcommand{\\psectionv}[1]{\\subparagraph{#1}}\n" + - "\\newenvironment{plist}{\\begin{itemize}}{\\end{itemize}}\n" + - "\\newenvironment{pnumberedlist}{\\begin{enumerate}}{\\end{enumerate}}\n" + - "\\newcommand{\\pdef}[1]{\\textbf{#1}\\hfill}\n" + "\\newenvironment{pdefinitionlist}\n" + - "{\\begin{list}{}{\\settowidth{\\labelwidth}{\\textbf{999.}}\n" + - " \\setlength{\\leftmargin}{\\labelwidth}\n" + - " \\addtolength{\\leftmargin}{\\labelsep}\n" + - " \\renewcommand{\\makelabel}{\\pdef}}}\n" + "{\\end{list}}\n" + - "\\newenvironment{pfigure}{\\begin{center}}{\\end{center}}\n" + - "\\newcommand{\\pfiguregraphics}[1]{\\includegraphics{#1.eps}}\n" + - "\\newcommand{\\pfigurecaption}[1]{\\\\ \\vspace{\\pparskipamount}\n" + - " \\textit{#1}}\n" + - "\\newenvironment{ptable}{\\begin{center}}{\\end{center}}\n" + - "\\newenvironment{ptablerows}[1]{\\begin{tabular}{#1}}{\\end{tabular}}\n" + - "\\newenvironment{pcell}[1]{\\begin{tabular}[t]{#1}}{\\end{tabular}}\n" + - "\\newcommand{\\ptablecaption}[1]{\\\\ \\vspace{\\pparskipamount}\n" + - " \\textit{#1}}\n" + - "\\newenvironment{pverbatim}{\\begin{small}}{\\end{small}}\n" + "\\newsavebox{\\pbox}\n" + - "\\newenvironment{pverbatimbox}\n" + "{\\begin{lrbox}{\\pbox}\\begin{minipage}{\\linewidth}\\begin{small}}\n" + - "{\\end{small}\\end{minipage}\\end{lrbox}\\fbox{\\usebox{\\pbox}}}\n" + - "\\newcommand{\\phorizontalrule}{\\begin{center}\n" + - " \\rule[0.5ex]{\\linewidth}{1pt}\n" + - " \\end{center}}\n" + - "\\newcommand{\\panchor}[1]{\\textcolor{panchorcolor}{#1}}\n" + - "\\newcommand{\\plink}[1]{\\textcolor{plinkcolor}{#1}}\n" + "\\newcommand{\\pitalic}[1]{\\textit{#1}}\n" + - "\\newcommand{\\pbold}[1]{\\textbf{#1}}\n" + "\\newcommand{\\pmonospaced}[1]{\\texttt{\\small #1}}\n\n" + - "\\documentclass[a4paper]{article}\n" + "\\usepackage{a4wide}\n" + "\\usepackage{color}\n" + - "\\usepackage{graphics}\n" + "\\usepackage{times}\n" + "\\usepackage[latin1]{inputenc}\n" + - "\\usepackage[T1]{fontenc}\n\n" + "\\pagestyle{plain}\n\n" + "\\definecolor{plinkcolor}{rgb}{0,0,0.54}\n" + - "\\definecolor{panchorcolor}{rgb}{0.54,0,0}\n\n" + "\\newlength{\\pparskipamount}\n" + - "\\setlength{\\pparskipamount}{1ex}\n" + "\\setlength{\\parindent}{0pt}\n" + - "\\setlength{\\parskip}{\\pparskipamount}\n\n"; + private static final String defaultPreamble = "\\newcommand{\\ptitle}[1]{\\title{#1}}" + EOL + + "\\newcommand{\\pauthor}[1]{\\author{#1}}" + EOL + + "\\newcommand{\\pdate}[1]{\\date{#1}}" + EOL + + "\\newcommand{\\pmaketitle}{\\maketitle}" + EOL + + "\\newcommand{\\psectioni}[1]{\\section{#1}}" + EOL + + "\\newcommand{\\psectionii}[1]{\\subsection{#1}}" + EOL + + "\\newcommand{\\psectioniii}[1]{\\subsubsection{#1}}" + EOL + + "\\newcommand{\\psectioniv}[1]{\\paragraph{#1}}" + EOL + + "\\newcommand{\\psectionv}[1]{\\subparagraph{#1}}" + EOL + + "\\newenvironment{plist}{\\begin{itemize}}{\\end{itemize}}" + EOL + + "\\newenvironment{pnumberedlist}{\\begin{enumerate}}{\\end{enumerate}}" + EOL + + "\\newcommand{\\pdef}[1]{\\textbf{#1}\\hfill}" + EOL + + "\\newenvironment{pdefinitionlist}" + EOL + + "{\\begin{list}{}{\\settowidth{\\labelwidth}{\\textbf{999.}}" + EOL + + " \\setlength{\\leftmargin}{\\labelwidth}" + EOL + + " \\addtolength{\\leftmargin}{\\labelsep}" + EOL + + " \\renewcommand{\\makelabel}{\\pdef}}}" + EOL + "{\\end{list}}" + EOL + + "\\newenvironment{pfigure}{\\begin{center}}{\\end{center}}" + EOL + + "\\newcommand{\\pfiguregraphics}[1]{\\includegraphics{#1.eps}}" + EOL + + "\\newcommand{\\pfigurecaption}[1]{\\\\ \\vspace{\\pparskipamount}" + EOL + + " \\textit{#1}}" + EOL + + "\\newenvironment{ptable}{\\begin{center}}{\\end{center}}" + EOL + + "\\newenvironment{ptablerows}[1]{\\begin{tabular}{#1}}{\\end{tabular}}" + EOL + + "\\newenvironment{pcell}[1]{\\begin{tabular}[t]{#1}}{\\end{tabular}}" + EOL + + "\\newcommand{\\ptablecaption}[1]{\\\\ \\vspace{\\pparskipamount}" + EOL + + " \\textit{#1}}" + EOL + + "\\newenvironment{pverbatim}{\\begin{small}}{\\end{small}}" + EOL + "\\newsavebox{\\pbox}" + EOL + + "\\newenvironment{pverbatimbox}" + EOL + "{\\begin{lrbox}{\\pbox}\\begin{minipage}{\\linewidth}\\begin{small}}" + EOL + + "{\\end{small}\\end{minipage}\\end{lrbox}\\fbox{\\usebox{\\pbox}}}" + EOL + + "\\newcommand{\\phorizontalrule}{\\begin{center}" + EOL + + " \\rule[0.5ex]{\\linewidth}{1pt}" + EOL + + " \\end{center}}" + EOL + + "\\newcommand{\\panchor}[1]{\\textcolor{panchorcolor}{#1}}" + EOL + + "\\newcommand{\\plink}[1]{\\textcolor{plinkcolor}{#1}}" + EOL + "\\newcommand{\\pitalic}[1]{\\textit{#1}}" + EOL + + "\\newcommand{\\pbold}[1]{\\textbf{#1}}" + EOL + + "\\newcommand{\\pmonospaced}[1]{\\texttt{\\small #1}}" + EOL + EOL + + "\\documentclass[a4paper]{article}" + EOL + "\\usepackage{a4wide}" + EOL + + "\\usepackage{color}" + EOL + + "\\usepackage{graphics}" + EOL + + "\\usepackage{times}" + EOL + + "\\usepackage[latin1]{inputenc}" + EOL + + "\\usepackage[T1]{fontenc}" + EOL + EOL + + "\\pagestyle{plain}" + EOL + EOL + + "\\definecolor{plinkcolor}{rgb}{0,0,0.54}" + EOL + + "\\definecolor{panchorcolor}{rgb}{0.54,0,0}" + EOL + EOL + + "\\newlength{\\pparskipamount}" + EOL + + "\\setlength{\\pparskipamount}{1ex}" + EOL + + "\\setlength{\\parindent}{0pt}" + EOL + + "\\setlength{\\parskip}{\\pparskipamount}" + EOL + EOL; // ----------------------------------------------------------------------- Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.rtf; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,8 @@ public class RtfSink extends SinkAdapter { + private static final String EOL = System.getProperty( "line.separator" ); + public static final double DEFAULT_PAPER_WIDTH = 21.; /*cm*/ public static final double DEFAULT_PAPER_HEIGHT = 29.7; /*cm*/ @@ -931,11 +933,11 @@ beginParagraph( paragraph ); - StringTokenizer t = new StringTokenizer( text, "\n", true ); + StringTokenizer t = new StringTokenizer( text, EOL, true ); while ( t.hasMoreTokens() ) { String s = t.nextToken(); - if ( s.equals( "\n" ) && t.hasMoreTokens() ) + if ( s.equals( EOL ) && t.hasMoreTokens() ) { writer.println( "\\line" ); } @@ -1334,11 +1336,11 @@ break; case CONTEXT_TABLE: - StringTokenizer t = new StringTokenizer( text, "\n", true ); + StringTokenizer t = new StringTokenizer( text, EOL, true ); while ( t.hasMoreTokens() ) { String token = t.nextToken(); - if ( token.equals( "\n" ) ) + if ( token.equals( EOL ) ) { cell.add( line ); line = new Line(); @@ -1444,7 +1446,7 @@ private static int textWidth( String text, Font font ) { int width = 0; - StringTokenizer t = new StringTokenizer( text, "\n" ); + StringTokenizer t = new StringTokenizer( text, EOL ); while ( t.hasMoreTokens() ) { Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.xdoc; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,8 @@ public class XdocSink extends SinkAdapter { + private static final String EOL = System.getProperty( "line.separator" ); + private LineBreaker out; private StringBuffer buffer = new StringBuffer(); @@ -74,18 +76,18 @@ headFlag = true; - markup( "<?xml version=\"1.0\" ?>\n" ); + markup( "<?xml version=\"1.0\" ?>" + EOL ); - markup( "<document>\n" ); + markup( "<document>" + EOL ); - markup( "<properties>\n" ); + markup( "<properties>" + EOL ); } public void head_() { headFlag = false; - markup( "</properties>\n" ); + markup( "</properties>" + EOL ); } public void title_() @@ -94,7 +96,7 @@ { markup( "<title>" ); content( buffer.toString() ); - markup( "</title>\n" ); + markup( "</title>" + EOL ); buffer = new StringBuffer(); } } @@ -105,7 +107,7 @@ { markup( "<author>" ); content( buffer.toString() ); - markup( "</author>\n" ); + markup( "</author>" + EOL ); buffer = new StringBuffer(); } } @@ -123,14 +125,14 @@ public void body() { - markup( "<body>\n" ); + markup( "<body>" + EOL ); } public void body_() { - markup( "</body>\n" ); + markup( "</body>" + EOL ); - markup( "</document>\n" ); + markup( "</document>" + EOL ); out.flush(); @@ -199,7 +201,7 @@ public void list() { - markup( "<ul>\n" ); + markup( "<ul>" + EOL ); } public void list_() @@ -216,7 +218,7 @@ public void listItem_() { - markup( "</li>\n" ); + markup( "</li>" + EOL ); } public void numberedList( int numbering ) @@ -240,7 +242,7 @@ default: style = "decimal"; } - markup( "<ol style=\"list-style-type: " + style + "\">\n" ); + markup( "<ol style=\"list-style-type: " + style + "\">" + EOL ); } public void numberedList_() @@ -257,12 +259,12 @@ public void numberedListItem_() { - markup( "</li>\n" ); + markup( "</li>" + EOL ); } public void definitionList() { - markup( "<dl compact=\"compact\">\n" ); + markup( "<dl compact=\"compact\">" + EOL ); } public void definitionList_() @@ -277,7 +279,7 @@ public void definedTerm_() { - markup( "</b></dt>\n" ); + markup( "</b></dt>" + EOL ); } public void definition() @@ -289,7 +291,7 @@ public void definition_() { - markup( "</dd>\n" ); + markup( "</dd>" + EOL ); } public void paragraph() @@ -350,7 +352,7 @@ public void table() { - markup( "<table align=\"center\">\n" ); + markup( "<table align=\"center\">" + EOL ); } public void table_() @@ -361,7 +363,7 @@ public void tableRows( int[] justification, boolean grid ) { - markup( "<table align=\"center\" border=\"" + ( grid ? 1 : 0 ) + "\">\n" ); + markup( "<table align=\"center\" border=\"" + ( grid ? 1 : 0 ) + "\">" + EOL ); this.cellJustif = justification; } @@ -372,13 +374,13 @@ public void tableRow() { - markup( "<tr valign=\"top\">\n" ); + markup( "<tr valign=\"top\">" + EOL ); cellCount = 0; } public void tableRow_() { - markup( "</tr>\n" ); + markup( "</tr>" + EOL ); cellCount = 0; } @@ -435,7 +437,7 @@ public void tableCell_( boolean headerRow ) { - markup( "</t" + ( headerRow ? 'h' : 'd' ) + ">\n" ); + markup( "</t" + ( headerRow ? 'h' : 'd' ) + ">" + EOL ); ++cellCount; } @@ -534,7 +536,7 @@ { if ( headFlag ) { - buffer.append( '\n' ); + buffer.append( EOL ); } else { Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/SinkDescriptorReader.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/SinkDescriptorReader.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/SinkDescriptorReader.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/SinkDescriptorReader.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.xhtml; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,8 @@ */ public class SinkDescriptorReader { + private static final String EOL = System.getProperty( "line.separator" ); + public Map read( Reader reader ) throws IOException { @@ -90,12 +92,12 @@ } else { - directiveBody.append( line ).append( "\n" ); + directiveBody.append( line ).append( EOL ); } } else { - directiveBody.append( line ).append( "\n" ); + directiveBody.append( line ).append( EOL ); } } Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.xhtml; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.StructureSink; -import org.apache.maven.doxia.util.StringUtil; import org.codehaus.plexus.util.StringUtils; import java.io.PrintWriter; @@ -36,6 +35,8 @@ public class XhtmlSink extends AbstractXhtmlSink { + private static final String EOL = System.getProperty( "line.separator" ); + private StringBuffer buffer = new StringBuffer(); private boolean headFlag; @@ -127,7 +128,7 @@ { write( "<meta name=\"author\" content=\"" ); write( buffer.toString() ); - write( "\" />\n" ); + write( "\" />" + EOL ); resetBuffer(); } } @@ -138,7 +139,7 @@ { write( "<meta name=\"date\" content=\"" ); write( buffer.toString() ); - write( "\" />\n" ); + write( "\" />" + EOL ); resetBuffer(); } } @@ -724,7 +725,7 @@ { if ( headFlag ) { - buffer.append( '\n' ); + buffer.append( EOL ); } else { Modified: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.confluence.parser.list; /* -* Copyright 2004-2005 The Apache Software Foundation. +* Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ */ public class TreeComponent { + private static final String EOL = System.getProperty( "line.separator" ); + private List children = new ArrayList(); private String text; @@ -93,7 +95,7 @@ sb.append( indent ); sb.append( "- " ); sb.append( text ); - sb.append( '\n' ); + sb.append( EOL ); } for ( Iterator i = children.iterator(); i.hasNext(); ) Modified: maven/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java Thu Apr 27 16:20:29 2006 @@ -1,7 +1,7 @@ package org.apache.maven.doxia.module.docbook; /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ public class DocBookSink extends SinkAdapter { + private static final String EOL = System.getProperty( "line.separator" ); + public static final String DEFAULT_SGML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.1//EN"; public static final String DEFAULT_XML_PUBLIC_ID = "-//OASIS//DTD DocBook XML V4.1.2//EN"; @@ -330,7 +332,7 @@ if ( styleSheet != null ) { - markup( "<?xml-stylesheet type=\"text/css\"\n" + "href=\"" + styleSheet + "\" ?>\n" ); + markup( "<?xml-stylesheet type=\"text/css\"" + EOL + "href=\"" + styleSheet + "\" ?>" + EOL ); } } @@ -359,11 +361,11 @@ } if ( sysId == null ) { - markup( ">\n" ); + markup( ">" + EOL ); } else { - markup( "\n\"" + sysId + "\">\n" ); + markup( EOL + "\"" + sysId + "\">" + EOL ); } markup( "<article" ); @@ -371,21 +373,21 @@ { markup( " lang=\"" + lang + "\"" ); } - markup( ">\n" ); + markup( ">" + EOL ); } public void head_() { if ( hasTitle ) { - markup( "</articleinfo>\n" ); + markup( "</articleinfo>" + EOL ); hasTitle = false; } } public void title() { - markup( "<articleinfo>\n" ); + markup( "<articleinfo>" + EOL ); hasTitle = true; markup( "<title>" ); @@ -393,7 +395,7 @@ public void title_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void author() @@ -404,7 +406,7 @@ public void author_() { - markup( "</corpauthor>\n" ); + markup( "</corpauthor>" + EOL ); authorDateFlag = false; } @@ -416,65 +418,65 @@ public void date_() { - markup( "</date>\n" ); + markup( "</date>" + EOL ); authorDateFlag = false; } public void body_() { - markup( "</article>\n" ); + markup( "</article>" + EOL ); out.flush(); resetState(); } public void section1() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section1_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section2() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section2_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section3() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section3_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section4() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section4_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void section5() { - markup( "<section>\n" ); + markup( "<section>" + EOL ); } public void section5_() { - markup( "</section>\n" ); + markup( "</section>" + EOL ); } public void sectionTitle() @@ -484,27 +486,27 @@ public void sectionTitle_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void list() { - markup( "<itemizedlist>\n" ); + markup( "<itemizedlist>" + EOL ); } public void list_() { - markup( "</itemizedlist>\n" ); + markup( "</itemizedlist>" + EOL ); } public void listItem() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void listItem_() { - markup( "</listitem>\n" ); + markup( "</listitem>" + EOL ); } public void numberedList( int numbering ) @@ -528,42 +530,42 @@ default: numeration = "arabic"; } - markup( "<orderedlist numeration=\"" + numeration + "\">\n" ); + markup( "<orderedlist numeration=\"" + numeration + "\">" + EOL ); } public void numberedList_() { - markup( "</orderedlist>\n" ); + markup( "</orderedlist>" + EOL ); } public void numberedListItem() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void numberedListItem_() { - markup( "</listitem>\n" ); + markup( "</listitem>" + EOL ); } public void definitionList() { - markup( "<variablelist>\n" ); + markup( "<variablelist>" + EOL ); } public void definitionList_() { - markup( "</variablelist>\n" ); + markup( "</variablelist>" + EOL ); } public void definitionListItem() { - markup( "<varlistentry>\n" ); + markup( "<varlistentry>" + EOL ); } public void definitionListItem_() { - markup( "</varlistentry>\n" ); + markup( "</varlistentry>" + EOL ); } public void definedTerm() @@ -573,17 +575,17 @@ public void definedTerm_() { - markup( "</term>\n" ); + markup( "</term>" + EOL ); } public void definition() { - markup( "<listitem>\n" ); + markup( "<listitem>" + EOL ); } public void definition_() { - markup( "</listitem>\n" ); + markup( "</listitem>"+ EOL); } public void paragraph() @@ -593,7 +595,7 @@ public void paragraph_() { - markup( "</para>\n" ); + markup( "</para>" + EOL ); } public void verbatim( boolean boxed ) @@ -604,18 +606,18 @@ public void verbatim_() { - markup( "</programlisting>\n" ); + markup( "</programlisting>" + EOL ); verbatimFlag = false; } public void horizontalRule() { - markup( horizontalRuleElement + '\n' ); + markup( horizontalRuleElement + EOL ); } public void pageBreak() { - markup( pageBreakElement + '\n' ); + markup( pageBreakElement + EOL ); } public void figure_() @@ -633,18 +635,18 @@ format = "JPEG"; } - markup( "<mediaobject>\n<imageobject>\n" ); + markup( "<mediaobject>" + EOL + "<imageobject>" + EOL ); markup( - "<imagedata format=\"" + format + "\"\nfileref=\"" + escapeSGML( graphicsFileName, xmlMode ) + '\"' ); + "<imagedata format=\"" + format + "\"" + EOL + "fileref=\"" + escapeSGML( graphicsFileName, xmlMode ) + '\"' ); if ( xmlMode ) { - markup( "/>\n" ); + markup( "/>" + EOL ); } else { - markup( ">\n" ); + markup( ">" + EOL ); } - markup( "</imageobject>\n</mediaobject>\n" ); + markup( "</imageobject>" + EOL + "</mediaobject>" + EOL ); graphicsFileName = null; } } @@ -656,15 +658,15 @@ public void figureCaption() { - markup( "<figure>\n" ); + markup( "<figure>" + EOL ); markup( "<title>" ); } public void figureCaption_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); graphicElement(); - markup( "</figure>\n" ); + markup( "</figure>" + EOL ); } public void table() @@ -680,7 +682,7 @@ // Formal table+title already written to original destination --- out.write( tableRows, /*preserveSpace*/ true ); - markup( "</table>\n" ); + markup( "</table>" + EOL ); } else { @@ -697,9 +699,9 @@ sep = 0; } - markup( "<informaltable frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" ); + markup( "<informaltable frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">" + EOL ); out.write( tableRows, /*preserveSpace*/ true ); - markup( "</informaltable>\n" ); + markup( "</informaltable>" + EOL ); } tableRows = null; @@ -716,7 +718,7 @@ savedOut = out; out = new LineBreaker( new StringWriter() ); - markup( "<tgroup cols=\"" + justification.length + "\">\n" ); + markup( "<tgroup cols=\"" + justification.length + "\">" + EOL ); for ( int i = 0; i < justification.length; ++i ) { String justif; @@ -736,21 +738,21 @@ markup( "<colspec align=\"" + justif + "\"" ); if ( xmlMode ) { - markup( "/>\n" ); + markup( "/>" + EOL ); } else { - markup( ">\n" ); + markup( ">" + EOL ); } } - markup( "<tbody>\n" ); + markup( "<tbody>" + EOL ); } public void tableRows_() { - markup( "</tbody>\n" ); - markup( "</tgroup>\n" ); + markup( "</tbody>" + EOL ); + markup( "</tgroup>" + EOL ); // Remember diverted output and restore original destination --- out.flush(); @@ -760,12 +762,12 @@ public void tableRow() { - markup( "<row>\n" ); + markup( "<row>" + EOL ); } public void tableRow_() { - markup( "</row>\n" ); + markup( "</row>" + EOL ); } public void tableCell() @@ -775,7 +777,7 @@ public void tableCell_() { - markup( "</para></entry>\n" ); + markup( "</para></entry>" + EOL ); } public void tableCaption() @@ -795,13 +797,13 @@ sep = 0; } - markup( "<table frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" ); + markup( "<table frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">" + EOL ); markup( "<title>" ); } public void tableCaption_() { - markup( "</title>\n" ); + markup( "</title>" + EOL ); } public void anchor( String name ) @@ -886,7 +888,7 @@ public void lineBreak() { - markup( lineBreakElement + '\n' ); + markup( lineBreakElement + EOL ); } public void nonBreakingSpace() Modified: maven/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/GenericListBlockParser.java URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/GenericListBlockParser.java?rev=397676&r1=397675&r2=397676&view=diff ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/GenericListBlockParser.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/GenericListBlockParser.java Thu Apr 27 16:20:29 2006 @@ -1,3 +1,5 @@ +package org.apache.maven.doxia.module.twiki.parser; + /* * Copyright 2005 Zauber <info /at/ zauber dot com dot ar> * @@ -13,7 +15,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.maven.doxia.module.twiki.parser; + +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import org.apache.maven.doxia.module.common.ByLineSource; import org.apache.maven.doxia.parser.ParseException; @@ -25,7 +42,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; - /** * Generic list parser * @@ -34,6 +50,8 @@ */ public class GenericListBlockParser implements BlockParser { + static final String EOL = System.getProperty( "line.separator" ); + /** * parser used to create text blocks */ @@ -538,7 +556,7 @@ sb.append( indent ); sb.append( "- " ); sb.append( text ); - sb.append( '\n' ); + sb.append( GenericListBlockParser.EOL ); } for ( Iterator it = children.iterator(); it.hasNext(); ) {