summaryrefslogtreecommitdiff
path: root/.local/bin/development/getcomproot
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/development/getcomproot')
-rwxr-xr-x.local/bin/development/getcomproot14
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/bin/development/getcomproot b/.local/bin/development/getcomproot
new file mode 100755
index 0000000..16e946a
--- /dev/null
+++ b/.local/bin/development/getcomproot
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# author: Luke Smith
+#
+# A helper script for LaTeX/groff files used by `compiler` and `opout`.
+# The user can add the root file of a larger project as a comment as below:
+# % root = mainfile.tex
+# And the compiler script will run on that instead of the opened file.
+
+texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")"
+texroot="${texroot##*=}"
+texroot="${texroot//[\"\' ]}"
+
+[ -f "$texroot" ] && readlink -f "$texroot" || exit 1