More changes to do #91

This commit is contained in:
Tulir Asokan
2019-04-07 18:21:38 +03:00
parent 21b81ccb27
commit b0c4ef81e9
11 changed files with 158 additions and 86 deletions

View File

@ -266,6 +266,9 @@ func (parser *htmlParser) singleNodeToEntity(node *html.Node, stripLinebreak boo
case html.ElementNode:
return parser.tagNodeToEntity(node, stripLinebreak)
case html.DocumentNode:
if node.FirstChild.Data == "html" && node.FirstChild.NextSibling == nil {
return parser.singleNodeToEntity(node.FirstChild, stripLinebreak)
}
return &messages.HTMLEntity{
Tag: "html",
Children: parser.nodeToEntities(node.FirstChild, stripLinebreak),