-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
67 lines (51 loc) · 1.59 KB
/
Rakefile
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
require "rake/clean"
task :default => [:evince]
SRC = "presentation.tex"
RUBY_SRC = FileList["**/*.rb"]
JAVASCRIPT_SRC = FileList["**/*.js"]
ERB_SRC = FileList["**/*.rhtml"]
HTML_SRC = FileList["**/*.html"]
XML_SRC = FileList["**/*.xml"]
SVG_IMG = FileList["**/*.svg"]
CLEAN.include(%w(*.toc *.aux *.log *.lof *.bib *.bbl *.blg *.out *.snm *.vrb *.nav),
RUBY_SRC.ext("tex"),
ERB_SRC.ext("tex"),
HTML_SRC.ext("tex"),
XML_SRC.ext("tex"),
SVG_IMG.ext("png"))
CLOBBER.include(%w(pdf dvi ps).collect { |e| SRC.ext(e) })
def pdflatex(source)
sh "pdflatex -interaction=nonstopmode #{source}"
end
rule ".png" => ".svg" do |t|
sh "inkscape -e #{t.name} #{t.source}"
end
rule ".tex" => ".js" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".rb" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".rhtml" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".html" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".xml" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".pdf" => ".tex" do |t|
pdflatex(t.source)
end
file SRC.ext("pdf") => [SRC] + JAVASCRIPT_SRC.ext("tex") + RUBY_SRC.ext("tex") + ERB_SRC.ext("tex") + HTML_SRC.ext("tex") + XML_SRC.ext("tex") + SVG_IMG.ext("png")
desc "Compile PDF"
task :pdf => SRC.ext("pdf")
desc "Show compiled PDF in Evince."
task :evince => :pdf do
sh "evince #{SRC.ext("pdf")}"
end
desc "Debug compilation"
task :debug => [RUBY_SRC.ext("tex")] do |t|
latex SRC
end