]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
HTML-encode meta title, description, guid on output, but not in the pagestate
authorSimon McVittie <smcv@debian.org>
Tue, 6 Apr 2010 00:31:38 +0000 (01:31 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 6 Apr 2010 00:31:38 +0000 (01:31 +0100)
This makes them consistent with the rest of the meta keys. A wiki rebuild
will be needed on upgrade to this version; until the wiki is rebuilt,
double-escaping will occur in the titles of pages that have not changed.

IkiWiki/Plugin/comments.pm
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/meta.pm

index 4603417103c3abdb3e4d16beb6c60c8c90f05118..0aa043215b35a5ab32b2219dfc5410ac64c507cc 100644 (file)
@@ -221,9 +221,9 @@ sub preprocess {
        }
 
        if (defined $params{subject}) {
-               # encode title the same way meta does
+               # decode title the same way meta does
                eval q{use HTML::Entities};
-               $pagestate{$page}{meta}{title} = HTML::Entities::encode_numeric(decode_entities($params{subject}));
+               $pagestate{$page}{meta}{title} = decode_entities($params{subject});
        }
 
        if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) {
index 44919e58c35d658535fbb6e8e2e6f745e3c69311..644cb588d6d0283237f62d92208e58011642ee3a 100644 (file)
@@ -553,7 +553,8 @@ sub genfeed ($$$$$@) {
 
                if (exists $pagestate{$p}) {
                        if (exists $pagestate{$p}{meta}{guid}) {
-                               $itemtemplate->param(guid => $pagestate{$p}{meta}{guid});
+                               eval q{use HTML::Entities};
+                               $itemtemplate->param(guid => HTML::Entities::encode_numeric($pagestate{$p}{meta}{guid}));
                        }
 
                        if (exists $pagestate{$p}{meta}{updated}) {
index 5f046cb2a06e90fdc53939ae2d2b3490d2d4d30e..9906c3f5713cc567ece9ba8b93e96fcf5f18f831 100644 (file)
@@ -88,15 +88,15 @@ sub preprocess (@) {
 
        # Metadata collection that needs to happen during the scan pass.
        if ($key eq 'title') {
-               $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value);
+               $pagestate{$page}{meta}{title}=$value;
                return "";
        }
        elsif ($key eq 'description') {
-               $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
+               $pagestate{$page}{meta}{description}=$value;
                # fallthrough
        }
        elsif ($key eq 'guid') {
-               $pagestate{$page}{meta}{guid}=HTML::Entities::encode_numeric($value);
+               $pagestate{$page}{meta}{guid}=$value;
                # fallthrough
        }
        elsif ($key eq 'license') {
@@ -264,15 +264,20 @@ sub pagetemplate (@) {
                $template->param(meta => join("\n", grep { (! $seen{$_}) && ($seen{$_}=1) } @{$metaheaders{$page}}));
        }
        if (exists $pagestate{$page}{meta}{title} && $template->query(name => "title")) {
-               $template->param(title => $pagestate{$page}{meta}{title});
+               $template->param(title => HTML::Entities::encode_numeric($pagestate{$page}{meta}{title}));
                $template->param(title_overridden => 1);
        }
 
-       foreach my $field (qw{author authorurl description permalink}) {
+       foreach my $field (qw{author authorurl permalink}) {
                $template->param($field => $pagestate{$page}{meta}{$field})
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
 
+       foreach my $field (qw{description}) {
+               $template->param($field => HTML::Entities::encode_numeric($pagestate{$page}{meta}{$field}))
+                       if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
+       }
+
        foreach my $field (qw{license copyright}) {
                if (exists $pagestate{$page}{meta}{$field} && $template->query(name => $field) &&
                    ($page eq $destpage || ! exists $pagestate{$destpage}{meta}{$field} ||