summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-cssquery.lua12
1 files changed, 11 insertions, 1 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