1 [[!template id=gitbranch branch=smcv/unescaped-meta author="[[Simon_McVittie|smcv]]"]]
3 (Warning: this branch has not been tested thoroughly.)
5 While discussing the [[plugins/meta]] plugin on IRC, Joey pointed out that
6 it stores most meta fields unescaped, but 'title', 'guid' and 'description'
7 are special-cased and stored escaped (with numeric XML/HTML entities). This
8 is to avoid emitting markup in the `<title>` of a HTML page, or in an RSS/Atom
9 feed, neither of which are subject to the [[plugins/htmlscrubber]].
11 However, having the meta fields "partially escaped" like this is somewhat
12 error-prone. Joey suggested that perhaps everything should be stored
13 unescaped, and the escaping should be done on output; this branch
16 Points of extra subtlety:
18 * The title given to the [[plugins/search]] plugin was previously HTML;
19 now it's plain text, potentially containing markup characters. I suspect
20 that that's what Xapian wants anyway (which is why I didn't change it),
21 but I could be wrong...
23 * Page descriptions in the HTML `<head>` were previously double-escaped:
24 the description was stored escaped with numeric entities, then that was
25 output with a second layer of escaping! In this branch, I just emit
26 the page description escaped once, as was presumably the intention.
28 * It's safe to apply this change to a wiki and neglect to rebuild it
29 (assuming I implemented it correctly!), but until the wiki is rebuilt,
30 titles, descriptions and GUIDs for unchanged pages will appear
31 double-escaped on any page that inlines them in `quick=yes` mode, and
32 is rebuilt for some other reason. The failure mode is too much escaping
33 rather than too little, so it shouldn't be a security problem.