Merge branch 'htmlparser' of https://github.com/Lompik/Nim into Lompik-htmlparser

This commit is contained in:
Andreas Rumpf 2016-07-28 20:48:38 +02:00
commit c23cbe1722
2 changed files with 52 additions and 2 deletions

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))