got wikidiff2 persistence working except for paragraph moves.

This commit is contained in:
Nathan TeBlunthuis
2025-06-30 15:37:54 -07:00
parent 186cb82fb8
commit 5a3e4102b5
6 changed files with 207 additions and 177 deletions

24
wikidiff2_api.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
// Launch this server with:
// php -S localhost:8000 -q -c php.ini
// Call the server with:
// curl -X POST -H "Content-Type: application/json" \
// -d '{"arg1": "aa", "arg2": "aba"}' \
// http://localhost:8000
// Get the raw POST data
$rawData = file_get_contents('php://input');
// Decode the JSON data
$data = json_decode($rawData, true);
$previous = '';
$result = [];
foreach ($data as $i => $value) {
$result[] = wikidiff2_inline_json_diff($previous, $value, 5000000);
$previous = $value;
}
echo json_encode($result);