From b09300e44dd6326ce89c11da7577b055e542a7b0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 14 Sep 2021 20:25:48 +0000 Subject: luaxml (14sep21) git-svn-id: svn://tug.org/texlive/trunk@60511 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/luaxml/README | 2 +- Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf | Bin 118190 -> 118178 bytes Master/texmf-dist/doc/luatex/luaxml/luaxml.tex | 2 +- .../tex/luatex/luaxml/luaxml-domobject.lua | 12 ++++++++++++ .../tex/luatex/luaxml/luaxml-parse-query.lua | 5 +++-- 5 files changed, 17 insertions(+), 4 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/luatex/luaxml/README b/Master/texmf-dist/doc/luatex/luaxml/README index e41f3100ea2..bea8ba60fc7 100644 --- a/Master/texmf-dist/doc/luatex/luaxml/README +++ b/Master/texmf-dist/doc/luatex/luaxml/README @@ -28,7 +28,7 @@ Author ------ Michal Hoftich Email: michal.h21@gmail.com -Version: v0.1o, 2021-07-23 +Version: v0.1p, 2021-09-10 Original authors: Paul Chakravarti and Manoel Campos (http://manoelcampos.com) diff --git a/Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf b/Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf index ee611396446..89f9c3d1ed8 100644 Binary files a/Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf and b/Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf differ diff --git a/Master/texmf-dist/doc/luatex/luaxml/luaxml.tex b/Master/texmf-dist/doc/luatex/luaxml/luaxml.tex index 1030422db9d..562a298cb01 100644 --- a/Master/texmf-dist/doc/luatex/luaxml/luaxml.tex +++ b/Master/texmf-dist/doc/luatex/luaxml/luaxml.tex @@ -7,7 +7,7 @@ \usepackage{framed} % Version is defined in the makefile, use default values when compiled directly \ifdefined\version\else -\def\version{v0.1o} +\def\version{v0.1p} \let\gitdate\date \fi \newcommand\modulename[1]{\subsection{#1}\label{sec:#1}} diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua index 7829c13b1e7..a5c0d29fee2 100644 --- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua +++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua @@ -392,6 +392,17 @@ local parse = function( return false, msg end + -- restore correct links to parent elements + local function fix_parents(el) + for k,v in ipairs(el._children or {}) do + if v:is_element() then + v._parent = el + fix_parents(v) + end + end + end + + --- Add child node to the current node function DOM_Object:add_child_node( child, --- element to be inserted as a current node child @@ -399,6 +410,7 @@ local parse = function( ) local parent = self child._parent = parent + fix_parents(child) if position then table.insert(parent._children, position, child) else diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua index 17ddeb82c55..9ed2aa93850 100644 --- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua +++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua @@ -18,10 +18,11 @@ local white = S(" \t\n") ^ 0 -- luaxml doesn't support XML namespaces and elements must be queried using -- dom:query_selector("namespace|element") local word = (alphanum + S("_-") + S("|")) ^ 1 +local attr_word = (alphanum + S("_-") + S("|:")) ^ 1 local combinators = S(">~+") -local attr_name = (alphanum + S("_-")) ^ 1 +local attr_name = (alphanum + S("_-:")) ^ 1 local attr_function = S("~|^$*") ^ 0 local attr_content = C((P(1) - quotes) ^ 1) @@ -45,7 +46,7 @@ parse_query = function(query) local first_of_type = P(":first-of-type") / mark("first-of-type") local last = P(":last-child") / mark("last-child") local last_of_type = P(":last-of-type") / mark("last-of-type") - local attr = P("[") * C(word) * P("]") / mark("attr") + local attr = P("[") * C(attr_word) * P("]") / mark("attr") local attr_value = P("[") * C(attr_name ) * C(attr_function)* P("=") * quotes * attr_content * quotes * P("]") / mark("attr_value") local combinator = C(combinators) / mark("combinator") local selector = Ct((any + nth + first + first_of_type + last + last_of_type + tag + cls + id + attr + attr_value + combinator) ^ 1) -- cgit v1.2.3