Merge branch 'main' of ssh://gitlab.com/tavo-wasd/dotfiles
some merge
This commit is contained in:
commit
c123ade27a
2 changed files with 30 additions and 7 deletions
|
@ -1,20 +1,23 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Small compiler script for groff
|
||||
# Compiler script for groff
|
||||
#
|
||||
# [-k (preconv)] Convert encoding to something groff understands
|
||||
# [-e (eqn)] Format equations for troff or MathML
|
||||
# [-t (tbl)] Format tables for troff
|
||||
# [-p (pic)] Compile pictures for troff or TeX
|
||||
# [-G (grap)] Typesetting graphs
|
||||
# [-G (grap)] Typesetting graphs (grap usually not installed by default)
|
||||
# [-j (chem)] Chemical structure diagrams (messes up spacing!)
|
||||
|
||||
# Configuration
|
||||
BIB="$HOME/Desktop/bibliography" # Bibliography file
|
||||
MAC="$HOME/.config/groff/" # Macros dir
|
||||
PRE="ketp" # Preprocessors
|
||||
|
||||
# Enable macros, grab references, include args
|
||||
soelim -I "$MAC" "$1" | refer -p "$BIB" |
|
||||
groff -mspdf -T pdf -U -"$PRE"
|
||||
PRE="-ketpG" # Preprocessors
|
||||
GROMACS="-mspdf" # groff macros
|
||||
OUT="pdf" # Output format
|
||||
|
||||
# groff-img: Personal script, image manipulation
|
||||
# soelim: Enable macros dir
|
||||
# refer: Enable bibliography
|
||||
groff-img "$1" | soelim -I "$MAC" | refer -p "$BIB" |
|
||||
groff "$GROMACS" -T "$OUT" -U "$PRE"
|
||||
|
|
20
scripts/groff-img
Executable file
20
scripts/groff-img
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Replace .IMG commands for proper
|
||||
# .PDFPIC and convert given image files.
|
||||
|
||||
FILE="$1"
|
||||
OUTPUT="$(cat "$FILE")"
|
||||
|
||||
format() {
|
||||
LINE="$1"
|
||||
IMAGE="$(echo "$LINE" | cut -d '"' -f 2)"
|
||||
[ "$IMAGE" != "${IMAGE%%.*}.pdf" ] && ! [ -e "${IMAGE%%.*}.pdf" ] && convert -quiet "$IMAGE" "${IMAGE%%.*}.pdf"
|
||||
echo "$LINE" | sed 's|^.IMG|.PDFPIC|' | sed "s|$IMAGE|${IMAGE%%.*}.pdf|"
|
||||
}
|
||||
|
||||
for i in $(seq $(grep '^.IMG\s' "$FILE" | wc -l)) ; do
|
||||
LINE="$(echo "$OUTPUT" | grep '^.IMG\s' | head -n 1)"
|
||||
[ -n "$LINE" ] && NEW_LINE="$(format "$LINE")" && OUTPUT=$(echo "$OUTPUT" | sed "s|$LINE|$NEW_LINE|") || break
|
||||
done
|
||||
|
||||
echo "$OUTPUT"
|
Loading…
Reference in a new issue