mirror of
https://github.com/msva/lua-htmlparser.git
synced 2024-11-04 23:34:20 +00:00
Fixed #55
This commit is contained in:
parent
4f6437ebd1
commit
b8e676b6a6
@ -168,6 +168,7 @@ local function parse(text,limit) -- {{{
|
|||||||
local tagst, apos = tag:gettext(), 1
|
local tagst, apos = tag:gettext(), 1
|
||||||
-- }}}
|
-- }}}
|
||||||
while true do -- TagLoop {{{
|
while true do -- TagLoop {{{
|
||||||
|
dbg("[TagLoop]:#LINE# tag.name=%s, tagloop=%s",str(tag.name),str(tagloop))
|
||||||
if tagloop == limit then -- {{{
|
if tagloop == limit then -- {{{
|
||||||
err("Tag parsing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
|
err("Tag parsing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
|
||||||
break
|
break
|
||||||
@ -212,6 +213,7 @@ local function parse(text,limit) -- {{{
|
|||||||
descend = false
|
descend = false
|
||||||
tag:close()
|
tag:close()
|
||||||
else
|
else
|
||||||
|
descend = true
|
||||||
opentags[tag.name] = opentags[tag.name] or {}
|
opentags[tag.name] = opentags[tag.name] or {}
|
||||||
table.insert(opentags[tag.name], tag)
|
table.insert(opentags[tag.name], tag)
|
||||||
end
|
end
|
||||||
@ -219,6 +221,7 @@ local function parse(text,limit) -- {{{
|
|||||||
local closeend = tpos
|
local closeend = tpos
|
||||||
local closingloop
|
local closingloop
|
||||||
while true do -- TagCloseLoop {{{
|
while true do -- TagCloseLoop {{{
|
||||||
|
if voidelements[tag.name:lower()] then break end -- already closed
|
||||||
if closingloop == limit then
|
if closingloop == limit then
|
||||||
err("Tag closing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
|
err("Tag closing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user