summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-03-17 21:28:31 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-03-17 21:28:31 -0400
commit52e16d4ec9aa0ec896dd8f0d8651bc5f7fb71531 (patch)
tree7f10d9737803c6fb6e8c4f93dc58ac8967a75182 /IkiWiki
parentbd6459b8521326783a738dc1e63b718dff60af1f (diff)
* Record new pages in %pagesources temporarily when previewing so that
things that need to know the page source or type can query it from there. Fixes previewing of tables when creating a new page.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 042e168aa..470677088 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -344,6 +344,12 @@ sub cgi_editpage ($$) { #{{{
return;
}
elsif ($form->submitted eq "Preview") {
+ my $new=not exists $pagesources{$page};
+ if ($new) {
+ # temporarily record its type
+ $pagesources{$page}=$page.".".$type;
+ }
+
my $content=$form->field('editcontent');
run_hooks(editcontent => sub {
$content=shift->(
@@ -358,6 +364,10 @@ sub cgi_editpage ($$) { #{{{
linkify($page, $page,
preprocess($page, $page,
filter($page, $page, $content), 0, 1))));
+
+ if ($new) {
+ delete $pagesources{$page};
+ }
# previewing may have created files on disk
saveindex();
}