Created
November 14, 2015 02:14
-
-
Save kdelwat/a5e2d6a038fb50d1ce43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git --work-tree=/var/notesworking --git-dir=/var/notes checkout -f | |
changed=$(git diff-tree -r HEAD | sed 's/^.*\s[A-Z]\s\s*//g' | sed 1d) | |
for filename in $changed | |
do | |
echo $filename | |
filetype=$(echo $filename | sed 's/.*\.//g') | |
if [ $filetype == "md" ] | |
then | |
stripped=$(echo $filename | sed 's/.md//g') | |
fullpath=/var/notesworking/$filename | |
tempoutpath=/var/notesworking/$stripped".pdf" | |
outpath=/var/www/notes/$stripped".pdf" | |
echo $fullpath | |
echo $outpath | |
onlyfilename=$(echo $stripped | sed 's/^.*\///g') | |
sedString="s/"$onlyfilename".*$//g" | |
workingd=$(echo $fullpath | sed $sedString) | |
outd=$(echo $outpath | sed $sedString) | |
mkdir -p $outd | |
cd $workingd | |
pandoc $fullpath -t latex -o $outpath --latex-engine=xelatex | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment