r25939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25938‎ | r25939 | r25940 >
Date:14:51, 19 September 2007
Author:brion
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -172,13 +172,6 @@
173173 protected function formatHTML($text) {
174174 // Escape everything first for full coverage
175175 $text = htmlspecialchars($text);
176 -
177 - /* Temporary fix for bad links in help messages. As a special case, XML-escaped
178 - * ampersands are de-escaped one level in the help message for legibility.
179 - * Should be removed once we have completed a fully-html version of the
180 - * help message. */
181 - if ( $this->mUnescapeAmps )
182 - $text = str_replace( '&', '&', $text );
183176
184177 // encode all comments or tags as safe blue strings
185178 $text = preg_replace('/\&lt;(!--.*?--|.*?)\&gt;/', '<span style="color:blue;">&lt;\1&gt;</span>', $text);
@@ -191,6 +184,13 @@
192185 $text = ereg_replace("\\*[^<>\n]+\\*", '<b>\\0</b>', $text);
193186 // make strings inside $ italic
194187 $text = ereg_replace("\\$[^<>\n]+\\$", '<b><i>\\0</i></b>', $text);
 188+
 189+ /* Temporary fix for bad links in help messages. As a special case,
 190+ * XML-escaped metachars are de-escaped one level in the help message
 191+ * for legibility. Should be removed once we have completed a fully-html
 192+ * version of the help message. */
 193+ if ( $this->mUnescapeAmps )
 194+ $text = preg_replace( '/&amp;(amp|quot|lt|gt);/', '&\1;', $text );
195195
196196 return $text;
197197 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r26015Merged revisions 25932-26011 via svnmerge from...david21:05, 21 September 2007

Status & tagging log