forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r155772 - in forrest/trunk: docs-author/status.xml main/java/org/apache/forrest/util/IdGeneratorTransformer.java
Date Tue, 01 Mar 2005 13:05:44 GMT
Author: rgardler
Date: Tue Mar  1 05:05:42 2005
New Revision: 155772

URL: http://svn.apache.org/viewcvs?view=rev&rev=155772
Log:
Fix accented links in TOC (FOR-345, thanks to Cyriaque Dupoirieux)

Modified:
    forrest/trunk/docs-author/status.xml
    forrest/trunk/main/java/org/apache/forrest/util/IdGeneratorTransformer.java

Modified: forrest/trunk/docs-author/status.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/docs-author/status.xml?view=diff&r1=155771&r2=155772
==============================================================================
--- forrest/trunk/docs-author/status.xml (original)
+++ forrest/trunk/docs-author/status.xml Tue Mar  1 05:05:42 2005
@@ -51,6 +51,9 @@
         Added document to facilitate
         <link href="site:upgrading_07">upgrading to v0.7</link>
       </action>
+      <action dev "RDG" type="fix" context="core" fixes-bug="FOR-345" due-to="Cyriaque
Dupoirieux">
+        Fix broken links in Table of COntents when titles contain accented characters.
+      </action>
       <action dev="JJP" type="fix" context="core" fixes-bug="FOR-18" >
         I18n uses org.apache.cocoon.matching.LocaleMatcher instead of i18n transformer.
        This requires that your source must now be foo.lang.xml instead of foo_lang.xml

Modified: forrest/trunk/main/java/org/apache/forrest/util/IdGeneratorTransformer.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/java/org/apache/forrest/util/IdGeneratorTransformer.java?view=diff&r1=155771&r2=155772
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/util/IdGeneratorTransformer.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/util/IdGeneratorTransformer.java Tue Mar  1
05:05:42 2005
@@ -174,10 +174,22 @@
                     throw new SAXException("'id' XPath expression '"+idXPath+"' does not
return a text node: "+e, e);
                 }
                 getLogger().info("## Got id "+id);
-                //FIXME: + produces an error on document schema
-                String newId = URLEncoder.encode(id);
-                newId = avoidConflicts(doc, sect, this.idAttr, newId);
-
+                // Use of the new version of encode method to avoid to generate URI such
as :
+                //	- <a href="#Quelques+r%E8gles...">Quelques règles...</a>
+                // Which is not, curiously, well decoded...
+                // The new methode - which allow to specify "UTF-8" gives :
+                //	- <a href="#Quelques+r%C3%A8gles...">Quelques règles...</a>
+                // And it works OK,
+                String newId;
+                try {
+                  newId = URLEncoder.encode(id, "UTF-8");
+                }
+                catch( java.io.UnsupportedEncodingException e )
+                { 
+                  getLogger().error("cannot encode Id, using generate-id instead...", e);
+                  newId = processor.evaluateAsString(sect, "generate-id()");
+		}
+       	        newId = avoidConflicts(doc, sect, this.idAttr, newId);
                 // Upgrade to DOM 2 support
                 //sect.setAttribute(this.idAttr, newId);
                 sect.setAttributeNS(sect.getNamespaceURI(), this.idAttr, newId);



Mime
View raw message