aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/map_generates_malformed_HTML.mdwn
blob: 890a6ef7fe790b94311fcc1d89ced8752bf34941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[[!template id=gitbranch branch=smcv/ready/map author="[[Simon McVittie|smcv]]"]]
[[!tag patch]]

`\[[!map]]` can generate bad HTML with unbalanced open/close tags
(in XML terms: "not well-formed") in certain situations. This
appears to be a regression caused by fixing
[[maps with nested directories sometimes make ugly lists]], which
suppressed some redundant `</ul><ul>` pairs, but appears not to
have the ideal logic for this, leading to malformed HTML.

In particular, on a site with these pages:

* alpha
    * 1
        * i
        * ii
        * iii
        * iv
    * 2
        * a
        * b
    * 3
* beta

the maps "`alpha/1 or beta`", "`alpha/1/i* or alpha/2/a or beta`" and
"`alpha/1/i* or alpha/2/a`" have malformed HTML.

My `ready/map` branch adds a regression test and makes it pass.

The fix is not particularly elegant - it generates the previous
HTML with redundant `</ul><ul>` pairs, marks the redundant
pairs, and edits them out afterwards - but it works. If anyone can come
up with a cleaner algorithm that avoids generating the redundant tags
in the first place, that would be even better. --[[smcv]]

> [[merged|done]] (not thrilled at this solution, but it works) --[[Joey]]