summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua62
1 files changed, 48 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua
index 921f971eb2e..1e65d3b8058 100644
--- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua
+++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-selectors.lua
@@ -1,29 +1,63 @@
-module(...,package.seeall)
+--module(...,package.seeall)
-
-function makeTag(s)
- return "<"..s.."[^>]*>"
+local M = {}
+local inside = 0
+local function makeTag(s)
+ local function makeTag(fuf)
+ return fuf .. "[^>]*"
+ end
+ local print = texio.write_nl
+ if inside > 0 then print ("inside "..inside) else print("outside") end
+ --[[if inside then
+ return s .. "[^>]*"
+ else
+ inside = true--]]
+ inside = inside + 1
+ local f = "<"..s.."[^>]*>"
+ inside = inside - 1
+ return f
+ --end
end
-function matchTag(tg)
+
+M.makeTag = makeTag
+local function matchTag(tg)
return makeTag(tg)
end
-
-function matchDescendand(a,b)
+M.matchTag=matchTag
+local function matchDescendand(a,b)
return makeTag(a)..makeTag(b)
end
+M.matchDescendand = matchDescendand
-function matchChild(a,b)
+local function matchChild(a,b)
return makeTag(a)..".*"..makeTag(b)
end
+M.matchChild = matchChild
+
+local function matchSibling(a,b)
+ return a .. "[^>]*".."@%("..b.."[^>]*%)"
+end
+M.matchSibling = matchSibling
-function matchSibling(a,b)
- return makeTag(a .. "[^>]*".."@%("..b.."[^>]*%)")
+local function matchClass(tg,class)
+ return tg.."[^>]*class=[|]*[^>]*|"..class.."[^>]*|"
end
-function matchClass(tg,class)
- return makeTag(tg.."[^>]*class=[|]*[^>]*|"..class.."[^>]*|")
+M.matchClass = matchClass
+local function matchId(tg,id)
+ return tg.."[^>]*id="..id
end
-matcher = {}
+M.matchId = matchId
+local matcher = {}
+M.matcher= matcher
+local function makeElement(s)
+ local function makeTag(fuf)
+ return fuf .. "[^>]*"
+ end
+ return "<"..s .. "[^>]*>"
+end
+
+M.makeElement = makeElement
function matcher.new()
local self = {}
local selectors={}
@@ -39,4 +73,4 @@ function matcher.new()
end
return self
end
-
+return M