From faaa2a21ac3915f531fe3561ea638a20874d70b5 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 3 Oct 2015 10:18:26 +0100 Subject: [PATCH] Move save preprocessor handling to after metadata calculation --- modules/page-edit.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/page-edit.php b/modules/page-edit.php index 0005f63..e479456 100644 --- a/modules/page-edit.php +++ b/modules/page-edit.php @@ -111,12 +111,6 @@ register_module([ $pagedata = htmlentities($_POST["content"], ENT_QUOTES); - // Execute all the preprocessors - foreach($save_preprocessors as $func) - { - $func($pagedata); - } - if(file_put_contents("$env->page.md", $pagedata) !== false) { $page = $env->page; @@ -136,6 +130,14 @@ register_module([ else $pageindex->$page->lasteditor = utf8_encode("anonymous"); + + // Execute all the preprocessors + foreach($save_preprocessors as $func) + { + $func($pageindex->$page, $pagedata); + } + + file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT)); if(isset($_GET["newpage"]))