I'm building an application that uses DifferenceEngine.php to generate word level unified diffs. I've figured out how to do this but now need to generate patches given the diff.
This is what I have written to generate the diff:
$orig = array('One Two Three', 'One Two Three'); $closing = array('One Two Three', 'One Two Four');
$diff = new WordLevelDiff($orig, $closing); $formatter = new UnifiedDiffFormatter(); echo $formatter->format($diff);
Which returns:
@@ -5,3 +5,3 @@ One Two - Three + Four
So my application will store this and when it comes to time to patch that diff, I need a function that will do that, i.e. given the diff string above and $orig, it should generate $closing.
Does such a patch functionality exist in MediaWiki, or anywhere else?
I'm using PHP and am aware of the xdiff extension but it doesn't support word-level-diff, only line-level. And I can't install it anyway.