Last modified: 2014-08-05 10:23:06 UTC
Created attachment 15782 [details] Failing Cite parser test output In gallery, the MultimediaViewer extensions inserts additional metadata such as: data-file-width="1941" data-file-height="220". When having both Cite and MultimediaViewer extensions installed, the Cite parser test fails for gallery. The test is '<references> after <gallery> (bug 6164)' Attaching my output.
We really need tests to pass when all wmf extensions are installed together. That is preventing us from progression toward the HHVM migrating. Raising priority to High.
Sounds like those tests are too rigid. Maybe they could use some sort of DOM parsing and then check only for the elements which are actually used by the Cite extension, instead of trying to match the exact HTML. As a more fragile but simpler solution, just replace the parts between <ul>...</ul> with .*? and do a regex match.
A bit more detail. The MultimediaViewer extension registers ThumbnailBeforeProduceHTML , which injects additional elements to the thumb <img> element such as: data-file-width="1941" data-file-height="220" Cite on its own has now knowledge about that. A hack would be to have Cite parser tests to clear up registered ThumbnailBeforeProduceHTML hooks and restore them after. I am wondering whether that sounds acceptable, should I raise the issue on wikitech? I found out ProofReadpage inserts additional data that badly interact. A test result with most WMF extensions installed can be found at https://integration.wikimedia.org/ci/job/mediawiki-core-extensions-integration/65/testReport/
Modifications to the parser like this will most likely never be supported in Parsoid, and they also make html output less consistent between wikis, and its imho a bad practice anyway. I'd recommend finding another way to communicate this data or justify its general usefulness and put it in mediawiki-core. If that's too complicated for the short term, the test could be simplified by either using a regex for the html output (with wildcards for additional attributes), as implementing a DOM tester is fair amount of extra overhead that requires research/implementation that is unlikely to be devotes to such a minor thing. Unregistering the hook should be a last resort as it is effectively the same as not running the tests with extensions installed, which is exactly the opposite of what bug 67216 tries to achieve. Such change should leave a FIXME comment and file a bug.
*** Bug 68649 has been marked as a duplicate of this bug. ***
Lets rephrase the bug. The MultimediaViewer extension register a thumbnailBeforeProduceHTML hook which ends up breaking other extensions parser tests because the HTML is altered. We can make parser tests to support regex and adjust the expected HTML with some wildcard regex.
Change 151833 had a related patch set uploaded by Hashar: Support regex to match parser tests output https://gerrit.wikimedia.org/r/151833