prettier
This commit is contained in:
parent
ba6ee9bd99
commit
c5148a46c4
1 changed files with 10 additions and 15 deletions
|
@ -1,29 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Compiler script for groff
|
# Compiler script for groff
|
||||||
#
|
|
||||||
# TODO:
|
|
||||||
# - Make groffc auto-calculate image height (spacing below) (already done with 1.23.0?)
|
|
||||||
# based on given width and the image's aspect ratio.
|
|
||||||
#
|
|
||||||
# [-k (preconv)] Convert encoding to something groff understands
|
# [-k (preconv)] Convert encoding to something groff understands
|
||||||
# [-e (eqn)] Format equations for troff or MathML
|
# [-e (eqn)] Format equations for troff or MathML
|
||||||
# [-t (tbl)] Format tables for troff
|
# [-t (tbl)] Format tables for troff
|
||||||
# [-p (pic)] Compile pictures for troff or TeX
|
# [-p (pic)] Compile pictures for troff or TeX
|
||||||
# [-G (grap)] Typesetting graphs, usually not installed by default and not available on termux repo
|
# [-G (grap)] Typesetting graphs, usually not installed by default and not available on termux repo
|
||||||
# [-j (chem)] Chemical structure diagrams, messes with spacing, crashes when using text inside eqn
|
# [-j (chem)] Chemical structure diagrams, messes with spacing, crashes when using text inside eqn
|
||||||
|
|
||||||
BIN="$0"
|
BIN="$0"
|
||||||
|
|
||||||
print_y() {
|
# Configuration
|
||||||
|
BIB="$HOME/Documents/bibliography" # Bibliography file
|
||||||
|
MAC="$HOME/.config/groff/" # Macros dir
|
||||||
|
PRE="-ketp" # Preprocessors
|
||||||
|
|
||||||
|
success() {
|
||||||
printf "\033[2m%s:\033[0m \033[32m%s\033[0m\n" "$BIN" "$1"
|
printf "\033[2m%s:\033[0m \033[32m%s\033[0m\n" "$BIN" "$1"
|
||||||
}
|
}
|
||||||
|
error() {
|
||||||
print_n() {
|
|
||||||
printf "\033[2m%s:\033[0m \033[31m%s\033[0m\n" "$BIN" "$1"
|
printf "\033[2m%s:\033[0m \033[31m%s\033[0m\n" "$BIN" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
[ -z "$FILE" ] && print_n "No file given" && exit 1
|
[ -z "$FILE" ] && error "No file given" && exit 1
|
||||||
OUT="${FILE%%.ms}.pdf"
|
OUT="${FILE%%.ms}.pdf"
|
||||||
[ "$FILE" = "clean" ] && MODE="clean"
|
[ "$FILE" = "clean" ] && MODE="clean"
|
||||||
|
|
||||||
|
@ -39,10 +37,6 @@ OUT="${FILE%%.ms}.pdf"
|
||||||
[ -e "/usr/local/bin/groff" ] && GROFF="/usr/local/bin/groff"
|
[ -e "/usr/local/bin/groff" ] && GROFF="/usr/local/bin/groff"
|
||||||
[ -z "$GROFF" ] && GROFF="groff"
|
[ -z "$GROFF" ] && GROFF="groff"
|
||||||
|
|
||||||
BIB="$HOME/Documents/bibliography" # Bibliography file
|
|
||||||
MAC="$HOME/.config/groff/" # Macros dir
|
|
||||||
PRE="-ketp" # Preprocessors
|
|
||||||
|
|
||||||
# Takes a line with .IMG command, converts given image
|
# Takes a line with .IMG command, converts given image
|
||||||
# to pdf format and inserts properly formatted .PDFPIC
|
# to pdf format and inserts properly formatted .PDFPIC
|
||||||
auto_pdfpic() {
|
auto_pdfpic() {
|
||||||
|
@ -67,8 +61,9 @@ get_image() {
|
||||||
echo "$LINE" | sed "s|$URL|_img/$UID.$EXT|"
|
echo "$LINE" | sed "s|$URL|_img/$UID.$EXT|"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove cached images and generated pdfs
|
||||||
clean() {
|
clean() {
|
||||||
print_y "Cleaning up..."
|
success "Cleaning up..."
|
||||||
for msdoc in *.ms ; do
|
for msdoc in *.ms ; do
|
||||||
rm -fv ${msdoc%%.*}.pdf
|
rm -fv ${msdoc%%.*}.pdf
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue