Last modified: 2008-06-12 11:51:16 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);
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?
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.
(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.
Fixed in r36232