| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
module = "elegantbook" |
| 11 |
version = "4.7 2026-05-01" |
| 12 |
maintainer = "Ran Wang" |
| 13 |
uploader = maintainer |
| 14 |
maintainid = "ElegantLaTeX" |
| 15 |
email = "[email protected]" |
| 16 |
repository = "https://github.com/" .. maintainid .. "/" .. module |
| 17 |
announcement = "Fix corrupted image files in previous upload and update metadata." |
| 18 |
note = "" |
| 19 |
summary = "Elegant LaTeX Template for Books" |
| 20 |
description = [[ElegantBook is designed for writing Books. This template is based on the standard LaTeX book class. The goal of this template is to make the writing process more elegant.]] |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
ctanzip = module |
| 27 |
excludefiles = {"*~"} |
| 28 |
textfiles = {"*.md", "LICENSE", "*.lua", "*.cls", "*.bib", "*.tex"} |
| 29 |
typesetexe = "latexmk -pdf" |
| 30 |
typesetfiles = {module .. "-cn.tex", module .. "-en.tex"} |
| 31 |
typesetopts = "-interaction=nonstopmode" |
| 32 |
typesetruns = 1 |
| 33 |
typesetsuppfiles = {"*.cls", "*.bib"} |
| 34 |
imagesuppdir = "image" |
| 35 |
figuresuppdir = "figure" |
| 36 |
specialtypesetting = specialtypesetting or {} |
| 37 |
specialtypesetting[module .. "-cn.tex"] = {cmd = "latexmk -pdfxe"} |
| 38 |
binaryfiles = {"*.png", "*.jpg", "*.pdf"} |
| 39 |
sourcefiles = {"*.cls", "*.bib"} |
| 40 |
docfiles = { |
| 41 |
"*.pdf", "*.md", "LICENSE", |
| 42 |
module .. "-cn.tex", module .. "-en.tex", |
| 43 |
"figure/*", "image/*" |
| 44 |
} |
| 45 |
|
| 46 |
uploadconfig = { |
| 47 |
pkg = module, |
| 48 |
version = version, |
| 49 |
author = maintainer, |
| 50 |
uploader = uploader, |
| 51 |
email = email, |
| 52 |
summary = summary, |
| 53 |
description = description, |
| 54 |
announcement = announcement, |
| 55 |
note = note, |
| 56 |
license = "lppl1.3c", |
| 57 |
ctanPath = "/macros/latex/contrib/" .. module .. "/", |
| 58 |
support = repository .. "/issues", |
| 59 |
bugtracker = repository .. "/issues", |
| 60 |
repository = repository, |
| 61 |
development = "https://github.com/" .. maintainid, |
| 62 |
update = true |
| 63 |
} |
| 64 |
|
| 65 |
function tex(file, dir, cmd) |
| 66 |
dir = dir or "." |
| 67 |
cmd = cmd or typesetexe .. " " .. typesetopts |
| 68 |
return run(dir, cmd .. " " .. file) |
| 69 |
end |
| 70 |
|
| 71 |
|
| 72 |
function docinit_hook() |
| 73 |
|
| 74 |
for _, glob in pairs(typesetsuppfiles) do |
| 75 |
cp(glob, currentdir, typesetdir) |
| 76 |
end |
| 77 |
|
| 78 |
for _, subdir in pairs({imagesuppdir, figuresuppdir}) do |
| 79 |
local dest = typesetdir .. "/" .. subdir |
| 80 |
mkdir(dest) |
| 81 |
cp("*", subdir, dest) |
| 82 |
end |
| 83 |
|
| 84 |
for _, texfile in pairs(typesetfiles) do |
| 85 |
cp(texfile, currentdir, typesetdir) |
| 86 |
end |
| 87 |
return 0 |
| 88 |
end |