aboutsummaryrefslogtreecommitdiff
path: root/.scripts/compile
diff options
context:
space:
mode:
authorMarvin Borner2020-06-18 19:21:11 +0200
committerMarvin Borner2020-06-18 19:21:11 +0200
commitfab2ca72e0bdebea01160a6d77ab5b62ff4e4316 (patch)
tree5b03d31ae24458f6f86e30399ae617834a9e29b2 /.scripts/compile
parented81a60c898949c3c72a07e78d6fe215fa3e2c8d (diff)
Added text-based boilerplates and better previews
Diffstat (limited to '.scripts/compile')
-rwxr-xr-x.scripts/compile8
1 files changed, 6 insertions, 2 deletions
diff --git a/.scripts/compile b/.scripts/compile
index 41dd951..fec470c 100755
--- a/.scripts/compile
+++ b/.scripts/compile
@@ -1,18 +1,22 @@
#!/usr/bin/env sh
file=$(readlink -f "$1")
+dir=${file%/*}
base="${file%.*}"
ext="${file##*.}"
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 pdf -ms -kept >"$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" ;;
+[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" ;;
-sent) setsid -f sent "$file" 2>/dev/null ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac