table: Find links in external files in scan pass.
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 6 Jan 2009 20:35:53 +0000 (15:35 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 6 Jan 2009 20:36:32 +0000 (15:36 -0500)
IkiWiki/Plugin/table.pm
debian/changelog
doc/bugs/table_external_file_links.mdwn
docwiki.setup
po/ikiwiki.pot

index dd124929d6bbacf704dfc9cab0cdd1d1b597c6be..96d63f455f886e9111f0e7bd26558b020c1de61b 100644 (file)
@@ -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})) {
index bf47fda044b4cae086821ab7d4114d7d81e63419..e79ad04cc2bb8ac480fe907e261235272c3e9313 100644 (file)
@@ -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 <joeyh@debian.org>  Tue, 06 Jan 2009 15:02:52 -0500
 
index f86808c77267d3ab8d5aaafdb77819a888bbdcf5..7b35383c5d3e09f8162a1ce1da8dafc93f6d241d 100644 (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
 in an external table file not work (probably by escaping them), 
 or run the preprocess code also in scan (expensive!). --[[Joey]]
+
+[[done]]
index 6d732fd6b1d59818687a930342b9b02a123e99f5..ffb4a7c16f591104d62615c6f89651467d9f4138 100644 (file)
@@ -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}],
 }
index 560a5b2a1c90fd9a04e0450c5d8dbbc0e3f9cb85..957c9eea33d324398786586479a6b667574db023 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"