How do I capture the output from a MoinMoin parser?

63 Views Asked by At

Say I'm writing a parser, and want to include the output of another parser in the results I'm returning. If I do something like this:

WikiParser = wikiutil.importPlugin(self.request.cfg, 'parser', 'text_moin_wiki', 'Parser')
wp = WikiParser("some text",self.request)
wp.format(self.formatter)

then WikiParser will throw the results of its work straight into my self.request object.

I'd like to intercept that, though - I'd rather grab the results of the WikiParser work, and manipulate them a bit more.

Is there a way for me to do this? How do I do it?

1

There are 1 best solutions below

0
On

The Request object has a redirectedOutput function, just for this purpose:

parsed_formatted_string = self.request.redirectedOutput(wp.format, self.formatter)