------------------------------------------------------------------------ r13 | christian | 2007-11-06 17:26:43 -0300 (Tue, 06 Nov 2007) | 2 lines (=Something=) was not being parsed correctly. Bug fixed ------------------------------------------------------------------------ Index: doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java =================================================================== --- doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java (revision 12) +++ doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java (revision 13) @@ -111,14 +111,16 @@ String text; Block []blocks; - text = "mary =has= a =little= lamb"; + text = "mary =has= a =little= lamb He followed her (=to school one day=)"; blocks = formatTextParser.parse( text ); assertTrue( Arrays.equals( new Block[]{ new TextBlock( "mary " ), new MonospaceBlock( new Block[]{new TextBlock( "has" )} ), new TextBlock( " a " ), new MonospaceBlock( new Block[]{new TextBlock( "little" )} ), - new TextBlock( " lamb" ), + new TextBlock( " lamb He followed her (" ), + new MonospaceBlock( new Block[]{new TextBlock( "to school one day" )} ), + new TextBlock( ")" ), }, blocks ) ); } Index: doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextParser.java =================================================================== --- doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextParser.java (revision 12) +++ doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextParser.java (revision 13) @@ -174,7 +174,8 @@ while ( t != -1 && ( t = line.indexOf( SPECIAL_CHAR[i], t ) ) != -1 ) { // and check if it at the begining of a word. - if ( t == 0 || isSpace( line.charAt( t - 1 ) ) ) + if ( t == 0 || isSpace( line.charAt( t - 1 ) ) + || isParenthesis( line.charAt( t - 1 ) ) ) { // if it is, and if, check to avoid going beyond the string if ( t + specialLen < line.length() ) @@ -270,6 +271,14 @@ } /** + * @param c character to test + * @return true if c is a parenthesis + */ + private boolean isParenthesis( final char c ) { + return c == '(' || c == ')'; + } + + /** * Sets the formatTextParser. * * @param textParser text parser to use