summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-06-14 21:41:00 +0000
committerKarl Berry <karl@freefriends.org>2018-06-14 21:41:00 +0000
commite01f1b9c17b6436584bc92c7ae50151fd8e8205d (patch)
treed56f74728cd1737b7a86c3cc2c15e6b216faebb6 /Master/texmf-dist/tex/luatex
parent5c25b51ce087f0f8464448ac3ad03f16c16b35be (diff)
luaxml (14jun18)
git-svn-id: svn://tug.org/texlive/trunk@48015 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua12
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-parse-query.lua5
2 files changed, 15 insertions, 2 deletions
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(...)