forked from drehscheibe/soul
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.lua
69 lines (55 loc) · 1.72 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
#!/usr/bin/env texlua
module = "soul"
installfiles = {
'soul.sty',
'soul-ori.sty',
'soulutf8.sty',
'soul.dtx',
'soul-ori.dtx','*.pdf'
}
sourcefiles={"soul.dtx","soul-ori.dtx","soul.ins"}
typesetfiles={"soul.dtx","soul-ori.dtx"}
textfiles = {"README.md"}
--unpackfiles = {'soul.dtx',"soul-ori.dtx"}
--packtdszip = true
maxprintline=10000
checkruns = 2
tdslocations={
"doc/latex/soul/soul.pdf",
"doc/latex/soul/soul-ori.pdf",
"source/latex/soul/soul.dtx",
"source/latex/soul/soul-ori.dtx",
"tex/generic/soul/soul.sty",
"tex/generic/soul/soul-ori.sty",
"tex/latex/soul/soulutf8.sty",
}
checkconfigs = {"build","config-pdftex"}
function update_tag(file,content,tagname,tagdate)
local tagpattern="(%d%d%d%d[-/]%d%d[-/]%d%d) v(%d+[.])(%d+)"
local oldv,newv
if tagname == 'auto' then
local i,j,olddate,a,b
i,j,olddate,a,b= string.find(content, tagpattern)
if i == nil then
print('OLD TAG NOT FOUND')
return content
else
print ('FOUND: ' .. olddate .. ' v' .. a .. b )
oldv = olddate .. ' v' .. a .. b
newv = tagdate .. ' v' .. a .. math.floor(b + 1)
print('USING OLD TAG: ' .. oldv)
print('USING NEW TAG: ' .. newv)
local oldpattern = string.gsub(oldv,"[-/]", "[-/]")
content=string.gsub(content,"{Version}{" .. oldpattern,'##OLDV##')
content=string.gsub(content,oldpattern,newv)
content=string.gsub(content,'##OLDV##',"{Version}{" .. oldv)
content=string.gsub(content,'%-%d%d%d%d Oberdiek Package','-' .. os.date("%Y") .. " Oberdiek Package")
content = string.gsub(content,
'%% \\end{History}',
'%% \\begin{Version}{' .. newv .. '}\n%% \\item Updated\n%% \\end{Version}\n%% \\end{History}')
return content
end
else
error("only automatic tagging supported")
end
end