From b8e676b6a69d69590591ed3e0c46570a43854e11 Mon Sep 17 00:00:00 2001 From: "Vadim A. Misbakh-Soloviov" Date: Wed, 25 Aug 2021 11:45:20 +0700 Subject: [PATCH] Fixed #55 --- src/htmlparser.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/htmlparser.lua b/src/htmlparser.lua index 44badcd..1faaced 100644 --- a/src/htmlparser.lua +++ b/src/htmlparser.lua @@ -168,6 +168,7 @@ local function parse(text,limit) -- {{{ local tagst, apos = tag:gettext(), 1 -- }}} while true do -- TagLoop {{{ + dbg("[TagLoop]:#LINE# tag.name=%s, tagloop=%s",str(tag.name),str(tagloop)) if tagloop == limit then -- {{{ err("Tag parsing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit) break @@ -212,6 +213,7 @@ local function parse(text,limit) -- {{{ descend = false tag:close() else + descend = true opentags[tag.name] = opentags[tag.name] or {} table.insert(opentags[tag.name], tag) end @@ -219,6 +221,7 @@ local function parse(text,limit) -- {{{ local closeend = tpos local closingloop while true do -- TagCloseLoop {{{ + if voidelements[tag.name:lower()] then break end -- already closed if closingloop == limit then err("Tag closing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit) break