switch to > n (currently 10) cycle loop protection since eg tumov's include
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 26 Aug 2006 21:26:54 +0000 (21:26 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 26 Aug 2006 21:26:54 +0000 (21:26 +0000)
plugin preprocesses included pages using the name of the including page

IkiWiki/Render.pm

index e97f46775f47a1a72b45de339aa7ac46ab1c4e7d..d7f07c08a1028f7a7353953610daeab7ac236e21 100644 (file)
@@ -97,10 +97,10 @@ sub preprocess ($$$) { #{{{
                if (length $escape) {
                        return "[[$command $params]]";
                }
-               elsif ($preprocessing{$page}) {
+               elsif ($preprocessing{$page}++ > 10) {
                        # Avoid loops of preprocessed pages preprocessing
                        # other pages that preprocess them, etc.
-                       return "[[$command would cause preprocessing loop]]";
+                       return "[[$command preprocessing loop detected]]";
                }
                elsif (exists $hooks{preprocess}{$command}) {
                        # Note: preserve order of params, some plugins may
@@ -129,13 +129,12 @@ sub preprocess ($$$) { #{{{
                                        push @params, $val, '';
                                }
                        }
-                       $preprocessing{$page}=1;
                        my $ret=$hooks{preprocess}{$command}{call}->(
                                @params,
                                page => $page,
                                destpage => $destpage,
                        );
-                       delete $preprocessing{$page};
+                       $preprocessing{$page}--;
                        return $ret;
                }
                else {