]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/map_generates_malformed_HTML.mdwn
967439635c2679813e1b9e08bd1c7bb3094a4787
[ikiwiki.git] / doc / bugs / map_generates_malformed_HTML.mdwn
1 [[!template id=gitbranch branch=smcv/ready/map author="[[Simon McVittie|smcv]]"]]
2
3 `\[[!map]]` can generate bad HTML with unbalanced open/close tags
4 (in XML terms: "not well-formed") in certain situations. This
5 appears to be a regression caused by fixing
6 [[maps with nested directories sometimes make ugly lists]], which
7 suppressed some redundant `</ul><ul>` pairs, but appears not to
8 have the ideal logic for this, leading to malformed HTML.
9
10 In particular, on a site with these pages:
11
12 * alpha
13     * 1
14         * i
15         * ii
16         * iii
17         * iv
18     * 2
19         * a
20         * b
21     * 3
22 * beta
23
24 the maps "`alpha/1 or beta`", "`alpha/1/i* or alpha/2/a or beta`" and
25 "`alpha/1/i* or alpha/2/a`" have malformed HTML.
26
27 My `ready/map` branch adds a regression test and makes it pass.
28
29 The fix is not particularly elegant - it generates the previous
30 HTML with redundant `</ul><ul>` pairs, marks the redundant
31 pairs, and edits them out afterwards - but it works. If anyone can come
32 up with a cleaner algorithm that avoids generating the redundant tags
33 in the first place, that would be even better. --[[smcv]]