From c769a33392c4dedbabfb1fa1fda5c8bb30b84c78 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 12:20:50 -0400 Subject: [PATCH] autoindex: Switch to using %wikistate instead of abusing $pagestate{index}. --- IkiWiki/Plugin/autoindex.pm | 20 +++++++++++++------ debian/changelog | 2 ++ ...ate_tag_pages_according_to_a_template.mdwn | 3 +++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 555856b11..c71d73349 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -61,8 +61,16 @@ sub refresh () { } my %deleted; - if (ref $pagestate{index}{autoindex}{deleted}) { - %deleted=%{$pagestate{index}{autoindex}{deleted}}; + if (ref $wikistate{autoindex}{deleted}) { + %deleted=%{$wikistate{autoindex}{deleted}}; + } + elsif (ref $pagestate{index}{autoindex}{deleted}) { + # compatability code + %deleted=%{$pagestate{index}{autoindex}{deleted}}; + delete $pagestate{index}{autoindex}; + } + + if (keys %deleted) { foreach my $dir (keys %deleted) { # remove deleted page state if the deleted page is re-added, # or if all its subpages are deleted @@ -71,7 +79,7 @@ sub refresh () { delete $deleted{$dir}; } } - $pagestate{index}{autoindex}{deleted}=\%deleted; + $wikistate{autoindex}{deleted}=\%deleted; } my @needed; @@ -82,10 +90,10 @@ sub refresh () { # This page must have just been deleted, so # don't re-add it. And remember it was # deleted. - if (! ref $pagestate{index}{autoindex}{deleted}) { - $pagestate{index}{autoindex}{deleted}={}; + if (! ref $wikistate{autoindex}{deleted}) { + $wikistate{autoindex}{deleted}={}; } - ${$pagestate{index}{autoindex}{deleted}}{$dir}=1; + ${$wikistate{autoindex}{deleted}}{$dir}=1; } else { push @needed, $dir; diff --git a/debian/changelog b/debian/changelog index d65ffffd7..4721c5309 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,6 +58,8 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low an iffy thing. * Use above to fix up timestamps on docwiki, as well as ensure that timestamps on basewiki files shipped in the deb are sane. + * autoindex: Switch to using %wikistate instead of abusing + $pagestate{index}. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn index 8fc97578c..49da3c80c 100644 --- a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn +++ b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn @@ -239,6 +239,9 @@ wrong direction. >>>>>> Aha! Having looked at [[plugins/write]] again, it turns out that what this >>>>>> feature should really use is `%wikistate`, I think? :-) --[[smcv]] +>>>>>>> Ah, indeed, that came after I wrote autoindex. I've fixed autoindex to +>>>>>>> use it. --[[Joey]] + >>>>> Ok, now I know what you mean. --[[David_Riebenbauer]] >>> * `autoindex` forgets that a page was deleted when that page is -- 2.26.2