File: make-pdf.sh

package info (click to toggle)
parenscript 1%3A20061003-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 376 kB
  • ctags: 313
  • sloc: lisp: 2,976; python: 350; makefile: 38; sh: 34
file content (57 lines) | stat: -rw-r--r-- 1,502 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# Time-stamp: <2006/02/26 18:07:29 CET luca@gismo.pca.it>
#
# make-pdf.sh -- generate ParenScript documentation from lisp sources
#                via the pbook.py script and pdflatex
#
# (C) 2006 Luca Capello <luca@pca.it> http://luca.pca.it
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# You can find the GPL at /usr/share/common-licenses/GPL


USR_SHARE="/usr/share"
USR_DOC="$USR_SHARE/doc/cl-parenscript/scripts"
USR_SOURCE="$USR_SHARE/common-lisp/source/parenscript"

usage () {
    echo "Usage: sh $0 \$FILE \$OUTPUT_FOLDER"
    echo
    echo "\$FILE is one of introduction.lisp, reference.lisp or tutorial.lisp."
    echo
    echo "If not specified, \$OUTPUT_FOLDER is equal to \$HOME."
    echo
    echo "You need the tetex-bin and tetex-extra packages."
    echo
    exit 1
}

test -x /usr/bin/pdflatex || usage
test ! -z $1 || usage

LISP_FILE="introduction.lisp reference.lisp tutorial.lisp"
for ARG1 in $LISP_FILE; do
    if test "$1" == "$ARG1"; then
        CONTINUE=1
    fi
done
test "$CONTINUE" == "1" || usage

PDF_OUTPUT="`basename $1 .lisp`.pdf"
if test -z $2; then
    OUTPUT="$HOME/$PDF_OUTPUT"
else
    OUTPUT="$OUTPUT/$PDF_OUTPUT"
fi

cp -f $USR_DOC/pbook.py.gz /tmp/
gunzip /tmp/pbook.py.gz
python /tmp/pbook.py -o $OUTPUT $USR_SOURCE/docs/$1
rm -rf /tmp/pbook.py

exit 0