diff options
author | Simon McVittie <smcv@debian.org> | 2010-04-06 01:31:38 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2010-04-06 01:31:38 +0100 |
commit | 5408279b5ffd7038bb0c279d1379c7e0d21d0a96 (patch) | |
tree | 99e6031f5adf013b76fd0f40590a19acb99302ce /IkiWiki/Plugin/meta.pm | |
parent | f8457f9a902e880e0240ba7f5180c22999f0e713 (diff) | |
download | ikiwiki-5408279b5ffd7038bb0c279d1379c7e0d21d0a96.tar ikiwiki-5408279b5ffd7038bb0c279d1379c7e0d21d0a96.tar.gz |
HTML-encode meta title, description, guid on output, but not in the pagestate
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.
Diffstat (limited to 'IkiWiki/Plugin/meta.pm')
-rw-r--r-- | IkiWiki/Plugin/meta.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 5f046cb2a..9906c3f57 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -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} || |