-
Notifications
You must be signed in to change notification settings - Fork 118
/
build.lua
executable file
·75 lines (65 loc) · 2.12 KB
/
build.lua
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
-- Build script for biblatex package
module = "biblatex"
-- Detail how to set the version automatically
tagfiles = {"build.lua", "./tex/latex/biblatex/biblatex.sty"}
function update_tag(file,content,tagname,tagdate)
tagname = string.gsub(tagname, "^v", "")
tagdate = string.gsub(tagdate, "%-", "/")
if file == "build.lua" then
return string.gsub(content,
'local tagname = "v%d.%d+"','local tagname = "v' .. tagname .. '"')
else
return string.gsub(string.gsub(content,"%{DATE%}","{" .. tagdate .. "}"),
"VERSION",tagname)
end
end
-- TDS-based installation
installfiles = {"./tex/latex/biblatex/biblatex.sty"}
sourcefiles = installfiles
unpackfiles = {}
tdsdirs = {bibtex = "bibtex", tex = "tex"}
-- For auto-editing
local tagname = "v3.17"
local tagdate = os.date("%Y-%m-%d")
function checkinit_hook()
local file = unpackdir .. "/biblatex.sty"
local filename = basename(file)
local f = assert(io.open(file,"rb"))
local content = f:read("*all")
f:close()
-- Deal with Unix/Windows line endings
content = string.gsub(content .. (string.match(content,"\n$") and "" or "\n"),
"\r\n", "\n")
local updated_content = update_tag(filename,content,tagname,tagdate)
if content == updated_content then
return 0
else
local path = dirname(file)
ren(path,filename,filename .. ".bak")
f = assert(io.open(file,"w"))
-- Convert line ends back if required during write
-- Watch for the second return value!
f:write((string.gsub(updated_content,"\n",os_newline)))
f:close()
rm(path,filename .. ".bak")
end
cp("biblatex.sty",unpackdir,testdir)
return 0
end
-- For the manual
docfiledir = "./doc/latex/biblatex"
docfiles = {"**/*.pdf", "**/*.tex"}
typesetexe = "lualatex"
typesetfiles = {"biblatex.tex"}
flatten = false
flattentds = false
packtdszip = true
maxprintline = 9999
supportdir = docfiledir .. "/examples"
checksuppfiles = {"*.bib", "*.dbx"}
testsuppdir = "./bibtex/bib/biblatex"
checkconfigs = {"testconfig-pdftex",
"testconfig-luatex",
"testconfig-xetex",
"testconfig-index-simple",
"testconfig-index-multiple"}