-
Notifications
You must be signed in to change notification settings - Fork 143
/
build.lua
145 lines (130 loc) · 4.21 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env texlua
-- Build script for "beamer" files
-- Identify the bundle and module
bundle = ""
module = "beamer"
-- Non-standard structure
docfiledir = "./doc"
sourcefiledir = "./base"
flattentds = false
-- Install all files from the source tree directly
installfiles = {"**/*.cls", "**/*.sty", "**/beamericon*.*", "**/*.tex"}
sourcefiles = installfiles
unpackfiles = { }
-- Typeset only the main documentation file,
-- but make all sources available
docfiles =
{
"**/*.jpg",
"**/*.tex",
"**/*.txt",
"**/beamerlogo.pdf",
"**/beamerexample-lecture-logo.pdf"
}
typesetfiles =
{
"beameruserguide.tex",
"beamerexample-conference-talk.tex",
"beamerexample-lecture-beamer-version.tex",
"beamerexample-lecture-print-version.tex"
}
-- Only copy Markdown files to main dir
textfiles = {"*.md"}
-- Custom clean-up settings
cleanfiles = {"beameruserguide.pdf", "*.zip"}
-- Test set up
checkengines = {"pdftex"}
checksuppfiles = {"*.tex"}
-- Use standard MakeIndex style
indexstyle = ""
-- Auto-versioning
tagfiles = {"beamer.cls", "beamerarticle.sty", "beameruserguide.tex", "CHANGELOG.md"}
function update_tag(file,content,tagname,tagdate)
local tagdate = string.gsub(tagdate,"%-","/")
if string.match(file,"%.tex") then
return string.gsub(content,
"\\def\\beamerugversion{%d%.%d+}",
"\\def\\beamerugversion{" .. string.gsub(tagname,"^v","") .. "}")
elseif string.match(file,"CHANGELOG.md") then
local url = "https://github.com/josephwright/beamer/compare/"
local previous = string.match(content,"compare/(v%d%.%d%d)%.%.%.HEAD")
if tagname == previous then return content end
content = string.gsub(content,
"## %[Unreleased%]",
"## [Unreleased]\n\n## [" .. tagname .."]")
return string.gsub(content,
"v%d.%d%d%.%.%.HEAD",
tagname .. "...HEAD\n[" .. tagname .. "]: " .. url .. previous
.. "..." .. tagname)
else
return string.gsub(content,
"%d%d%d%d/%d%d/%d%d v?%d%.%d+",
tagdate .. " " .. tagname)
end
end
-- Release a TDS-style zip
packtdszip = true
-- Preserve structure for CTAN
flatten = false
-- Custom data for the theme demos
themes =
{
core =
{
"AnnArbor", "Antibes", "Berkeley", "Berlin", "Bergen", "Boadilla",
"Copenhagen", "Darmstadt", "Dresden", "EastLansing", "Frankfurt",
"Goettingen", "Hannover", "Ilmenau", "JuanLesPins", "Luebeck",
"Malmoe", "Madrid", "Marburg", "Montpellier", "PaloAlto",
"Pittsburgh", "Rochester", "Singapore", "Szeged", "Warsaw",
"CambridgeUS", "default", "boxes"
},
font =
{
"default", "serif", "structurebold", "structureitalicserif",
"structuresmallcapsserif"
},
color =
{
"default", "crane", "albatross", "seahorse", "whale", "dolphin",
"rose", "orchid", "sidebartab", "lily", "structure", "dove", "seagull",
"beetle", "fly", "wolverine", "spruce", "beaver", "monarca",
"albatrossstylish" -- This is a special case: see the .tex file
},
outer =
{
"default", "infolines", "miniframes", "shadow", "sidebar",
"smoothbars", "smoothtree", "split", "tree"
},
inner = {"default", "circles", "rectangles", "rounded", "inmargin"}
}
function typeset_demo_tasks()
local errorlevel = 0
for type,themelist in pairs(themes) do
local themetype = ""
if type~= "core" then themetype = tostring(type) end
local name = "beamer" .. themetype .. "themeexample.tex"
for _,theme in pairs(themelist) do
print( -- printing current job for easier debugging
"\nrunning pdflatex \"\\def\\themename{" .. theme .. "}"
.. "\\input " .. name .. "\" \n"
)
errorlevel = errorlevel + runcmd(
"pdflatex \"\\def\\themename{" .. theme .. "}"
.. "\\input " .. name .. "\" ",
typesetdir, {"TEXINPUTS"}
)
if errorlevel ~= 0 then
return errorlevel
end
ren(typesetdir,
string.gsub(name, "%.tex$", ".pdf"),
"beamerug" .. themetype .. "theme" .. theme .. ".pdf")
end
end
return 0
end
-- Find and run the build system
kpse.set_program_name ("kpsewhich")
if not release_date then
dofile(kpse.lookup("l3build.lua"))
end