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;
} #}}}
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);
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"));
}
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
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
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"
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 ""
#. 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 ""