]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
* Patch from Enrico that
[ikiwiki.git] / IkiWiki / Render.pm
index 6d5ea9ee587ebe470d6ee2b55d681f659da73572..690945c49f89f91668763ebf5dfc32d5810b2a9a 100644 (file)
@@ -105,8 +105,13 @@ sub preprocess ($$;$) { #{{{
                        # Note: preserve order of params, some plugins may
                        # consider it significant.
                        my @params;
-                       while ($params =~ /(\w+)=\"?([^"]+)"?(\s+|$)/g) {
-                               push @params, $1, $2;
+                       while ($params =~ /(?:(\w+)=)?(?:"([^"]+)"|(\S+))(?:\s+|$)/g) {
+                               if (defined $1) {
+                                       push @params, $1, (defined $2 ? $2 : $3);
+                               }
+                               else {
+                                       push @params, (defined $2 ? $2 : $3), '';
+                               }
                        }
                        return $hooks{preprocess}{$command}{call}->(@params, page => $page);
                }
@@ -250,6 +255,22 @@ sub findlinks ($$) { #{{{
        }
 } #}}}
 
+sub filter ($$) {
+       my $page=shift;
+       my $content=shift;
+
+       if (exists $hooks{filter}) {
+               foreach my $id (keys %{$hooks{filter}}) {
+                       $content=$hooks{filter}{$id}{call}->(
+                               page => $page,
+                               content => $content
+                       );
+               }
+       }
+
+       return $content;
+}
+
 sub render ($) { #{{{
        my $file=shift;
        
@@ -260,14 +281,7 @@ sub render ($) { #{{{
                my $page=pagename($file);
                delete $depends{$page};
                
-               if (exists $hooks{filter}) {
-                       foreach my $id (keys %{$hooks{filter}}) {
-                               $content=$hooks{filter}{$id}{call}->(
-                                       page => $page,
-                                       content => $content
-                               );
-                       }
-               }
+               $content=filter($page, $content);
                
                $links{$page}=[findlinks($page, $content)];