Last modified: 2010-01-16 13:08:20 UTC
This is from wikitech-l (see URL): Extensions like SyntaxHighlight_GeSHi put generated styles or javascript into the page via ParserOutput->mHeadItems. These items should be made available through the API so gadgets like LivePreview can use them.
Created attachment 6942 [details] Proposed patch: Add prop=headitems to ApiParse.php Straightforward patch. Also added a getter function for ParserOutput->mHeadItems, which appeared to be missing.
(In reply to comment #1) > Created an attachment (id=6942) [details] > Proposed patch: Add prop=headitems to ApiParse.php > > Straightforward patch. Also added a getter function for > ParserOutput->mHeadItems, which appeared to be missing. > Patch looks OK except that it removes the (array) cast in OutputPage.php for no apparent reason.
(In reply to comment #2) > Patch looks OK except that it removes the (array) cast in OutputPage.php for no > apparent reason. > I'm pretty sure that the cast is not necessary there (since the var is initialised as array() and then only added to), but if you feel uncomfortable with it, of course just skip the change.
Assigning to me as per Roan on IRC
(In reply to comment #3) > I'm pretty sure that the cast is not necessary there (since the var is > initialised as array() and then only added to), but if you feel uncomfortable > with it, of course just skip the change. > FTR: The cast was added in r21055 (Apr 2007) to deal with old parsercache entries. I think we can safely assume that they're all gone by now :)
Created attachment 6952 [details] Fixup post conflict from whitespace changes
I'm gonna end up feeling thick here... But with that patch, what sort of things is it supposed to be outputting? As i've just got my test wiki, with literally nothing on it. Did install Geshi.. I was also about to make a really thick comment, but then i realised what i was that issue was. ;)
Well, according to grep, ParserOutput::addHeadItem is used by the following extensions: [[mw:Extension:CSS]] - test case: < http://localhost/test/api.php?action=parse&prop=text|headitems&text=%7B%7B%23css:%23content%20%7Bbackground-color:%23def;%7D%20%7D%7D > [[mw:Extension:PageCSS]] (which is basically the same) [[mw:Extension:SyntaxHighlight_GeSHi]] - test case: < http://localhost/test/api.php?action=parse&prop=text|headitems&text=%3Csource%20lang=javascript%3Evar%20foo%20=%20'bar';%3C/source%3E> [[mw:Extension:SemanticForms]] and [[mw:Extension:SemanticMediaWiki]] (which I didn't test)
Cheers - http://mediawiki.pastebin.com/f16990f03 Looks good. Will commit for you in a few
r61125 Thanks!