r28029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28028‎ | r28029 | r28030 >
Date:17:37, 1 December 2007
Author:vasilievvv
Status:old
Tags:
Comment:
* Use *bold* and $italics$ highlighting only in API help. It completely breaks formatting on meta=allmessages and no one needs it
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -317,6 +317,9 @@
318318
319319 if ($this->mPrinter->getNeedsRawData())
320320 $this->getResult()->setRawMode();
 321+
 322+ if( $this->mAction == 'help' )
 323+ $this->mPrinter->setHelp();
321324 }
322325
323326 // Execute
Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -35,7 +35,7 @@
3636 */
3737 abstract class ApiFormatBase extends ApiBase {
3838
39 - private $mIsHtml, $mFormat, $mUnescapeAmps;
 39+ private $mIsHtml, $mFormat, $mUnescapeAmps, $mHelp;
4040
4141 /**
4242 * Create a new instance of the formatter.
@@ -170,6 +170,13 @@
171171 }
172172
173173 /**
 174+ * Says pretty-printer that it should use *bold* and $italics$ formatting
 175+ */
 176+ public function setHelp( $help = true ) {
 177+ $this->mHelp = true;
 178+ }
 179+
 180+ /**
174181 * Prety-print various elements in HTML format, such as xml tags and URLs.
175182 * This method also replaces any '<' with &lt;
176183 */
@@ -184,10 +191,12 @@
185192 $text = ereg_replace("($protos)://[^ \\'\"()<\n]+", '<a href="\\0">\\0</a>', $text);
186193 // identify requests to api.php
187194 $text = ereg_replace("api\\.php\\?[^ \\()<\n\t]+", '<a href="\\0">\\0</a>', $text);
188 - // make strings inside * bold
189 - $text = ereg_replace("\\*[^<>\n]+\\*", '<b>\\0</b>', $text);
190 - // make strings inside $ italic
191 - $text = ereg_replace("\\$[^<>\n]+\\$", '<b><i>\\0</i></b>', $text);
 195+ if( $this->mHelp ) {
 196+ // make strings inside * bold
 197+ $text = ereg_replace("\\*[^<>\n]+\\*", '<b>\\0</b>', $text);
 198+ // make strings inside $ italic
 199+ $text = ereg_replace("\\$[^<>\n]+\\$", '<b><i>\\0</i></b>', $text);
 200+ }
192201
193202 /* Temporary fix for bad links in help messages. As a special case,
194203 * XML-escaped metachars are de-escaped one level in the help message
Index: trunk/phase3/RELEASE-NOTES
@@ -313,6 +313,7 @@
314314 * Add action=parse to render parser output. Use it instead of action=render which is deprecated.
315315 * Add rvtoken=rollback to prop=revisions
316316 * Add meta=allmessages to get messages from site's messages cache.
 317+* Use bold and italics highlighting only in API help
317318
318319 === Languages updated in 1.12 ===
319320

Follow-up revisions

RevisionCommit summaryAuthorDate
r75970Followup r28029, we should probably at least pay attention to the parameter...reedy00:55, 4 November 2010

Status & tagging log