blob: caf518071bc95aa2c1be6c98f23a1cfaf6932283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env texlua
-- Use an invalid directory name in order not to allow kpse to search
-- in the current directory.
os.setenv("TEXMFDOTDIR", package.config:find("^\\") and "NUL" or "/dev/null")
kpse.set_program_name("luatex")
local zip = require "zip"
local archive = kpse.find_file("digestif.zip")
or error("Can't find 'digestif.zip' archive")
local function digestif_searcher(modname)
local submod = modname:match("^digestif%.(.+)")
if not submod then return end
local zipfile = zip.open(archive)
local luafile = zipfile and zipfile:open(submod .. ".lua")
if not luafile then
return "\n\t[digestif] no file '"..submod..".lua' in '"..archive.."'"
end
local chunk = luafile:read("*a")
luafile:close(); zipfile:close()
return load(chunk, "="..archive.."#"..submod..".lua")
end
-- Search inside digestif.zip when requiring digestif.* modules.
table.insert(package.searchers, 2, digestif_searcher)
-- Search inside digestif.zip when loading the *.tags data files.
table.insert(require "digestif.config".data_dirs, archive)
require "digestif.langserver".main(arg)
|