]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
autoindex: Switch to using %wikistate instead of abusing $pagestate{index}.
authorJoey Hess <joey@gnu.kitenet.net>
Sat, 17 Apr 2010 16:20:50 +0000 (12:20 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sat, 17 Apr 2010 16:20:50 +0000 (12:20 -0400)
IkiWiki/Plugin/autoindex.pm
debian/changelog
doc/todo/auto-create_tag_pages_according_to_a_template.mdwn

index 555856b1189fe4508ac25997cad15669fb28ceea..c71d73349c091021ab1d8083292fbd8888ce7d82 100644 (file)
@@ -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;
index d65ffffd73d475f47579557ab79ed16324b976ac..4721c530994a0274568b096cf55b1dc970044cb3 100644 (file)
@@ -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 <joeyh@debian.org>  Sun, 04 Apr 2010 12:17:11 -0400
 
index 8fc97578cd3cd7bdab282c3f9a6ed5af051d2db4..49da3c80c3610ed137c1c6f2aba05b71a10e6994 100644 (file)
@@ -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