Use xhtml friendly pubdate setting.
[ikiwiki] / doc / bugs / html5_time_element__39__s_pubdate_wrong_when_using_xhtml5___34__mode__34__.mdwn
1 Hi,
2
3 XML error:
4
5     Created <time datetime="2009-03-24T18:02:14Z" pubdate class="relativedate" title="Tue, 24 Mar 2009 14:02:14 -0400">2009-03-24</time>
6
7 The pubdate REQUIRES a date, so e.g. `pubdate="2009-03-24T18:02:14Z"`
8
9 > No, `pubdate="pubdate"`. It's a boolean attribute. applied && [[done]]
10 > --[[Joey]] 
11
12 Otherwise the XML parser chokes.
13
14 <http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#attr-time-pubdate>
15
16 (indented exactly 4 spaces)
17
18 <pre>
19     diff --git a/IkiWiki.pm b/IkiWiki.pm
20     index 1f2ab07..6ab5b56 100644
21     --- a/IkiWiki.pm
22     +++ b/IkiWiki.pm
23     @@ -1004,7 +1004,7 @@ sub displaytime ($;$$) {
24         my $time=formattime($_[0], $_[1]);
25         if ($config{html5}) {
26             return '&lt;time datetime="'.date_3339($_[0]).'"'.
27     -         ($_[2] ? ' pubdate' : '').
28     +           ($_[2] ? ' pubdate="'.date_3339($_[0]).'"' : '').
29                 '>'.$time.'&lt;/time&gt;';
30         }
31         else {
32     diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm
33     index fe8ef09..8c4a1b4 100644
34     --- a/IkiWiki/Plugin/relativedate.pm
35     +++ b/IkiWiki/Plugin/relativedate.pm
36     @@ -59,7 +59,7 @@ sub mydisplaytime ($;$$) {
37      
38         if ($config{html5}) {
39             return '&lt;time datetime="'.IkiWiki::date_3339($time).'"'.
40     -         ($pubdate ? ' pubdate' : '').$mid.'&lt;/time&gt;';
41     +           ($pubdate ? ' pubdate="'.IkiWiki::date_3339($time).'"' : '').$mid.'&lt;/time&gt;';
42         }
43         else {
44             return '&lt;span'.$mid.'&lt;/span&gt;';
45 </pre>