maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r577265 - in /maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo: FoAggregateSink.java FoSink.java
Date Wed, 19 Sep 2007 12:07:06 GMT
Author: ltheussl
Date: Wed Sep 19 05:07:05 2007
New Revision: 577265

URL: http://svn.apache.org/viewvc?rev=577265&view=rev
Log:
Properly encode anchors

Modified:
    maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
    maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java

Modified: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java?rev=577265&r1=577264&r2=577265&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
(original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
Wed Sep 19 05:07:05 2007
@@ -198,9 +198,13 @@
     {
         String anchor = name;
 
-        if ( !anchor.startsWith( "#" ) )
+        if ( anchor.startsWith( "#" ) )
         {
-            anchor = "#" + anchor;
+            anchor = "#" + HtmlTools.encodeId( anchor.substring( 1 ) );
+        }
+        else
+        {
+            anchor = "#" + HtmlTools.encodeId( anchor );
         }
 
         if ( docName != null )
@@ -241,11 +245,13 @@
 
                     if ( dot2 != -1)
                     {
-                        anchor = anchor.substring( 0, dot ) + anchor.substring( hash, dot2
);
+                        anchor = anchor.substring( 0, dot ) + "#"
+                            + HtmlTools.encodeId( anchor.substring( hash + 1, dot2 ) );
                     }
                     else
                     {
-                        anchor = anchor.substring( 0, dot ) + anchor.substring( hash, anchor.length()
);
+                        anchor = anchor.substring( 0, dot ) + "#"
+                            + HtmlTools.encodeId( anchor.substring( hash + 1, anchor.length()
) );
                     }
                 }
                 else
@@ -291,9 +297,13 @@
 
             String anchor = name;
 
-            if ( !anchor.startsWith( "#" ) )
+            if ( anchor.startsWith( "#" ) )
+            {
+                anchor = "#" + HtmlTools.encodeId( anchor.substring( 1 ) );
+            }
+            else
             {
-                anchor = "#" + anchor;
+                anchor = "#" + HtmlTools.encodeId( anchor );
             }
 
             if ( docName != null )

Modified: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=577265&r1=577264&r2=577265&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
(original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Wed Sep 19 05:07:05 2007
@@ -744,9 +744,13 @@
     {
         String anchor = name;
 
-        if ( !anchor.startsWith( "#" ) )
+        if ( anchor.startsWith( "#" ) )
         {
-            anchor = "#" + anchor;
+            anchor = "#" + HtmlTools.encodeId( anchor.substring( 1 ) );
+        }
+        else
+        {
+            anchor = "#" + HtmlTools.encodeId( anchor );
         }
 
         writeStartTag( "inline", "id", anchor );
@@ -773,9 +777,13 @@
 
             String anchor = name;
 
-            if ( !anchor.startsWith( "#" ) )
+            if ( anchor.startsWith( "#" ) )
+            {
+                anchor = "#" + HtmlTools.encodeId( anchor.substring( 1 ) );
+            }
+            else
             {
-                anchor = "#" + anchor;
+                anchor = "#" + HtmlTools.encodeId( anchor );
             }
 
             writeStartTag( "basic-link", "internal-destination", HtmlTools.escapeHTML( anchor
) );



Mime
View raw message