site

(djk)
2011-04-09: Allow TOC macro # anchors through the content filter.

Allow TOC macro # anchors through the content filter.

diff --git a/src/fniki/freenet/filter/WikiContentFilter.java b/src/fniki/freenet/filter/WikiContentFilter.java
--- a/src/fniki/freenet/filter/WikiContentFilter.java
+++ b/src/fniki/freenet/filter/WikiContentFilter.java
@@ -59,6 +59,11 @@ class WikiContentFilter implements Conte
      * @throws CommentException If the URI is nvalid or unacceptable in some way.
      */
     public String processURI(String uri, String overrideType) throws CommentException {
+        if (uri.startsWith("#")) {
+            // Allow  anchor links to id values created by WikiParser.generateTOCAnchorId.
+            return "#" + uri.substring(1).replaceAll("[^a-zA-Z0-9_-]", "");
+        }
+
         if (!(uri.startsWith(mContainerPrefix) || uri.startsWith(mFproxyPrefix))) {
             System.err.println("processURI(0): " + uri + " : " + overrideType);
             System.err.println("processURI(0): REJECTED URI");