maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r591736 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src: main/java/org/apache/maven/doxia/module/confluence/parser/ test/java/org/apache/maven/doxia/module/confluence/ test/resources/
Date Sun, 04 Nov 2007 07:19:49 GMT
Author: ltheussl
Date: Sun Nov  4 00:19:48 2007
New Revision: 591736

URL: http://svn.apache.org/viewvc?rev=591736&view=rev
Log:
[DOXIA-180] remove leading # from link
Submitted by: Dave Syer

Added:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/resources/link.confluence
Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ChildBlocksBuilder.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ChildBlocksBuilder.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ChildBlocksBuilder.java?rev=591736&r1=591735&r2=591736&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ChildBlocksBuilder.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ChildBlocksBuilder.java
Sun Nov  4 00:19:48 2007
@@ -99,11 +99,19 @@
                         if ( link.indexOf( "|" ) > 0 )
                         {
                             String[] pieces = StringUtils.split( text.toString(), "|" );
+
                             blocks.add( new LinkBlock( pieces[1], pieces[0] ) );
                         }
                         else
                         {
-                            blocks.add( new LinkBlock( link, link ) );
+                            String value = link;
+
+                            if ( link.startsWith( "#" ) )
+                            {
+                                value = link.substring( 1 );
+                            }
+
+                            blocks.add( new LinkBlock( link, value ) );
                         }
 
                         text = new StringBuffer();

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java?rev=591736&r1=591735&r2=591736&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
Sun Nov  4 00:19:48 2007
@@ -230,6 +230,23 @@
         assertEquals( 3, result.split( "end:paragraph\n" ).length );
     }
 
+    /** @throws Exception */
+    public void testLink()
+        throws Exception
+    {
+        String result = locateAndParseTestSourceFile( "link" );
+
+        assertContainsLines( result, "begin:link, name: middle\ntext: middle\nend:link" );
+        assertContainsLines( result, "begin:link, name: end\ntext: end\nend:link" );
+        assertContainsLines( result, "begin:link, name: link\ntext: alias\nend:link" );
+        assertContainsLines( result, "begin:link, name: link#anchor\ntext: link#anchor\nend:link"
);
+        assertContainsLines( result, "begin:link, name: #simple\ntext: simple\nend:link"
);
+        // 3 paragraphs in the input...
+        assertEquals( 4, result.split( "end:paragraph\n" ).length );
+        // 5 links in the input...
+        assertEquals( 6, result.split( "end:link\n" ).length );
+    }
+
     private void assertContainsLines( String message, String result, String lines )
     {
         lines = StringUtils.replace( lines, "\n", EOL );

Added: maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/resources/link.confluence
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/resources/link.confluence?rev=591736&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/resources/link.confluence
(added)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/resources/link.confluence
Sun Nov  4 00:19:48 2007
@@ -0,0 +1,5 @@
+Line with [middle] link
+
+Line with link at the [end]
+
+Line with [link#anchor] and [#simple] anchor and [alias|link]
\ No newline at end of file



Mime
View raw message