X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/d5e65e582a34ae2494fee493ddcb2b959e4a4bce..e0ce38dc42f461539a7c8f0594b95473d4494689:/doc/todo/missingparents.pm.mdwn?ds=sidebyside diff --git a/doc/todo/missingparents.pm.mdwn b/doc/todo/missingparents.pm.mdwn index 0cc7137ba..b257760ce 100644 --- a/doc/todo/missingparents.pm.mdwn +++ b/doc/todo/missingparents.pm.mdwn @@ -30,6 +30,12 @@ This patch, or one like it, would enable better blogging support, by adding the ability to hierarchically organize blog posts and automatically generate structural pages for year, month, or day. Please apply. --Ethan +> This looks a lot like [[plugins/autoindex]], except limited to a subset +> of pages, and with different templates according to the page it's used +> on. Perhaps it could become several enhancements for autoindex? --[[smcv]] + +---- +
Index: IkiWiki/Render.pm =================================================================== @@ -82,15 +88,15 @@ Index: IkiWiki/Plugin/missingparents.pm +my %ownfiles; +my @pagespecs; + -+sub import { #{{{ ++sub import { + hook(type => "checkconfig", id => "missingparents", call => \&checkconfig); + hook(type => "needsdelete", id => "missingparents", call => \&needsdelete); + hook(type => "needsbuild", id => "missingparents", call => \&needsbuild); + hook(type => "savestate", id => "missingparents", call => \&savestate); + hook(type => "preprocess", id => "missingparents", call => \&preprocess_missingparents); -+} # }}} ++} + -+sub checkconfig () { #{{{ ++sub checkconfig () { + IkiWiki::preprocess("missingparents", "missingparents", + readfile(srcfile("missingparents.mdwn"))); + loadstate(); @@ -99,9 +105,9 @@ Index: IkiWiki/Plugin/missingparents.pm + unlink $config{srcdir}.'/'.$file; + } + } -+} #}}} ++} + -+sub preprocess_missingparents (@) { #{{{ ++sub preprocess_missingparents (@) { + my %params=@_; + + if (! defined $params{pages} || ! defined $params{generate}) { @@ -115,10 +121,10 @@ Index: IkiWiki/Plugin/missingparents.pm + #translators: is text for pages that match that pagespec. + return sprintf(gettext("missingparents in %s will be %s"), + '`'.$params{pages}.'`', '`\\'.$params{generate}.'`'); -+} # }}} ++} + +my $state_loaded=0; -+sub loadstate() { #{{{ ++sub loadstate() { + my $filename = "$config{wikistatedir}/missingparents"; + if (-e $filename) { + open (IN, $filename) || @@ -132,9 +138,9 @@ Index: IkiWiki/Plugin/missingparents.pm + + $state_loaded=1; + } -+} #}}} ++} + -+sub savestate() { #{{{ ++sub savestate() { + my $filename = "$config{wikistatedir}/missingparents.new"; + my $cleanup = sub { unlink ($filename) }; + open (OUT, ">$filename") || error("open $filename: $!", $cleanup); @@ -143,9 +149,9 @@ Index: IkiWiki/Plugin/missingparents.pm + } + rename($filename, "$config{wikistatedir}/missingparents") || + error("rename $filename: $!", $cleanup); -+} #}}} ++} + -+sub needsdelete (@) { #{{{ ++sub needsdelete (@) { + my $files=shift; + + my @mydel; @@ -167,9 +173,9 @@ Index: IkiWiki/Plugin/missingparents.pm + foreach my $page (@mydel){ + push @{$files}, $page; + } -+} #}}} ++} + -+sub check_matches($) { #{{{ ++sub check_matches($) { + my $page = shift; + return if $IkiWiki::pagesources{$page}; + @@ -183,9 +189,9 @@ Index: IkiWiki/Plugin/missingparents.pm + return $output; + } + return ""; -+} #}}} ++} + -+sub needsbuild ($) { #{{{ ++sub needsbuild ($) { + my $files=shift; + my @new; + @@ -209,7 +215,7 @@ Index: IkiWiki/Plugin/missingparents.pm + $ownfiles{$file} = 1; + push @{$files}, $file; + } -+} #}}} ++} + +1 Index: IkiWiki.pm @@ -227,18 +233,18 @@ Index: IkiWiki.pm our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE @@ -330,6 +336,30 @@ error("failed renaming $newfile to $destdir/$file: $!", $cleanup); - } #}}} + } -+sub newpage($$) { #{{{ ++sub newpage($$) { + my $file=shift; + my $page=shift; + + $pagemtime{$page} = $pagectime{$page} = time; + $pagesources{$page} = $file; + $pagecase{lc $page} = $page; -+} #}}} ++} + -+sub delpage($) { #{{{ ++sub delpage($) { + my $page=shift; + $links{$page}=[]; + $renderedfiles{$page}=[]; @@ -251,11 +257,11 @@ Index: IkiWiki.pm + delete $destsources{$_}; + } + } -+} #}}} ++} + my %cleared; - sub will_render ($$;$) { #{{{ + sub will_render ($$;$) { my $page=shift;-[[!tag patch]] +[[!tag patch patch/core]]