* 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.
master
Joey Hess 2008-03-17 21:28:31 -04:00
parent bd6459b852
commit 52e16d4ec9
3 changed files with 15 additions and 0 deletions

View File

@ -344,6 +344,12 @@ sub cgi_editpage ($$) { #{{{
return; return;
} }
elsif ($form->submitted eq "Preview") { 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'); my $content=$form->field('editcontent');
run_hooks(editcontent => sub { run_hooks(editcontent => sub {
$content=shift->( $content=shift->(
@ -358,6 +364,10 @@ sub cgi_editpage ($$) { #{{{
linkify($page, $page, linkify($page, $page,
preprocess($page, $page, preprocess($page, $page,
filter($page, $page, $content), 0, 1)))); filter($page, $page, $content), 0, 1))));
if ($new) {
delete $pagesources{$page};
}
# previewing may have created files on disk # previewing may have created files on disk
saveindex(); saveindex();
} }

3
debian/changelog vendored
View File

@ -47,6 +47,9 @@ ikiwiki (2.41) UNRELEASED; urgency=low
* Correct bug in encoding of %pagestate keys, fixes edittemplate. * Correct bug in encoding of %pagestate keys, fixes edittemplate.
* Detect invalid pagespecs and do not merge them in add_depends, * Detect invalid pagespecs and do not merge them in add_depends,
as that can result in a broken merged pagespec that matches nothing. as that can result in a broken merged pagespec that matches nothing.
* 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.
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100 -- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100

View File

@ -1 +1,3 @@
If the table plugin is enabled, then creating a page, inserting a `\[[!table ...]` and clicking preview yields "htmlization of not supported" (sic). --[[madduck]] If the table plugin is enabled, then creating a page, inserting a `\[[!table ...]` and clicking preview yields "htmlization of not supported" (sic). --[[madduck]]
[[fix0red|done]] --[[Joey]]