QINU fix

See discussion and proposed patch of this issue at

Problem description and solution
Some extensions that parse WikiMarkup return strings similar to "UNIQ7dcd9aca33200a81-example-14c1dc322856b22b00000001-QINU" instead of returning what they're supposed to. This seems to be a bug with using  to access the parser. However, since the parser object is passed to the extension callback function (as argument ), instead of using , use the parser object   to solve the problem.

Example
For example, this code may break (it seems inconsistent, or at least in my tests)

The following  function fixes the problem in most cases:

The above code will add  around your output. To disable this, just change the fourth argument in the call to  to  :

However, this won't work if you call it more than once. Instead, instantiate a new parser altogether:

See also another workaround in the Babel extension.

If you have to use UNIQ...QINU as input for your function/extension
Example:

the parser hides html from wiki with the operation in an array inside the mStripeState Object and replaces it with the UNIQ...QINU string instead. when wiki goes over the code, it does not recognize it is html or anything else with importance for wiki and leaves it untouched. and some final workover process, which is definitely after the parser hook stuff, it will replace such UNIQ...QINU strings back with the original raw html. See also Jimbo's page http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function

so if you get handed over such an UNIQ...QINU string, it is a random genereated unique key for this array. with this key you can access the corresponding raw html code like this:

where $html is the given UNIQ-string and $parser is the used parser. $html contains after this operation something like this: linktitle if return of foreign function was a link.

voila! you can easily extract everything you need from this string!

Note: The array keys within $parser->mStripState->general->data are wrapped with  so $html in the above example also needs to have the UNIQ...QINU string encased in #7f. Ref: Parser.php lines 132 & 133.