diff options
author | Hans Hagen <pragma@wxs.nl> | 2014-07-17 13:24:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2014-07-17 13:24:00 +0200 |
commit | e80c75029084c0e8a80286f78150b5a2e320e63c (patch) | |
tree | 6f58c4451079d5d54e0e5db1772a4ec4c67afcb5 /tex/context/base/data-res.lua | |
parent | d091a10cf3c159a68967e4b50795481a223e652b (diff) | |
download | context-e80c75029084c0e8a80286f78150b5a2e320e63c.tar.gz |
beta 2014.07.17 13:24
Diffstat (limited to 'tex/context/base/data-res.lua')
-rw-r--r-- | tex/context/base/data-res.lua | 86 |
1 files changed, 67 insertions, 19 deletions
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index dfb50413f..69bdc508c 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -710,12 +710,19 @@ function resolvers.resetextrapath() end function resolvers.registerextrapath(paths,subpaths) - paths = settings_to_array(paths) - subpaths = settings_to_array(subpaths) - local ep = instance.extra_paths or { } - local oldn = #ep - local newn = oldn - local nofpaths = #paths + if not subpaths or subpaths == "" then + if not paths or path == "" then + return -- invalid spec + elseif done[paths] then + return -- already done + end + end + local paths = settings_to_array(paths) + local subpaths = settings_to_array(subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + local nofpaths = #paths local nofsubpaths = #subpaths if nofpaths > 0 then if nofsubpaths > 0 then @@ -762,14 +769,50 @@ function resolvers.registerextrapath(paths,subpaths) end end +-- local function made_list(instance,list,extra_too) +-- if not extra_too then +-- return list +-- end +-- local ep = instance.extra_paths +-- if not ep or #ep == 0 then +-- return list +-- end +-- local done, new, newn = { }, { }, 0 +-- -- honour . .. ../.. but only when at the start +-- for k=1,#list do +-- local v = list[k] +-- if not done[v] then +-- if find(v,"^[%.%/]$") then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- else +-- break +-- end +-- end +-- end +-- -- first the extra paths +-- for k=1,#ep do +-- local v = ep[k] +-- if not done[v] then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- end +-- end +-- -- next the formal paths +-- for k=1,#list do +-- local v = list[k] +-- if not done[v] then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- end +-- end +-- return new +-- end + local function made_list(instance,list,extra_too) - if not extra_too then - return list - end - local ep = instance.extra_paths - if not ep or #ep == 0 then - return list - end local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do @@ -785,12 +828,17 @@ local function made_list(instance,list,extra_too) end end -- first the extra paths - for k=1,#ep do - local v = ep[k] - if not done[v] then - done[v] = true - newn = newn + 1 - new[newn] = v + if extra_too then + local ep = instance.extra_paths + if ep and #ep > 0 then + for k=1,#ep do + local v = ep[k] + if not done[v] then + done[v] = true + newn = newn + 1 + new[newn] = v + end + end end end -- next the formal paths |