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/doc/luatex/luaxml/README | 2 +- Master/texmf-dist/doc/luatex/luaxml/luaxml.pdf | Bin 98298 -> 96782 bytes Master/texmf-dist/doc/luatex/luaxml/luaxml.tex | 4 +++- .../tex/luatex/luaxml/luaxml-cssquery.lua | 12 +++++++++++- .../tex/luatex/luaxml/luaxml-parse-query.lua | 5 ++++- 5 files changed, 19 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 4017d861b84..a25ba1f862e 100644 --- a/Master/texmf-dist/doc/luatex/luaxml/README +++ b/Master/texmf-dist/doc/luatex/luaxml/README @@ -29,7 +29,7 @@ Author ------ Michal Hoftich Email: michal.h21@gmail.com -Version: 0.1b +Version: 0.1c 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 33051ab1c8b..3ccb1d9c67e 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 bd6728e691b..9a4de25edf7 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{0.1b} +\def\version{0.1c} \let\gitdate\date \fi \newcommand\modulename[1]{\subsection{#1}\label{sec:#1}} @@ -152,6 +152,8 @@ end \end{luacode*} \end{framed} +It supports also |XML| namespaces, using \verb_namespace|element_ syntax. + \subsection{Element traversing} \subsubsection{The \texttt{DOM\_Object:traverse\_elements} method} 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