-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a5fcd44
commit 0fba364
Showing
4 changed files
with
156 additions
and
143 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# pick first markdown the file finds | ||
TEX=$(find *.tex) | ||
# remove .md file name | ||
FILE=${TEX%.tex} | ||
|
||
function ERROR { | ||
echo -e "\033[38;5;1mERROR: ${1}" | ||
exit 1 | ||
} | ||
|
||
function LOADING { | ||
echo "$1" | ||
|
||
STEP_SIZE=5 | ||
TOTAL_STEPS=$((100 / STEP_SIZE)) | ||
FILE_SIZE=$(wc -l ${FILE}.tex | cut -c 6-8) | ||
|
||
for ((k = 0; k < $TOTAL_STEPS ; k++)) | ||
do | ||
echo -ne "\033[K" | ||
echo -n "[ " | ||
|
||
for ((i = 0 ; i < k; i++)) | ||
do | ||
echo -n "#" | ||
done | ||
|
||
for (( j = i ; j < $TOTAL_STEPS ; j++ )) | ||
do | ||
echo -n " " | ||
done | ||
|
||
echo -n " ]" | ||
|
||
STEP=$((k * STEP_SIZE)) | ||
echo -ne " ${STEP} %\r" | ||
|
||
DELAY=$(( ( ( RANDOM % 5 ) * FILE_SIZE ) / 2000 )) | ||
sleep ${DELAY}s | ||
done | ||
} | ||
|
||
function delete { | ||
if [ -e *.${1} ] | ||
then | ||
rm *.${1} | ||
fi | ||
} | ||
|
||
# Remove old files | ||
delete pdf | ||
delete log | ||
delete aux | ||
delete toc | ||
delete lof | ||
delete lot | ||
delete bbl | ||
delete blg | ||
delete out | ||
|
||
# check if bibliography exists | ||
# if yes, process it | ||
if [ -e *.bib ] || [ -e *.bibtex ] | ||
then | ||
LOADING "(1/3) Processing bibliography" & | ||
pdflatex ${FILE}.tex >pdf.log && \ | ||
bibtex ${FILE}.aux >bib.log & | ||
wait | ||
if [ -e *.pdf ] | ||
then | ||
echo "[ #################### ] 100 %" | ||
echo | ||
rm *.pdf | ||
else | ||
ERROR "Could not process bibliography" | ||
fi | ||
|
||
# convert latex to pdf using pdflatex | ||
LOADING "(2/3) Preparing conversion from LaTeX to PDF" & | ||
pdflatex ${FILE}.tex >pdf.log & | ||
wait | ||
if [ -e *.pdf ] | ||
then | ||
echo "[ #################### ] 100 %" | ||
echo | ||
rm *.pdf | ||
else | ||
ERROR "PDF build failed" | ||
fi | ||
|
||
# pdflatex needs to repeat the process to account for the processing of table of contents and similar environments | ||
LOADING "(3/3) Converting LaTeX to PDF" & | ||
pdflatex ${FILE}.tex >pdf.log & | ||
wait | ||
if [ -e *.pdf ] | ||
then | ||
echo "[ #################### ] 100 %" | ||
echo | ||
else | ||
ERROR "PDF build failed" | ||
fi | ||
else | ||
# convert latex to pdf using pdflatex | ||
LOADING "(1/2) Preparing conversion from LaTeX to PDF" & | ||
pdflatex ${FILE}.tex >pdf.log & | ||
wait | ||
if [ -e *.pdf ] | ||
then | ||
echo "[ #################### ] 100 %" | ||
echo | ||
rm *.pdf | ||
else | ||
ERROR "PDF build failed" | ||
fi | ||
|
||
# pdflatex needs to repeat the process to account for the processing of table of contents and similar environments | ||
LOADING "(2/2) Converting LaTeX to PDF" & | ||
pdflatex ${FILE}.tex >pdf.log & | ||
wait | ||
if [ -e *.pdf ] | ||
then | ||
echo "[ #################### ] 100 %" | ||
echo | ||
else | ||
ERROR "PDF build failed" | ||
fi | ||
fi | ||
|
||
# Delete build files generated by pdflatex if they exist | ||
if [ "$1" == "--log" ] || [ "$2" == "--log" ] | ||
then | ||
mkdir logs | ||
mv *.log logs/ | ||
"log files are in logs folder" | ||
else | ||
delete log | ||
fi | ||
if [ "$1" == "--aux" ] || [ "$2" == "--aux" ] | ||
then | ||
mkdir aux | ||
mv *.log aux/ | ||
"aux files are in logs folder" | ||
else | ||
delete aux | ||
delete out | ||
delete toc | ||
delete lof | ||
delete lot | ||
delete bbl | ||
delete blg | ||
fi |
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,5 +1,3 @@ | ||
#!/bin/sh | ||
|
||
# remove old file | ||
if [ -e *.tex ] | ||
then | ||
|
0fba364
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: