[Wikiwyg-dev] multi-line <pre> bug
There's a bug to do with multi-line PRE sections that's noted on the
wikiwyg bugs page on www.kwiki.org (which seems to be down right now).
I got annoyed enough with it to fix it on my system. I'm not a
Javascript wiz so there's probably much better ways to do it but here's
my patch:
--- Wikitext-orig.js 2005-11-16 17:04:28.000000000 +0000
+++ Wikitext.js 2006-01-05 11:56:22.000000000 +0000
@@ -936,7 +937,15 @@
}
proto.handle_start_lines = function (element, markup) {
- var text = element.firstChild.nodeValue;
+ var text;
+ if (element.nodeName.toLowerCase() == 'pre') {
+ text = element.innerHTML
+ text = text.replace(/<br\/?>/g, '\n'); // <br> becomes newline
+ text = text.replace(/<.*?>/g, ''); // discard other HTML
tags
+ }
+ else {
+ text = element.firstChild.nodeValue;
+ }
if (!text) return;
this.assert_blank_line();
text = text.replace(/^/mg, markup[1]);
BTW, as far as I can tell, indented text doesn't work properly either.
Haven't looked at that.
Cheers, Dave
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.