Marty Oehme
bd96394d67
Pdfs will be compiled, replacing special characters with underscores; this fix also looks for underscored files when trying to open the compiled version of a file. The Library environment variable (for my default bibtex library directory) overwrote yay's library directory; it has been renamed to LIBRARYROOT to both mirror WIKIROOT as my note directory and keep the LIBRARY variable empty so yay will continue working.
28 lines
1 KiB
Bash
Executable file
28 lines
1 KiB
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# opout: "open output": A general handler for opening a file's intended output,
|
|
# usually the pdf of a compiled document. I find this useful especially
|
|
# running from vim.
|
|
#
|
|
# from https://github.com/LukeSmithxyz/voidrice/tree/master/.local/bin
|
|
|
|
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
|
|
|
|
openCompiledDoc() {
|
|
if [ -f "$basename".pdf ]; then
|
|
setsid "$FILEREADER" "$basename.pdf"
|
|
elif [ -f "$(echo "$basename" | sed 's/ /-/g')".pdf ]; then
|
|
setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /-/g').pdf"
|
|
elif [ -f "$(echo "$basename" | sed 's/ /_/g')".pdf ]; then
|
|
setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /_/g').pdf"
|
|
elif [ -f "$basename".html ]; then
|
|
setsid "$BROWSER" "$basename.html"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
# *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$FILEREADER" "$basename".pdf >/dev/null 2>&1 & ;;
|
|
*.tex|*.md|*.[Rr]md|*.ms|*.me|*.mom) openCompiledDoc >/dev/null 2>&1 & ;;
|
|
*.[0-9]) openCompiledDoc >/dev/null 2>&1 & ;;
|
|
*.html) openCompiledDoc >/dev/null 2>&1 & ;;
|
|
esac
|