From: Victor Vasiliev Date: Sat, 1 Dec 2007 17:37:08 +0000 (+0000) Subject: * Use *bold* and $italics$ highlighting only in API help. It completely breaks format... X-Git-Tag: 1.31.0-rc.0~50631 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=32ccdc3d5a90cfaa9b8f54df01c0deec3d2b242d;p=lhc%2Fweb%2Fwiklou.git * Use *bold* and $italics$ highlighting only in API help. It completely breaks formatting on meta=allmessages and no one needs it --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b6b036ea32..2975a278be 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -313,6 +313,7 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API * Add action=parse to render parser output. Use it instead of action=render which is deprecated. * Add rvtoken=rollback to prop=revisions * Add meta=allmessages to get messages from site's messages cache. +* Use bold and italics highlighting only in API help === Languages updated in 1.12 === diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 5bfbd9e12a..78b319832d 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -35,7 +35,7 @@ if (!defined('MEDIAWIKI')) { */ abstract class ApiFormatBase extends ApiBase { - private $mIsHtml, $mFormat, $mUnescapeAmps; + private $mIsHtml, $mFormat, $mUnescapeAmps, $mHelp; /** * Create a new instance of the formatter. @@ -169,6 +169,13 @@ See complete documentation, or echo $text; } + /** + * Says pretty-printer that it should use *bold* and $italics$ formatting + */ + public function setHelp( $help = true ) { + $this->mHelp = true; + } + /** * Prety-print various elements in HTML format, such as xml tags and URLs. * This method also replaces any '<' with < @@ -184,10 +191,12 @@ See complete documentation, or $text = ereg_replace("($protos)://[^ \\'\"()<\n]+", '\\0', $text); // identify requests to api.php $text = ereg_replace("api\\.php\\?[^ \\()<\n\t]+", '\\0', $text); - // make strings inside * bold - $text = ereg_replace("\\*[^<>\n]+\\*", '\\0', $text); - // make strings inside $ italic - $text = ereg_replace("\\$[^<>\n]+\\$", '\\0', $text); + if( $this->mHelp ) { + // make strings inside * bold + $text = ereg_replace("\\*[^<>\n]+\\*", '\\0', $text); + // make strings inside $ italic + $text = ereg_replace("\\$[^<>\n]+\\$", '\\0', $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 diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 6d811834d2..d8bc30ea7a 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -317,6 +317,9 @@ class ApiMain extends ApiBase { if ($this->mPrinter->getNeedsRawData()) $this->getResult()->setRawMode(); + + if( $this->mAction == 'help' ) + $this->mPrinter->setHelp(); } // Execute