dotfiles

Luke's GNU/Linux dotfiles for i3, vim, ranger, bash, mpd, etc.
git clone git@git.lukesmith.xyz:dotfiles
Log | Files | Refs | README | LICENSE

commit 595ae287e1884105e3fdf30d87989cb3e54fcb2d
parent 5fc6f7459844c6c378c303d380eb52a5945c27fa
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Wed, 25 Jul 2018 13:45:05 -0400

cleanup, script now runable anywhere

Diffstat:
M.scripts/compiler | 34+++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/.scripts/compiler b/.scripts/compiler @@ -1,32 +1,32 @@ #!/bin/bash -# This is a compilation handler, so to speak, which I have vim run. +# This script will compile or run another finishing operation on a document. I +# have this script run via vim. # -# It compiles a document to pdf -# -# If you put the sequence `xelatex` somewhere in the first 5 lines of a .tex -# file, it will be compiled with `xelatex` rather than `pdflatex`. -# -# If it detects an `addbibresource` line, it will run `biber` and perform -# multiple compiles to get the references correct. +# tex files: Compiles to pdf, including bibliography if necessary +# md files: Compiles to pdf via pandoc +# rmd files: Compiles via R Markdown +# config.h files: (For suckless utils) recompiles and installs program. +# all others: run `sent` to show a presentation file=$(readlink -f "$1") -ext="${file##*.}" +dir=$(dirname "$file") base="${file%.*}" textype() { \ command="pdflatex" ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" - $command "$base" && + $command --output-directory="$dir" "$base" && grep -i addbibresource "$file" && - biber "$base" && - $command "$base" && - $command "$base" + biber --input-directory "$dir" "$base" && + $command --output-directory="$dir" "$base" && + $command --output-directory="$dir" "$base" } -case "$ext" in - rmd) echo "require(rmarkdown); render('$file')" | R --vanilla ;; - tex) textype "$file" ;; - md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; +case "$file" in + *\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla ;; + *\.tex) textype "$file" ;; + *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; + *config.h) make && sudo make install ;; *) sent "$file" 2>/dev/null & ;; esac