summaryrefslogtreecommitdiff
path: root/export.sh
diff options
context:
space:
mode:
Diffstat (limited to 'export.sh')
-rwxr-xr-xexport.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/export.sh b/export.sh
index 085ea64..95f5f97 100755
--- a/export.sh
+++ b/export.sh
@@ -1,10 +1,20 @@
#!/usr/bin/env bash
shopt -s nullglob
-for i in *.org; do
- name="${i%%.*}"
- echo $name
- emacs "$i" --batch -f org-html-export-to-html --kill
- tail -n +4 "$name.html" | tee "$name.php"
- rm "$name.html" "$name.html~"
-done
+
+export_org_php_monstrosity() {
+ name="${1%%.*}"
+ echo $name
+ emacs "$1" --batch -f org-html-export-to-html --kill
+ tail -n +4 "$name.html" | tee "$name.php"
+ rm "$name.html" "$name.html~"
+}
+
+if [ -z "$1" ]; then
+ for i in *.org; do
+ export_org_php_monstrosity $i
+ done
+ exit
+fi
+
+export_org_php_monstrosity $1