]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/template.pm
Merge remote-tracking branch 'smcv/ready/no-trails-if-dynamic'
[git.ikiwiki.info.git] / IkiWiki / Plugin / template.pm
index d2b2fef55fbec15fef890f52c7cb9c2f0d56d3e6..3df06e652eeee285d51690b9d2178d6e0fb2b8ca 100644 (file)
@@ -41,34 +41,31 @@ sub preprocess (@) {
                        blind_cache => 1);
        };
        if ($@) {
                        blind_cache => 1);
        };
        if ($@) {
-               error gettext("failed to process template:")." $@";
-       }
-       if (! $template) {
-               error sprintf(gettext("%s not found"),
+               error sprintf(gettext("failed to process template %s"),
                        htmllink($params{page}, $params{destpage},
                        htmllink($params{page}, $params{destpage},
-                               "/templates/$params{id}"))
+                               "/templates/$params{id}"))." $@";
        }
 
        $params{basename}=IkiWiki::basename($params{page});
 
        foreach my $param (keys %params) {
                my $value=IkiWiki::preprocess($params{page}, $params{destpage},
        }
 
        $params{basename}=IkiWiki::basename($params{page});
 
        foreach my $param (keys %params) {
                my $value=IkiWiki::preprocess($params{page}, $params{destpage},
-                         IkiWiki::filter($params{page}, $params{destpagea},
-                         $params{$param}), $scan);
+                         $params{$param}, $scan);
                if ($template->query(name => $param)) {
                if ($template->query(name => $param)) {
-                       $template->param($param =>
-                               IkiWiki::htmlize($params{page}, $params{destpage},
+                       my $htmlvalue=IkiWiki::htmlize($params{page}, $params{destpage},
                                        pagetype($pagesources{$params{page}}),
                                        pagetype($pagesources{$params{page}}),
-                                       $value));
+                                       $value);
+                       chomp $htmlvalue;
+                       $template->param($param => $htmlvalue);
                }
                if ($template->query(name => "raw_$param")) {
                }
                if ($template->query(name => "raw_$param")) {
+                       chomp $value;
                        $template->param("raw_$param" => $value);
                }
        }
 
        return IkiWiki::preprocess($params{page}, $params{destpage},
                        $template->param("raw_$param" => $value);
                }
        }
 
        return IkiWiki::preprocess($params{page}, $params{destpage},
-              IkiWiki::filter($params{page}, $params{destpage},
-              $template->output), $scan);
+              $template->output, $scan);
 }
 
 1
 }
 
 1