Tweak it up a little more -- also unescape the double-escaped quotes and angle bracke...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 19 Sep 2007 14:51:02 +0000 (14:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 19 Sep 2007 14:51:02 +0000 (14:51 +0000)
includes/api/ApiFormatBase.php

index 6cfbfb1..dc5b744 100644 (file)
@@ -172,13 +172,6 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
        protected function formatHTML($text) {
                // Escape everything first for full coverage
                $text = htmlspecialchars($text);
-               
-               /* Temporary fix for bad links in help messages. As a special case, XML-escaped
-                * ampersands are de-escaped one level in the help message for legibility.
-                * Should be removed once we have completed a fully-html version of the
-                * help message. */
-               if ( $this->mUnescapeAmps )
-                       $text = str_replace( '&amp;amp;', '&amp;', $text );
 
                // encode all comments or tags as safe blue strings
                $text = preg_replace('/\&lt;(!--.*?--|.*?)\&gt;/', '<span style="color:blue;">&lt;\1&gt;</span>', $text);
@@ -191,6 +184,13 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
                $text = ereg_replace("\\*[^<>\n]+\\*", '<b>\\0</b>', $text);
                // make strings inside $ italic
                $text = ereg_replace("\\$[^<>\n]+\\$", '<b><i>\\0</i></b>', $text);
+               
+               /* Temporary fix for bad links in help messages. As a special case,
+                * XML-escaped metachars are de-escaped one level in the help message
+                * for legibility. Should be removed once we have completed a fully-html
+                * version of the help message. */
+               if ( $this->mUnescapeAmps )
+                       $text = preg_replace( '/&amp;(amp|quot|lt|gt);/', '&\1;', $text );
 
                return $text;
        }