-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.lua
58 lines (53 loc) · 1.75 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
#!/usr/bin/env texlua
-- Build script for LaTeX3 "l3build" files
-- Identify the bundle and module
module = "l3build"
bundle = ""
-- Non-standard settings
checkconfigs = {"build", "config-plain"}
checkdeps = { }
checkengines = {"pdftex", "xetex", "luatex", "ptex", "uptex"}
cleanfiles = {"*.pdf", "*.tex", "*.zip"}
installfiles = {"regression-test.tex"}
packtdszip = true
scriptfiles = {"l3build*.lua"}
scriptmanfiles = {"l3build.1"}
sourcefiles = {"*.dtx", "l3build*.lua", "*.ins"}
typesetcmds = "\\AtBeginDocument{\\DisableImplementation}"
unpackdeps = { }
tagfiles = {"l3build.dtx", "*.md", "l3build.lua"}
-- Detail how to set the version automatically
function update_tag(file,content,tagname,tagdate)
if string.match(file, "%.dtx$") then
return string.gsub(content,
"\n%% \\date{Released %d%d%d%d%-%d%d%-%d%d}\n",
"\n%% \\date{Released " .. tagname .. "}\n")
elseif string.match(file, "%.md$") then
return string.gsub(content,
"\nRelease %d%d%d%d%-%d%d%-%d%d\n",
"\nRelease " .. tagname .. "\n")
elseif string.match(file, "%.lua$") then
return string.gsub(content,
'\nrelease_date = "%d%d%d%d%-%d%d%-%d%d"\n',
'\nrelease_date = "' .. tagname .. '"\n')
end
return contents
end
function setversion_update_line(line, date, version)
local date = string.gsub(date, "%-", "/")
-- .dtx file
if string.match(line, "^%% \\date{Released %d%d%d%d/%d%d/%d%d}$") then
line = string.gsub(line, "%d%d%d%d/%d%d/%d%d", date)
end
-- Markdown files
if string.match(
line, "^Release %d%d%d%d/%d%d/%d%d$"
) then
line = "Release " .. date
end
-- l3build.lua
if string.match(line, "^release_date = \"%d%d%d%d/%d%d/%d%d\"$") then
line = "release_date = \"" .. date .. "\""
end
return line
end