web commit by http://jblevins.org/: Patch for unclosed refresh meta tag.
[ikiwiki] / doc / bugs / RecentChanges_contains_invalid_XHTML.mdwn
1 The final `</div>` in [`recentchanges.tmpl`][tmpl] gets wrapped in a
2 `<p>` tag for some reason, resulting in the following invalid XHTML at
3 the end of the [[RecentChanges]] page
4
5     <p></div></p>
6
7 Also, there is a problem with the `<img>` tags generated by the smiley
8 plugin which end up wrapped in a `<pre>` tag in the inline diff output.
9 `<img>` tags is not allowed within a `<pre>` block.  Maybe the smiley
10 plugin should be disabled on [[RecentChanges]]?
11
12 See the [validator output][validate] for more details.
13
14  [tmpl]: http://git.ikiwiki.info/?p=ikiwiki;a=blob_plain;f=templates/recentchanges.tmpl;hb=HEAD
15  [validate]: http://validator.w3.org/check?uri=http://ikiwiki.info/recentchanges/
16
17 - - -
18
19 I'll add this here since it's related.  I also noticed that the meta tags for
20 redirected pages need to be closed in order to be valid XHTML:
21
22     <meta http-equiv="refresh" content="10; URL=../ikiwiki/pagespec/">
23
24 I'm noticing these problems because I'm serving ikiwiki-generated
25 content as `application/xhtml+xml` (as opposed to `text/html`) in order
26 to include inline MathML.  Any invalid XHTML causes Firefox to halt all
27 processing and throw an error. &mdash;[Jason Blevins](http://jblevins.org/)
28
29 - - -
30
31 Here is a simple patch for the refresh problem.  I haven't figured out
32 what's causing the recentchanges bug yet.
33
34
35     diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
36     index 8a9a538..0afe1c3 100644
37     --- a/IkiWiki/Plugin/meta.pm
38     +++ b/IkiWiki/Plugin/meta.pm
39     @@ -186,7 +186,7 @@ sub preprocess (@) { #{{{
40                         $value=encode_entities($value);
41                 }
42                 my $delay=int(exists $params{delay} ? $params{delay} : 0);
43     -           my $redir="<meta http-equiv=\"refresh\" content=\"$delay; URL=$value\">";
44     +           my $redir="<meta http-equiv=\"refresh\" content=\"$delay; URL=$value\" />";
45                 if (! $safe) {
46                         $redir=scrub($redir);
47                 }
48
49
50 --[[JasonBlevins]]
51
52 [[tag patch]]