Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Antoine Gréa
committed
Mar 19, 2018
1 parent
21daf58
commit 2903d8c
Showing
24 changed files
with
24 additions
and
10,133 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
#!/bin/sh | ||
OUT=${1%.*}.$2 | ||
UPDATE=$(echo "\033[1;33m%w%f\033[0m written. Updating $OUT…") | ||
|
||
while true | ||
do | ||
panzer ---quiet "$1" -o "$OUT" | ||
inotifywait -qre close_write "$1" --format "$UPDATE" | ||
#!/bin/bash | ||
|
||
EXT=$2 | ||
[[ "$2" == "" ]] && EXT="pdf" | ||
OUT=${1%.*}.$EXT | ||
UPDATE=$(echo -e "\033[1m%w%f\033[0m changed. \033[1;34mUpdating\033[0m \033[1m$OUT\033[0m…") | ||
EXTRA=" ---quiet" | ||
[[ "$EXT" == "pdf" ]] && EXTRA="$EXTRA -t latex" | ||
MD5=`md5sum $1` | ||
|
||
echo -e "\033[1;33mConverting \033[0;1m$1\033[1;33m to \033[0;1m$OUT\033[1;33m…\033[0m" | ||
(panzer "$1" -o "$OUT" $EXTRA && echo -e '\033[1;32mConverted with success !\033[0m') || echo -e '\033[1;31mConversion failed !\033[0m' | ||
|
||
echo 'Openning the result…' | ||
xdg-open $OUT & | ||
|
||
echo -e "Watching \033[1m$1\033[0m for changes…" | ||
while true ; do | ||
[[ $MD5 == "`md5sum $1`" ]] && inotifywait -qre close_write "$1" --format "$UPDATE" || echo -e "\033[1m$1\033[0m changed while converting. \033[1;34mUpdating\033[0m \033[1m$OUT\033[0m…" | ||
MD5=`md5sum $1` | ||
(panzer "$1" -o "$OUT" $EXTRA && echo -e '\033[1;32mConverted with success !\033[0m') || echo -e '\033[1;31mConversion failed !\033[0m' | ||
done |
Oops, something went wrong.