On Wed, Apr 22, 2009 at 10:36 AM, Roan Kattouw roan.kattouw@gmail.comwrote:
It's not in MediaWiki, and I don't know if it's in PHP, but there's a very widespread command line program installed on virtually every UNIX/Linux system that can do this. Unsurprisingly, it's called "patch". You should be able to create two temporary files, say tmp1 and tmp2, put $orig in tmp1 and the unified diff in tmp2, then run "patch tmp1 tmp2", and read the contents of tmp1 into $closing (don't forget to delete the temp files, of course).
He searched for word-based, not line-based diff. I dunno if GNU patch supports 'em, at least I didn't spot it in the manpage.
Marco