Last modified: 2008-06-12 11:51:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T16471, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 14471 - API parser does not use HTMLTidy on non-cached pages
API parser does not use HTMLTidy on non-cached pages
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Roan Kattouw
http://en.wikipedia.org/w/api.php?act...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-08 14:10 UTC by RockMFR
Modified: 2008-06-12 11:51 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
use HTMLTidy and enable limit report (1.47 KB, patch)
2008-06-09 19:45 UTC, RockMFR
Details

Description RockMFR 2008-06-08 14:10:03 UTC
When using the API parser (see URL above for example), HTMLTidy is not used on non-cached pages, thus returning different results depending on whether or not the page happens to be in the cache at the time. Also, the limit report is not displayed for non-cached pages, though I don't particularly care about this.

From what I can see, it seems like it would be a simple fix in ApiParse.php.

Change...

$p_result = $wgParser->parse($articleObj->getContent(), $titleObj, new ParserOptions());

to...

$popts = new ParserOptions();
$popts->setTidy(true);
$popts->enableLimitReport();
$p_result = $wgParser->parse($articleObj->getContent(), $titleObj, $popts);
Comment 1 RockMFR 2008-06-09 19:45:53 UTC
Created attachment 4968 [details]
use HTMLTidy and enable limit report

This enables HTMLTidy and the limit report in the following cases (all cases):

1) Parsing an old revision
2) Parsing the current revision
3) Parsing some arbitrary text

The second case is the one which currently gives inconsistent results. The other two cases don't currently use Tidy at all, but I can't imagine any anyone wouldn't want to use it. Perhaps add another parameter to make it optional? And another parameter to make the limit report optional?
Comment 2 Brion Vibber 2008-06-09 23:57:16 UTC
Since it's using the same sequence of several calls in three distinct places, it might be wise to encapsulate that into a function and call it consistently. This'll make it easier to maintain in the future, if something changes.
Comment 3 Roan Kattouw 2008-06-11 20:49:23 UTC
(In reply to comment #2)
> Since it's using the same sequence of several calls in three distinct places,
> it might be wise to encapsulate that into a function and call it consistently.
> This'll make it easier to maintain in the future, if something changes.
> 

The real solution here is to create the ParserOptions object before differentiating between the three cases mentioned in comment #1. I'll do that tomorrow.
Comment 4 Roan Kattouw 2008-06-12 11:51:16 UTC
Fixed in r36232

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links