summaryrefslogtreecommitdiff
path: root/export.sh
blob: 95f5f9763a8a0ef535e92d9fe15af53a905fdced (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

shopt -s nullglob

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