From: Joey Hess Date: Tue, 6 Jan 2009 20:35:53 +0000 (-0500) Subject: table: Find links in external files in scan pass. X-Git-Tag: 3.02~66 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4ce73f2d88e9a177ad84e19b48a17b2d604a808b;p=ikiwiki.git table: Find links in external files in scan pass. --- diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index dd124929d..96d63f455 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -8,7 +8,7 @@ use IkiWiki 3.00; sub import { 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 () { @@ -27,13 +27,31 @@ sub preprocess (@) { ); if (exists $params{file}) { - if (! $pagesources{$params{file}}) { + if (! exists $pagesources{$params{file}}) { error gettext("cannot find file"); } $params{data} = readfile(srcfile($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') { # first try the more simple format if (is_dsv_data($params{data})) { diff --git a/debian/changelog b/debian/changelog index bf47fda04..e79ad04cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ikiwiki (3.02) UNRELEASED; urgency=low * table: Fix misparsed links in external files. + * table: Find links in external files in scan pass. -- Joey Hess Tue, 06 Jan 2009 15:02:52 -0500 diff --git a/doc/bugs/table_external_file_links.mdwn b/doc/bugs/table_external_file_links.mdwn index f86808c77..7b35383c5 100644 --- a/doc/bugs/table_external_file_links.mdwn +++ b/doc/bugs/table_external_file_links.mdwn @@ -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 in an external table file not work (probably by escaping them), or run the preprocess code also in scan (expensive!). --[[Joey]] + +[[done]] diff --git a/docwiki.setup b/docwiki.setup index 6d732fd6b..ffb4a7c16 100644 --- a/docwiki.setup +++ b/docwiki.setup @@ -15,5 +15,7 @@ use IkiWiki::Setup::Standard { userdir => "users", usedirs => 0, prefix_directives => 1, + cgiurl => "http://me", + url => "http://me", add_plugins => [qw{goodstuff version haiku polygen fortune}], } diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 560a5b2a1..957c9eea3 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: 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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n"