fix preview of shortcuts

Move shortcut processing back to checkconfig, and avoid it failing if the
srcdir is not defined.
master
Joey Hess 2008-10-29 14:20:31 -04:00
parent 7237fc7f2e
commit 33a0e84ddb
3 changed files with 13 additions and 8 deletions

View File

@ -7,7 +7,7 @@ use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "shortcut", call => \&getsetup);
hook(type => "refresh", id => "shortcut", call => \&refresh);
hook(type => "checkconfig", id => "shortcut", call => \&checkconfig);
hook(type => "preprocess", id => "shortcut", call => \&preprocess_shortcut);
} #}}}
@ -19,14 +19,16 @@ sub getsetup () { #{{{
},
} #}}}
sub refresh () { #{{{
# Preprocess the shortcuts page to get all the available shortcuts
# defined before other pages are rendered.
my $srcfile=srcfile("shortcuts.mdwn", 1);
if (! defined $srcfile) {
error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
sub checkconfig () { #{{{
if (defined $config{srcdir}) {
# Preprocess the shortcuts page to get all the available shortcuts
# defined before other pages are rendered.
my $srcfile=srcfile("shortcuts.mdwn", 1);
if (! defined $srcfile) {
error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
}
IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
}
IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
} # }}}
sub preprocess_shortcut (@) { #{{{

1
debian/changelog vendored
View File

@ -36,6 +36,7 @@ ikiwiki (2.68) UNRELEASED; urgency=low
* Add support for checking pushes from untrusted git committers. This can be
used to set up anonymous git pushes, and other similar things.
* git: Allow [[sha1_commit]] to be used in the diffurl, to support cgit.
* shortcut: Fix display of shortcuts while previewing.
-- Joey Hess <joeyh@debian.org> Fri, 17 Oct 2008 20:11:02 -0400

View File

@ -1,2 +1,4 @@
Shortcuts such as \[[!google foo]] do not work when previewing pages.
--[[JasonBlevins]]
> Broken during the setup dumping changes, now fixed. --[[Joey]] [[done]]