htmlparser: Allow <p> as children of <dd> and <li>

This commit is contained in:
Stephane Fontaine
2016-07-27 15:14:34 +04:00
parent be22071b2e
commit 5bac8cd855

View File

@@ -464,12 +464,18 @@ proc untilElementEnd(x: var XmlParser, result: XmlNode,
case x.kind
of xmlElementStart, xmlElementOpen:
case result.htmlTag
of tagLi, tagP, tagDt, tagDd, tagInput, tagOption:
# some tags are common to have no ``</end>``, like ``<li>``:
of tagP, tagInput, tagOption:
# some tags are common to have no ``</end>``, like ``<li>`` but
# allow ``<p>`` in `<dd>`, `<dt>` and ``<li>`` in next case
if htmlTag(x.elemName) in {tagLi, tagP, tagDt, tagDd, tagInput,
tagOption}:
errors.add(expected(x, result))
break
of tagDd, tagDt, tagLi:
if htmlTag(x.elemName) in {tagLi, tagDt, tagDd, tagInput,
tagOption}:
errors.add(expected(x, result))
break
of tagTd, tagTh:
if htmlTag(x.elemName) in {tagTr, tagTd, tagTh, tagTfoot, tagThead}:
errors.add(expected(x, result))