From e01f1b9c17b6436584bc92c7ae50151fd8e8205d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Jun 2018 21:41:00 +0000 Subject: luaxml (14jun18) git-svn-id: svn://tug.org/texlive/trunk@48015 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua | 12 +++++++++++- Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'Master/texmf-dist/tex/luatex') diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua index 9f283ed6e64..558f72089bc 100644 --- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua +++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua @@ -123,7 +123,9 @@ local function cssquery() return nodelist end - --- Parse CSS selector to query table + --- Parse CSS selector to a query table. + -- XML namespaces can be supported using + -- namespace|element syntax -- @return table querylist function CssQuery:prepare_selector( selector -- string CSS selector query @@ -138,6 +140,14 @@ local function cssquery() for _, atom in ipairs(part) do local key = atom[1] local value = atom[2] + -- support for XML namespaces in selectors + -- the namespace should be added using "|" + -- like namespace|element + if key=="tag" then + -- LuaXML doesn't support namespaces, so it is necessary + -- to match namespace:element + value=value:gsub("|", ":") + end t[key] = value end query[#query + 1] = t 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 95679670529..7931fa193fc 100644 --- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua +++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua @@ -13,7 +13,10 @@ end local alphanum = R("az", "AZ", "09") local num = R("09") local white = S(" \t\n") ^ 0 -local word = (alphanum + S("_-")) ^ 1 +-- this is a deviation from the upstream, we allow ":" in the tag name, because +-- luaxml doesn't support XML namespaces and elements must be queried using +-- dom:query_selector("namespace:element") +local word = (alphanum + S("_-") + S("|")) ^ 1 local mark mark = function(name) return function(...) -- cgit v1.2.3