forked from LogCreative/SJTUBeamermin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.lua
More file actions
55 lines (47 loc) · 2.08 KB
/
build.lua
File metadata and controls
55 lines (47 loc) · 2.08 KB
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
#!/usr/bin/env texlua
-- Windows MikTeX still have l3build bug!
-- Use ubuntu to compile.
-- https://github.com/latex3/l3build/issues/185
module = "sjtubeamermin"
sourcefiledir = "source"
sourcefiles = {"*.ins","*.dtx","sjtucnlogo.pdf","sjtuenlogo.pdf"}
installfiles = {"*.sty","sjtucnlogo.pdf","sjtuenlogo.pdf"}
docfiledir = "doc"
typesetexe = "xelatex"
typesetfiles = {"sjtubeamermintheme.tex","sjtubeamermindevguide.tex"}
typesetdemofiles = {"red.tex","blue.tex","my.tex"}
typesetsuppfiles = {"head.png","plant.jpg","test.csv","testgraph.tex","ref.bib","cnlogored.pdf","enlogored.pdf"}
testfiledir = "test"
checkengines = {"xetex"}
checkopts = "-interaction=batchmode"
packtdszip = true -- recommended for "tree" layouts
tagfiles = {"*.dtx","README.md","*.ins","sjtubeamermintheme.tex","sjtubeamermindevguide.tex"}
-- Detail how to set the version automatically
function update_tag(file,content,tagname,tagdate)
local iso = "%d%d%d%d%-%d%d%-%d%d"
if string.match(content,"%(C%)%s*[%d%-,]+") then
local year = os.date("%Y")
content = string.gsub(content,
"%(C%)%s*([%d%-,]+)",
"(C) %1," .. year)
content = string.gsub(content,year .. "," .. year,year)
content = string.gsub(content,
"%-" .. math.tointeger(year - 1) .. "," .. year,
"-" .. year)
content = string.gsub(content,
math.tointeger(year - 2) .. "," .. math.tointeger(year - 1) .. "," .. year,
math.tointeger(year - 2) .. "-" .. year)
end
local now = os.date("%Y-%m-%d")
if string.match(file,"%.dtx$") then
content = string.gsub(content,
"\n\\ProvidesPackage" .. "({%w+})%[" .. iso .. "([^%]]+) v%d%.%d%]",
"\n\\ProvidesPackage%1[" .. now .. "%2 v" .. tagname .. "]")
return content
elseif string.match(file,"%.tex$") then
return string.gsub(content,
"\n\\date%{%d%.%d ([^%}]+)%}\n",
"\n\\date{" .. tagname .. " %1}\n")
end
return content
end