table: Find links in external files in scan pass.

master
Joey Hess 2009-01-06 15:35:53 -05:00
parent e45f13c2a4
commit 4ce73f2d88
5 changed files with 26 additions and 3 deletions

View File

@ -8,7 +8,7 @@ use IkiWiki 3.00;
sub import { sub import {
hook(type => "getsetup", id => "table", call => \&getsetup); hook(type => "getsetup", id => "table", call => \&getsetup);
hook(type => "preprocess", id => "table", call => \&preprocess); hook(type => "preprocess", id => "table", call => \&preprocess, scan => 1);
} }
sub getsetup () { sub getsetup () {
@ -27,13 +27,31 @@ sub preprocess (@) {
); );
if (exists $params{file}) { if (exists $params{file}) {
if (! $pagesources{$params{file}}) { if (! exists $pagesources{$params{file}}) {
error gettext("cannot find file"); error gettext("cannot find file");
} }
$params{data} = readfile(srcfile($params{file})); $params{data} = readfile(srcfile($params{file}));
add_depends($params{page}, $params{file}); add_depends($params{page}, $params{file});
} }
if (! defined wantarray) {
# scan mode -- if the table uses an external file, need to
# scan that file too.
return unless exists $params{file};
IkiWiki::run_hooks(scan => sub {
shift->(
page => $params{page},
content => $params{data},
);
});
# Preprocess in scan-only mode.
IkiWiki::preprocess($params{page}, $params{page}, $params{data}, 1);
return;
}
if (lc $params{format} eq 'auto') { if (lc $params{format} eq 'auto') {
# first try the more simple format # first try the more simple format
if (is_dsv_data($params{data})) { if (is_dsv_data($params{data})) {

1
debian/changelog vendored
View File

@ -1,6 +1,7 @@
ikiwiki (3.02) UNRELEASED; urgency=low ikiwiki (3.02) UNRELEASED; urgency=low
* table: Fix misparsed links in external files. * table: Fix misparsed links in external files.
* table: Find links in external files in scan pass.
-- Joey Hess <joeyh@debian.org> Tue, 06 Jan 2009 15:02:52 -0500 -- Joey Hess <joeyh@debian.org> Tue, 06 Jan 2009 15:02:52 -0500

View File

@ -5,3 +5,5 @@ table when the pages the links point to change (are added, removed, etc).
There seem only two solutions to that bug -- either really make wikilinks There seem only two solutions to that bug -- either really make wikilinks
in an external table file not work (probably by escaping them), in an external table file not work (probably by escaping them),
or run the preprocess code also in scan (expensive!). --[[Joey]] or run the preprocess code also in scan (expensive!). --[[Joey]]
[[done]]

View File

@ -15,5 +15,7 @@ use IkiWiki::Setup::Standard {
userdir => "users", userdir => "users",
usedirs => 0, usedirs => 0,
prefix_directives => 1, prefix_directives => 1,
cgiurl => "http://me",
url => "http://me",
add_plugins => [qw{goodstuff version haiku polygen fortune}], add_plugins => [qw{goodstuff version haiku polygen fortune}],
} }

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-01-05 18:53-0500\n" "POT-Creation-Date: 2009-01-06 14:31-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"