On Wed, Dec 7, 2011 at 11:58 AM, Daniel Barrett <[email protected]> wrote:
> I have a parser function that is not being rendered properly by the
> experimental Preview tab in WikiEditor. The function does the following:
>
> * It add a custom property "foo" to the ParserOutput object, with
> value "bar"
> * It hooks OutputPageBeforeHTML to render the value "bar"
>
> When I use the "Save Page" or "Show Preview" buttons below the edit box
> everything works fine. With the experimental Preview tab, though, the
> value doesn't get rendered. (It is in the ParserOutput object though.)
> I'm guessing that OutputPageBeforeHTML doesn't get called by the Preview
> tab.
>
I think what you want to do here is to emit a substitution strip marker
from your parser function hook, then let that get substituted back in
during final stages of parsing -- this would be equivalent to how tag hooks
like <ref> and <nowiki> work.
See CoreParserFunctions::tagObj() which implements the {{#tag:}} parser
function (essentially a wrapper around tag hooks using the parser function
syntax). This should show how to insert stuff for replacement...
-- brion
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l