]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/html5_time_element__39__s_pubdate_wrong_when_using_xhtml5___34__mode__34__.mdwn
(no commit message)
[git.ikiwiki.info.git] / doc / bugs / html5_time_element__39__s_pubdate_wrong_when_using_xhtml5___34__mode__34__.mdwn
1 Hi,
3 XML error:
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>
7 The pubdate REQUIRES a date, so e.g. `pubdate="2009-03-24T18:02:14Z"`
9 > No, `pubdate="pubdate"`. It's a boolean attribute. applied && [[done]]
10 > --[[Joey]] 
11 >> awesome, thanks for fixing my fix ;) --[[simonraven]]
12 >>> This seems to be happening either still or again with version 3.20200202.3-1. I'm getting strings generated like
13 >>>
14 >>> Posted &lt;time datetime="2007-12-06T05:00:00Z" pubdate="pubdate"&gt;Thu 06 Dec 2007 12:00:00 AM EST&lt;/time&gt;
15 >>>
16 >>> which shows up as an error on https://validator.w3.org/ --Luke Schierer
17  
19 Otherwise the XML parser chokes.
21 <http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#attr-time-pubdate>
23 (indented exactly 4 spaces)
25 <pre>
26     diff --git a/IkiWiki.pm b/IkiWiki.pm
27     index 1f2ab07..6ab5b56 100644
28     --- a/IkiWiki.pm
29     +++ b/IkiWiki.pm
30     @@ -1004,7 +1004,7 @@ sub displaytime ($;$$) {
31         my $time=formattime($_[0], $_[1]);
32         if ($config{html5}) {
33             return '&lt;time datetime="'.date_3339($_[0]).'"'.
34     -         ($_[2] ? ' pubdate' : '').
35     +           ($_[2] ? ' pubdate="'.date_3339($_[0]).'"' : '').
36                 '>'.$time.'&lt;/time&gt;';
37         }
38         else {
39     diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm
40     index fe8ef09..8c4a1b4 100644
41     --- a/IkiWiki/Plugin/relativedate.pm
42     +++ b/IkiWiki/Plugin/relativedate.pm
43     @@ -59,7 +59,7 @@ sub mydisplaytime ($;$$) {
44      
45         if ($config{html5}) {
46             return '&lt;time datetime="'.IkiWiki::date_3339($time).'"'.
47     -         ($pubdate ? ' pubdate' : '').$mid.'&lt;/time&gt;';
48     +           ($pubdate ? ' pubdate="'.IkiWiki::date_3339($time).'"' : '').$mid.'&lt;/time&gt;';
49         }
50         else {
51             return '&lt;span'.$mid.'&lt;/span&gt;';
52 </pre>