aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm5
-rw-r--r--IkiWiki/CGI.pm2
-rw-r--r--IkiWiki/Plugin/shortcut.pm2
-rw-r--r--debian/changelog3
-rw-r--r--doc/plugins/write.mdwn6
-rw-r--r--po/ikiwiki.pot14
6 files changed, 20 insertions, 12 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 3802559a5..f5cf8ba96 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -282,14 +282,15 @@ sub htmlpage ($) { #{{{
return targetpage($page, $config{htmlext});
} #}}}
-sub srcfile ($) { #{{{
+sub srcfile ($;$) { #{{{
my $file=shift;
+ my $nothrow=shift;
return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
return "$dir/$file" if -e "$dir/$file";
}
- error("internal error: $file cannot be found in $config{srcdir} or underlay");
+ error("internal error: $file cannot be found in $config{srcdir} or underlay") unless $nothrow;
return;
} #}}}
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 65136a269..781974c13 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -503,7 +503,7 @@ sub cgi_editpage ($$) { #{{{
my $exists=-e "$config{srcdir}/$file";
if ($form->field("do") ne "create" && ! $exists &&
- ! eval { srcfile($file) }) {
+ ! defined srcfile($file, 1)) {
$form->tmpl_param("page_gone", 1);
$form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0);
diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm
index c3e1f5446..f1a38ea48 100644
--- a/IkiWiki/Plugin/shortcut.pm
+++ b/IkiWiki/Plugin/shortcut.pm
@@ -13,7 +13,7 @@ sub import { #{{{
sub checkconfig () { #{{{
# Preprocess the shortcuts page to get all the available shortcuts
# defined before other pages are rendered.
- my $srcfile=eval {srcfile("shortcuts.mdwn")};
+ my $srcfile=srcfile("shortcuts.mdwn", 1);
if (! defined $srcfile) {
error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
}
diff --git a/debian/changelog b/debian/changelog
index 1d06b4f5d..dc16f5ac2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ ikiwiki (2.45) UNRELEASED; urgency=low
Closes: #478718
* anonk: Add anonok_pagespec configuration setting that can be used to
allow anonymous users to edit only matching pages. Closes: #478892
+ * Fix ugly display when editing a page that has vanished.
+ * srcfile now has an optional second parameter to avoid it throwing an error
+ if the source file does not exist.
-- Joey Hess <joeyh@debian.org> Sat, 26 Apr 2008 15:09:36 -0400
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index ea2d00630..183675c53 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -529,12 +529,16 @@ a type that ikiwiki knowns how to htmlize. Otherwise, returns undef.
Given the name of a source file, returns the name of the wiki page
that corresponds to that file.
-#### `srcfile($)`
+#### `srcfile($;$)`
Given the name of a source file in the wiki, searches for the file in
the source directory and the underlay directories (most recently added
underlays first), and returns the full path to the first file found.
+Normally srcfile will fail with an error message if the source file cannot
+be found. The second parameter can be set to a true value to make it return
+undef instead.
+
#### `add_underlay($)`
Adds a directory to the set of underlay directories that ikiwiki will
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index f66cdec07..835b2773b 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-04-24 13:50-0400\n"
+"POT-Creation-Date: 2008-05-02 12:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -183,23 +183,23 @@ msgstr ""
msgid "prog not a valid graphviz program"
msgstr ""
-#: ../IkiWiki/Plugin/img.pm:53
+#: ../IkiWiki/Plugin/img.pm:55
#, perl-format
msgid "bad size \"%s\""
msgstr ""
-#: ../IkiWiki/Plugin/img.pm:63 ../IkiWiki/Plugin/img.pm:67
-#: ../IkiWiki/Plugin/img.pm:84
+#: ../IkiWiki/Plugin/img.pm:65 ../IkiWiki/Plugin/img.pm:69
+#: ../IkiWiki/Plugin/img.pm:86
#, perl-format
msgid "failed to read %s: %s"
msgstr ""
-#: ../IkiWiki/Plugin/img.pm:70
+#: ../IkiWiki/Plugin/img.pm:72
#, perl-format
msgid "failed to resize: %s"
msgstr ""
-#: ../IkiWiki/Plugin/img.pm:101
+#: ../IkiWiki/Plugin/img.pm:103
#, perl-format
msgid "failed to determine size of image %s"
msgstr ""
@@ -640,7 +640,7 @@ msgstr ""
#. translators: preprocessor directive name,
#. translators: the second a page name, the
#. translators: third a number.
-#: ../IkiWiki.pm:750
+#: ../IkiWiki.pm:751
#, perl-format
msgid "%s preprocessing loop detected on %s at depth %i"
msgstr ""