shortcut: If default_pageext is set, first look for shortcuts.default_pageext

Falls back to looking for shortcuts.mdwn for backwards compatabiity; there
probably exist wikis that have changed the pageext but still use
shortcuts.mdwn.
master
Joey Hess 2009-02-12 13:02:58 -05:00
parent 40cb4aa5c0
commit 46819b530b
4 changed files with 11 additions and 24 deletions

View File

@ -23,9 +23,13 @@ sub checkconfig () {
if (defined $config{srcdir}) { if (defined $config{srcdir}) {
# Preprocess the shortcuts page to get all the available shortcuts # Preprocess the shortcuts page to get all the available shortcuts
# defined before other pages are rendered. # defined before other pages are rendered.
my $srcfile=srcfile("shortcuts.mdwn", 1); my $srcfile=srcfile("shortcuts.".$config{default_pageext}, 1);
if (! defined $srcfile) { if (! defined $srcfile) {
error(gettext("shortcut plugin will not work without a shortcuts.mdwn")); $srcfile=srcfile("shortcuts.mdwn", 1);
}
if (! defined $srcfile) {
error(sprintf(gettext("shortcut plugin will not work without %s"),
"shortcuts.".$config{default_pageext}));
} }
IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile)); IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
} }

2
debian/changelog vendored
View File

@ -11,6 +11,8 @@ ikiwiki (3.04) UNRELEASED; urgency=low
* Fix unusual --setup --post-commit command line option combo. * Fix unusual --setup --post-commit command line option combo.
* Create any missing directory necessary to put the wrapper * Create any missing directory necessary to put the wrapper
file into. Closes: #514384 file into. Closes: #514384
* shortcut: If default_pageext is set, first look for
shortcuts.default_pageext.
-- Joey Hess <joeyh@debian.org> Sat, 31 Jan 2009 19:04:45 -0500 -- Joey Hess <joeyh@debian.org> Sat, 31 Jan 2009 19:04:45 -0500

View File

@ -5,7 +5,3 @@ you need to overwrite the underlay
dir (set underlaydir in ikiwiki.setup dir (set underlaydir in ikiwiki.setup
to your own underlay dir or replace underlay pages to your own underlay dir or replace underlay pages
in your $SRC). in your $SRC).
Specially, the [[shortcut]] plugin is hardcoded to
use shortcuts.mdwn. So you need pay more care if
you [[use shortcut without mdwn|shortcut/discussion]].

View File

@ -3,25 +3,10 @@ disabled [[mdwn]], to get [[shortcut]] work, you need
commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`), commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`),
and edit/patch [[shortcut]]. and edit/patch [[shortcut]].
Maybe use the $default_pageext is better than hardcode .mdwn? Maybe use the `default_pageext` is better than hardcode .mdwn?
<pre>
--- shortcut.pm.orig 2009-02-12 02:05:22.000000000 -0600
+++ shortcut.pm 2009-02-12 04:41:30.000000000 -0600
@@ -23,9 +23,9 @@
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);
+ my $srcfile=srcfile("shortcuts.$config{default_pageext}", 1);
if (! defined $srcfile) {
- error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
+ error(gettext("shortcut plugin will not work without a shortcuts.$config{default_pageext}"));
}
IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
}
</pre>
--[[weakish]] --[[weakish]]
> done, it will use `default_pageext` now --[[Joey]]