Subversion Repositories TPPL

Rev

Rev 32 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/bash

## note: check with bash -n

## prelude

shopt -s -o errexit
shopt -s -o nounset

if [[ -L "$0" ]] # symlink resolution
then
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "${TARGET}")"; pwd)/$(basename "${TARGET}")" ${@+"$@"}
fi

THIS="$(basename "$0")"
HERE="$(cd $(dirname "$0"); cd "$(pwd -P)"; pwd)"

trap 'echo "Error while executing ${THIS}" >&2' ERR

function fail {
  echo "$1" >&2
  exit 1
}

function usage {
  cat <<EOF
Usage: ${THIS}
EOF
  exit 2
}


## settings

ROOT_FORMLOS='TPPL-formlos'
ROOT_ABSTRACT='TPPL-abstract'
ROOT_ISABELLE='TPPL-isabelle'
ROOT_GOALS='TPPL-goals'
ROOT_REQUIRE='TPPL-requirements'


## functions

function delete_junk {
  rm -f *.aux *.out *.ind *.idx *.ilg *.bbl *.blg *.log *.bak
}


## main

delete_junk

for CONTENT in TPPL-*-content.tex
do
  aspell --lang=en_GB --home-dir=dict/ --save-repl --mode=tex check "${CONTENT}"
done

for ROOT in "${ROOT_FORMLOS}" "${ROOT_ABSTRACT}" "${ROOT_ISABELLE}" "${ROOT_GOALS}" "${ROOT_REQUIRE}"
do
  pdflatex "${ROOT}.tex"
  bibtex "${ROOT}" || true
  pdflatex "${ROOT}.tex"
  pdflatex "${ROOT}.tex"
done

echo
echo Open ends:
grep -Pn '\\(fix|cite|ref)me' *.tex || echo None

delete_junk