Merge branch 'master' of github.com:LukeSmithxyz/voidrice
This commit is contained in:
commit
830a38f84d
1 changed files with 28 additions and 5 deletions
|
@ -1,20 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# This script will compile or run another finishing operation on a document. I
|
# This script will compile or run another finishing operation on a document. I
|
||||||
# have this script run via vim.
|
# have this script run via vim/emacs.
|
||||||
#
|
#
|
||||||
# tex files: Compiles to pdf, including bibliography if necessary
|
# tex files: Compiles to pdf, including bibliography if necessary
|
||||||
# md files: Compiles to pdf via pandoc
|
# md files: Compiles to pdf via pandoc
|
||||||
# rmd files: Compiles via R Markdown
|
# rmd files: Compiles via R Markdown
|
||||||
|
# c files: Compiles via whatever compiler is set to cc. Usually gcc.
|
||||||
|
# py files: runs via python command
|
||||||
|
# go files: compiles and runs with "go run"
|
||||||
# config.h files: (For suckless utils) recompiles and installs program.
|
# config.h files: (For suckless utils) recompiles and installs program.
|
||||||
# all others: run `sent` to show a presentation
|
# all others: run `sent` to show a presentation
|
||||||
|
|
||||||
|
|
||||||
oridir=$(pwd)
|
oridir=$(pwd)
|
||||||
|
|
||||||
file=$(readlink -f "$1")
|
file=$(readlink -f "$1")
|
||||||
dir=$(dirname "$file")
|
dir=$(dirname "$file")
|
||||||
base="${file%.*}"
|
base="${file%.*}"
|
||||||
cd "$dir" || exit
|
shebang=$(sed -n 1p $file)
|
||||||
|
|
||||||
|
cd $dir
|
||||||
|
|
||||||
|
|
||||||
textype() { \
|
textype() { \
|
||||||
command="pdflatex"
|
command="pdflatex"
|
||||||
|
@ -26,11 +33,27 @@ textype() { \
|
||||||
$command --output-directory="$dir" "$base"
|
$command --output-directory="$dir" "$base"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shebangtest() {
|
||||||
|
case "$shebang" in
|
||||||
|
\#\!*) "$file" ;;
|
||||||
|
*) sent "$file" 2>/dev/null & ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
case "$file" in
|
case "$file" in
|
||||||
*\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla ;;
|
*\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla && mv "$base".pdf "$dir"/pdfs;;
|
||||||
*\.tex) textype "$file" ;;
|
*\.tex) textype "$file" ;;
|
||||||
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
|
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
|
||||||
*config.h) make && sudo make install ;;
|
*config.h) make && sudo make install ;;
|
||||||
*) sent "$file" 2>/dev/null & ;;
|
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||||
|
*\.py) python "$file" ;;
|
||||||
|
*\.go) go run "$file" ;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*) shebangtest ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
cd "$oridir" || exit
|
cd $oridir
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue