forked from sile-typesetter/sile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsile.in
executable file
·39 lines (39 loc) · 1.2 KB
/
sile.in
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!@LUA@
package.path = (os.getenv("SILE_PATH") and
os.getenv("SILE_PATH").."/?.lua" or "") .. ';?.lua;@SILE_PATH@/?.lua;@SILE_PATH@/lua-libraries/?.lua;@SILE_PATH@/lua-libraries/?/init.lua;lua-libraries/?.lua;lua-libraries/?/init.lua;' .. package.path
package.cpath = package.cpath .. ";core/?.@SHARED_LIB_EXT@;@SILE_LIB_PATH@/?.@SHARED_LIB_EXT@;"
SILE = require("core/sile")
io.stdout:setvbuf 'no'
SILE.parseArguments()
if not os.getenv 'LUA_REPL_RLWRAP' then
print('This is SILE '..SILE.version)
end
SILE.init()
if unparsed and unparsed[1] then
SILE.masterFileName = unparsed[1]
if SILE.preamble then
print("Loading "..SILE.preamble)
local c = SILE.resolveFile("classes/"..SILE.preamble)
local f = SILE.resolveFile(SILE.preamble)
if c then
SILE.readFile(c)
elseif f then
SILE.readFile(f)
else
SILE.require("classes/"..SILE.preamble)
end
end
p,e = pcall(function() SILE.readFile(unparsed[1]) end)
if not p then
if e:match(": interrupted!") then
SILE.outputter:finish()
else
io.write("\nError detected:\n"..e.."\n")
end
os.exit(1)
end
if SILE.preamble then SILE.documentState.documentClass:finish() end
io.write("\n")
else
SILE.repl()
end