further improvements for the HTML parser

This commit is contained in:
rumpf_a@web.de
2010-02-14 09:59:01 +01:00
parent 597d98e7ee
commit 01fb99bc80
2 changed files with 73 additions and 2 deletions

View File

@@ -152,7 +152,7 @@ const
tagOl, tagP, tagPre, tagTable, tagUl, tagCenter, tagDir, tagIsindex,
tagMenu, tagNoframes}
SingleTags* = {tagArea, tagBase, tagBasefont,
tagBr, tagCol, tagFrame, tagHr, tagImg, tagInput, tagIsindex,
tagBr, tagCol, tagFrame, tagHr, tagImg, tagIsindex,
tagLink, tagMeta, tagParam}
Entities = [
@@ -276,7 +276,7 @@ proc untilElementEnd(x: var TXmlParser, result: PXmlNode,
case x.kind
of xmlElementStart, xmlElementOpen:
case result.htmlTag
of tagLi, tagP, tagDt, tagDd, tagOption:
of tagLi, tagP, tagDt, tagDd, tagInput, tagOption:
if htmlTag(x.elementName) notin InlineTags:
# some tags are common to have no ``</end>``, like ``<li>``:
errors.add(expected(x, result))
@@ -285,6 +285,10 @@ proc untilElementEnd(x: var TXmlParser, result: PXmlNode,
if htmlTag(x.elementName) in {tagTr, tagTd, tagTh}:
errors.add(expected(x, result))
break
of tagOptgroup:
if htmlTag(x.elementName) in {tagOption, tagOptgroup}:
errors.add(expected(x, result))
break
else: nil
result.addNode(parse(x, errors))
of xmlElementEnd: