maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r556880 - /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
Date Tue, 17 Jul 2007 11:04:11 GMT
Author: ltheussl
Date: Tue Jul 17 04:03:52 2007
New Revision: 556880

URL: http://svn.apache.org/viewvc?view=rev&rev=556880
Log:
Correctly close link/anchor.

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java?view=diff&rev=556880&r1=556879&r2=556880
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
Tue Jul 17 04:03:52 2007
@@ -47,6 +47,9 @@
 {
     private String sourceContent;
 
+    private boolean isLink;
+    private boolean isAnchor;
+
     public void parse( Reader reader, Sink sink )
         throws ParseException
     {
@@ -157,6 +160,7 @@
                     if ( href != null )
                     {
                         sink.link( href );
+                        isLink = true;
                     }
                     else
                     {
@@ -164,6 +168,7 @@
                         if ( name != null )
                         {
                             sink.anchor( name );
+                            isAnchor = true;
                         }
                         else
                         {
@@ -275,8 +280,16 @@
                 }
                 else if ( parser.getName().equals( "a" ) )
                 {
-                    // TODO: Note there will be badness if link_ != anchor != </a>
-                    sink.link_();
+                    if ( isLink )
+                    {
+                        sink.link_();
+                        isLink = false;
+                    }
+                    else if ( isAnchor )
+                    {
+                        sink.anchor_();
+                        isAnchor = false;
+                    }
                 }
                 else if ( parser.getName().equals( "macro" ) )
                 {



Mime
View raw message