diff --git a/modules/page-edit.php b/modules/page-edit.php index 269b2de..ad2af52 100644 --- a/modules/page-edit.php +++ b/modules/page-edit.php @@ -139,6 +139,10 @@ register_module([ else $pageindex->$page->lasteditor = utf8_encode("anonymous"); + // A hack to resave the pagedata if the preprocessors have + // changed it. We need this because the preprocessors *must* + // run _after_ the pageindex has been updated. + $pagedata_orig = $pagedata; // Execute all the preprocessors foreach($save_preprocessors as $func) @@ -146,6 +150,9 @@ register_module([ $func($pageindex->$page, $pagedata); } + if($pagedata !== $pagedata_orig) + file_put_contents("$env->page.md", $pagedata); + file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));