From 8ed211efbf1046ab3457adc696744e2f2c5cd091 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 12 Jun 2008 11:50:01 +0000 Subject: [PATCH] (bug 14471) Use HTMLTidy and generate limit report in action=parse --- RELEASE-NOTES | 1 + includes/api/ApiParse.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e103b1a191..96e595dad5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -438,6 +438,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added md5 parameter to action=edit * (bug 14335) Logging in to unified account using API not possible * Added action=emailuser to send an email to a user +* (bug 14471) Use HTMLTidy and generate limit report in action=parse === Languages updated in 1.13 === diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 62f0437d29..fe195c4f6e 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -50,6 +50,9 @@ class ApiParse extends ApiBase { $revid = false; global $wgParser, $wgUser; + $popts = new ParserOptions(); + $popts->setTidy(true); + $popts->enableLimitReport(); if(!is_null($oldid) || !is_null($page)) { if(!is_null($oldid)) @@ -62,7 +65,7 @@ class ApiParse extends ApiBase { $this->dieUsage("You don't have permission to view deleted revisions", 'permissiondenied'); $text = $rev->getRawText(); $titleObj = $rev->getTitle(); - $p_result = $wgParser->parse($text, $titleObj, new ParserOptions()); + $p_result = $wgParser->parse($text, $titleObj, $popts); } else { @@ -77,7 +80,7 @@ class ApiParse extends ApiBase { $pcache = ParserCache::singleton(); $p_result = $pcache->get($articleObj, $wgUser); if(!$p_result) { - $p_result = $wgParser->parse($articleObj->getContent(), $titleObj, new ParserOptions()); + $p_result = $wgParser->parse($articleObj->getContent(), $titleObj, $popts); global $wgUseParserCache; if($wgUseParserCache) $pcache->save($p_result, $articleObj, $wgUser); @@ -89,7 +92,7 @@ class ApiParse extends ApiBase { $titleObj = Title::newFromText($title); if(!$titleObj) $titleObj = Title::newFromText("API"); - $p_result = $wgParser->parse($text, $titleObj, new ParserOptions()); + $p_result = $wgParser->parse($text, $titleObj, $popts); } // Return result -- 2.20.1