Hi,
in response to Brion Vibber's reply to my posting to the wrong mailing
list (apologies), I'm attaching here a patch of what I think fixes the
bug that five apostrophes produce invalid HTML.
This takes care of quite a lot of weird cases and nestings. However, of
course I'm aware that it is not perfect. I can construct cases where it
will still fail, but those are cases that I don't think will ever
actually come up in an encyclopedia article (or if they do, the author
was feeling fancy and deserves to be shot ;-) ).
Here's the patch:
--- includes/OutputPage-old.php Sun Jun 29 04:06:12 2003
+++ includes/OutputPage.php Sat Jun 28 19:04:42 2003
@@ -675,6 +675,15 @@
/* private */ function doQuotes( $text )
{
+ /* prevent invalid HTML (<strong><em>...</strong></em>) */
+ $text = preg_replace(
"/'''''(.+)'''(.*)''/mU",
"<em><strong>\$1</strong>\$2</em>", $text );
+ $text = preg_replace(
"/'''''(.+)''(.+)'''/mU",
"<strong><em>\$1</em>\$2</strong>", $text );
+ $text = preg_replace(
"/'''(.*[^'])''([^'].*)'''''/mU",
"<strong>\$1<em>\$2</em></strong>", $text );
+ $text = preg_replace(
"/''(.+)'''(.+)'''''/mU",
"<em>\$1<strong>\$2</strong></em>", $text );
+
+ $text = preg_replace(
"/(<strong>.*)'''(.+)'''(.*<\\/strong>)/mU",
"\$1</strong>\$2<strong>\$3", $text );
+ $text = preg_replace(
"/(<em>.*)''(.+)''(.*<\\/em>)/mU",
"\$1</em>\$2<em>\$3", $text );
+
$text = preg_replace( "/'''(.+)'''/mU",
"<strong>\$1</strong>", $text );
$text = preg_replace( "/''(.+)''/mU",
"<em>\$1</em>", $text );
return $text;
How do you usually handle casual programmer contributions? Are they
usually posted to this mailing list? Or do you have a BugZilla
installation somewhere where I should upload this as a patch? Or is
there an actual chance I might get write access to the repository?
Greetings,
Timwi