]> sipb.mit.edu Git - ikiwiki.git/commitdiff
html escaping complication
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 18 Nov 2008 07:48:24 +0000 (02:48 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 18 Nov 2008 07:48:24 +0000 (02:48 -0500)
Can't escape things to entities if the template then escapes the entities.
(aggregate doesn't have this problem.)

IkiWiki/Plugin/recentchanges.pm
IkiWiki/Plugin/recentchangesdiff.pm
templates/change.tmpl

index 39a123ccf978ad9931b04e6f24cee1301c5ed992..4d7023c1c1e5a0af91aad4841eb85c817dfefab3 100644 (file)
@@ -160,10 +160,12 @@ sub store ($$$) { #{{{
                );
        }
 
                );
        }
 
-       # escape wikilinks and preprocessor stuff in commit messages
        if (ref $change->{message}) {
                foreach my $field (@{$change->{message}}) {
                        if (exists $field->{line}) {
        if (ref $change->{message}) {
                foreach my $field (@{$change->{message}}) {
                        if (exists $field->{line}) {
+                               # escape html
+                               $field->{line} = encode_entities($field->{line});
+                               # escape links and preprocessor stuff
                                $field->{line} = encode_entities($field->{line}, '\[\]');
                        }
                }
                                $field->{line} = encode_entities($field->{line}, '\[\]');
                        }
                }
index bc793bada98ab9867ebf59fd8f2a153c61741d71..08cec3f5a2f0a526482cca2e5d3e5c04b72d75ee 100644 (file)
@@ -39,6 +39,8 @@ sub pagetemplate (@) { #{{{
                        else {
                                $diff=join("", @lines);
                        }
                        else {
                                $diff=join("", @lines);
                        }
+                       # escape html
+                       $diff = encode_entities($diff);
                        # escape links and preprocessor stuff
                        $diff = encode_entities($diff, '\[\]');
                        $template->param(diff => $diff);
                        # escape links and preprocessor stuff
                        $diff = encode_entities($diff, '\[\]');
                        $template->param(diff => $diff);
index 0aebae61ef356a2df6ffb1219d9ee9b36d1410ea..0e61a80f4efc2d1fc173d031b827006bfce69cef 100644 (file)
 <div class=changelog>
 <TMPL_LOOP NAME="MESSAGE">
 <TMPL_IF NAME="LINE">
 <div class=changelog>
 <TMPL_LOOP NAME="MESSAGE">
 <TMPL_IF NAME="LINE">
-<TMPL_VAR NAME="LINE" ESCAPE="HTML"><br />
+<TMPL_VAR NAME="LINE"><br />
 </TMPL_IF>
 </TMPL_LOOP>
 </div>
 <TMPL_IF NAME="DIFF">
 <div class=diff>
 <pre>
 </TMPL_IF>
 </TMPL_LOOP>
 </div>
 <TMPL_IF NAME="DIFF">
 <div class=diff>
 <pre>
-<TMPL_VAR NAME="DIFF" ESCAPE="HTML">
+<TMPL_VAR NAME="DIFF">
 </pre>
 </div>
 </TMPL_IF>
 </pre>
 </div>
 </TMPL_IF>