Tweak it up a little more -- also unescape the double-escaped quotes and angle brackets to keep the help message legible, but move unescaping down below the XML metaformatting, so the mail samples don't get misformatted as if they were XML elements.

This commit is contained in:
Brion Vibber 2007-09-19 14:51:02 +00:00
parent fef3b7b3c3
commit a7c34c4c51

View 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;
}