blob: 38295e26efbd2db45b9b5e84684b1c3453f0c6fd (
plain) (
blame)
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
|
#!/usr/bin/env sh
file=$(readlink -f "$1")
dir=${file%/*}
base="${file%.*}"
ext="${file##*.}"
if [ -f "$dir/run" ]; then
echo "Using run file"
exec "$dir/run"
fi
case "$ext" in
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;;
#md) lowdown -d nointem -e super "$file" -Tms | groff -t -mspdf -k -Kutf8 -T pdf >"$base".pdf ;;
#md) pandoc "$file" --pdf-engine=xelatex -V geometry:a4paper -V geometry:margin=2cm -V toc-title='Table of contents' -o "$base.pdf" ;; # Xelatex is slow af
md) pandoc "$file" -V geometry:a4paper -V geometry:margin=2cm -V toc-title='Table of contents' -o "$base.pdf" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
tex) pdflatex --output-directory "$dir" "$base" ;;
sent) setsid -f sent "$file" 2>/dev/null ;;
h) sudo make install ;;
c) cc "$file" -o "$base" && "$base" ;;
py) python "$file" ;;
rs) cargo build ;;
go) go run "$file" ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac
|