* More consistent encoding of titles in rss and atom feeds. Don't use
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 28 May 2007 19:43:28 +0000 (19:43 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 28 May 2007 19:43:28 +0000 (19:43 +0000)
  ESCAPE=HTML for titles in the templates for these feeds, and instead
  escape the title going in to the template. Previously, the title was
  sometimes double-escaped in a feed (if set via meta title), and sometimes
  not (if set from the page filename).
* In the meta plugin, when a title is set, encode the html entities in it
  numerically. This works better in the current landscape of a rss spec that
  doesn't specify encoding, and variously broken feed consumers, according
  to <http://www.rssboard.org/rss-profile#data-types-characterdata>.

IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/meta.pm
debian/changelog
doc/bugs/HTML-escaped_titles_in_Atom__44___RSS_feeds_don__39__t_validate.mdwn
templates/atomitem.tmpl
templates/atompage.tmpl
templates/rssitem.tmpl
templates/rsspage.tmpl

index 063673730ca88e9f30fe6762863e75ee2ae47a71..e23f7b9036949fef04f840eb9a6d49f61d704bc7 100644 (file)
@@ -333,7 +333,7 @@ sub genfeed ($$$$@) { #{{{
                my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
 
                $itemtemplate->param(
                my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
 
                $itemtemplate->param(
-                       title => pagetitle(basename($p), 1),
+                       title => pagetitle(basename($p)),
                        url => $u,
                        permalink => $u,
                        date_822 => date_822($pagectime{$p}),
                        url => $u,
                        permalink => $u,
                        date_822 => date_822($pagectime{$p}),
@@ -377,7 +377,7 @@ sub genfeed ($$$$@) { #{{{
 
        my $template=template($feedtype."page.tmpl", blind_cache => 1);
        $template->param(
 
        my $template=template($feedtype."page.tmpl", blind_cache => 1);
        $template->param(
-               title => $page ne "index" ? pagetitle($page, 1) : $config{wikiname},
+               title => $page ne "index" ? pagetitle($page) : $config{wikiname},
                wikiname => $config{wikiname},
                pageurl => $url,
                content => $content,
                wikiname => $config{wikiname},
                pageurl => $url,
                content => $content,
index 18e28a196a47805f6d95550894dc62e917d60593..184146cfee5c558a23426a6b36438f8e681b41f9 100644 (file)
@@ -65,7 +65,7 @@ sub preprocess (@) { #{{{
                }
        }
        elsif ($key eq 'title') {
                }
        }
        elsif ($key eq 'title') {
-               $title{$page}=encode_entities($value);
+               $title{$page}=HTML::Entities::encode_numeric($value);
        }
        elsif ($key eq 'permalink') {
                $permalink{$page}=$value;
        }
        elsif ($key eq 'permalink') {
                $permalink{$page}=$value;
index 94576d4510bb445b97cc2128d5e3e0b38a6186df..ffcb2e85a940a9f484e1b4d9f7cc4892744b65e3 100644 (file)
@@ -18,8 +18,17 @@ ikiwiki (2.2) UNRELEASED; urgency=low
   * Fix FTBFS in test suite introduced in last version. Closes: #425891
   * Apply a patch from Carl Worth allowing a class attribute to be passed
     through the img plugin. Also allow the id attribute to be passed through.
   * Fix FTBFS in test suite introduced in last version. Closes: #425891
   * Apply a patch from Carl Worth allowing a class attribute to be passed
     through the img plugin. Also allow the id attribute to be passed through.
-
- -- Joey Hess <joeyh@debian.org>  Mon, 28 May 2007 15:00:02 -0400
+  * More consistent encoding of titles in rss and atom feeds. Don't use
+    ESCAPE=HTML for titles in the templates for these feeds, and instead
+    escape the title going in to the template. Previously, the title was
+    sometimes double-escaped in a feed (if set via meta title), and sometimes
+    not (if set from the page filename).
+  * In the meta plugin, when a title is set, encode the html entities in it
+    numerically. This works better in the current landscape of a rss spec that
+    doesn't specify encoding, and variously broken feed consumers, according
+    to <http://www.rssboard.org/rss-profile#data-types-characterdata>.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 28 May 2007 15:34:27 -0400
 
 ikiwiki (2.1) unstable; urgency=low
 
 
 ikiwiki (2.1) unstable; urgency=low
 
index 9d95c15e33eb69c0204f385291171feca82daa92..48c1689971cc6f1e8c6c7b3a58ad5679dedef8b3 100644 (file)
@@ -30,3 +30,7 @@ For Atom, at least, I believe adding `type="xhtml"` to the title element will wo
 > characters are currently being double-escaped in the rss.)
 > 
 > --[[Joey]]
 > characters are currently being double-escaped in the rss.)
 > 
 > --[[Joey]]
+
+> Update: Ok, I've fixed this for titles, as a special case, but the
+> underlying problem remains for other fields in rss feeds (such as
+> author), so I'm leaving this bug report open. --[[Joey]]
index bdbfe69c7d9034db3570ee1ce73d196e6e18e910..9190fcc842d3ffe8bdec47935ec333ae0be8bf49 100644 (file)
@@ -1,5 +1,5 @@
 <entry>
 <entry>
-       <title><TMPL_VAR TITLE ESCAPE=HTML></title>
+       <title><TMPL_VAR TITLE></title>
        <TMPL_IF NAME="AUTHOR">
        <author><TMPL_VAR AUTHOR ESCAPE=HTML></author>
        <TMPL_ELSE>
        <TMPL_IF NAME="AUTHOR">
        <author><TMPL_VAR AUTHOR ESCAPE=HTML></author>
        <TMPL_ELSE>
index b811b876478594aab1c38173b6ee5a86bf8263a7..1bca3e7f87c52de326ae6999475ab16eefa53d33 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <feed xmlns="http://www.w3.org/2005/Atom">
 <?xml version="1.0" encoding="utf-8"?>
 
 <feed xmlns="http://www.w3.org/2005/Atom">
-<title><TMPL_VAR TITLE ESCAPE=HTML></title>
+<title><TMPL_VAR TITLE></title>
 <link href="<TMPL_VAR PAGEURL>"/>
 <link href="<TMPL_VAR FEEDURL>" rel="self"/>
 <author>
 <link href="<TMPL_VAR PAGEURL>"/>
 <link href="<TMPL_VAR FEEDURL>" rel="self"/>
 <author>
index 0fab42e710ba3689668fbc4f49e2fcbe192195c0..c243b74b3b140fcc5975f58d3be468d59942c751 100644 (file)
@@ -1,9 +1,9 @@
 <item>
        <TMPL_IF NAME="AUTHOR">
 <item>
        <TMPL_IF NAME="AUTHOR">
-       <title><TMPL_VAR AUTHOR ESCAPE=HTML>: <TMPL_VAR TITLE ESCAPE=HTML></title>
+       <title><TMPL_VAR AUTHOR ESCAPE=HTML>: <TMPL_VAR TITLE></title>
        <dc:creator><TMPL_VAR AUTHOR ESCAPE=HTML></dc:creator>
        <TMPL_ELSE>
        <dc:creator><TMPL_VAR AUTHOR ESCAPE=HTML></dc:creator>
        <TMPL_ELSE>
-       <title><TMPL_VAR TITLE ESCAPE=HTML></title>
+       <title><TMPL_VAR TITLE></title>
        </TMPL_IF>
        <guid><TMPL_VAR URL></guid>
        <link><TMPL_VAR PERMALINK></link>
        </TMPL_IF>
        <guid><TMPL_VAR URL></guid>
        <link><TMPL_VAR PERMALINK></link>
index 38f9b16b3b77a5275282bb7313348ff43bfedd64..34c1a33ce290c8b151a938359c78e61053fc81c3 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
 <channel>
 <?xml version="1.0"?>
 <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
 <channel>
-<title><TMPL_VAR TITLE ESCAPE=HTML></title>
+<title><TMPL_VAR TITLE></title>
 <link><TMPL_VAR PAGEURL></link>
 <description><TMPL_VAR FEEDDESC ESCAPE=HTML></description>
 <TMPL_VAR CONTENT>
 <link><TMPL_VAR PAGEURL></link>
 <description><TMPL_VAR FEEDDESC ESCAPE=HTML></description>
 <TMPL_VAR CONTENT>