diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-02 21:00:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-02 21:00:04 +0000 |
commit | 3338a8f39d6a29d6c62a7add7e0abd85d63603b8 (patch) | |
tree | bcc228ac13766aaf123e6fdb12edba70178181ca /Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua | |
parent | 77e1e3b2b64de835e6fa18fe6f122f93302b1052 (diff) |
luaxml (2sep19)
git-svn-id: svn://tug.org/texlive/trunk@52018 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua index 5f12a92f714..1225b913140 100644 --- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua +++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-mod-handler.lua @@ -253,7 +253,7 @@ M.simpleTreeHandler = simpleTreeHandler local function domHandler() local obj = {} local decode = entities.decode - obj.options = {commentNode=1,piNode=1,dtdNode=1,declNode=1} + obj.options = {commentNode=1,piNode=1,dtdNode=1,declNode=1, voidElements = {}} obj.root = { _children = {n=0}, _type = "ROOT" } obj.current = obj.root obj.starttag = function(self,t,a) @@ -270,13 +270,20 @@ local function domHandler() _parent = self.current, _children = {n=0} } table.insert(self.current._children,node) - self.current = node + -- close void element + if not self.options.voidElements[t] then + self.current = node + else + table.remove(self._xml._stack) + end end obj.endtag = function(self,t,s) - if t ~= self.current._name then + if not self.options.voidElements[t] then + if t ~= self.current._name then error("XML Error - Unmatched Tag ["..s..":"..t.."]\n") + end + self.current = self.current._parent end - self.current = self.current._parent end obj.text = function(self,t) local node = { _type = "TEXT", |