r9516 - apps/gobi/trunk/code/Global

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <[email protected]>
Author: hannes
Date: 2009-02-17 23:12:09 +0100 (Tue, 17 Feb 2009)
New Revision: 9516

Modified:
   apps/gobi/trunk/code/Global/WikiMarkup.js
Log:
Make sure headers are processed after wiki links so we can strip out link tags from auto-TOC header names and anchors.

Details at http://dev.helma.org/trac/helma/changeset/9516

Modified: apps/gobi/trunk/code/Global/WikiMarkup.js
===================================================================
--- apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-17 20:08:10 UTC (rev 9515)
+++ apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-17 22:12:09 UTC (rev 9516)
@@ -19,6 +19,9 @@
         // internal wiki links
         src = this.renderLinks(page, src);
 
+        // headers
+        src = WikiMarkup.renderHeaders(src, page, new java.lang.StringBuffer());
+        
         // give choice over format method
         if (param && param.format == "plain") {
             src = format(src);
@@ -40,8 +43,6 @@
     },
 
     renderMarkup: function(page, src) {
-        // headers
-        src = WikiMarkup.renderHeaders(src, page, new java.lang.StringBuffer())
 
         // preformatted code
         src = src.replace(/(^|[\r\n])(([ \t]+[^\n\r]+(\r\n|\n|\r)?)+)/g,
@@ -205,9 +206,10 @@
             if (buffer && match.index - written > 0)
                 buffer.append(chars, written, match.index - written);
             written = re.lastIndex;
+            var title = stripTags(match[2].trim());
             var header = { type: match[1].length.toString(),
-                           anchorName: match[2].toAlphanumeric(),
-                           title: match[2].trim() };
+                           anchorName: title.toAlphanumeric(),
+                           title: title };
             max = Math.max(header.type, max);
             min = Math.min(header.type, min);
             headers[headers.length] = header;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.