File: builddocs

package info (click to toggle)
qbrew 0.4.1-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,440 kB
  • ctags: 1,070
  • sloc: cpp: 7,503; sh: 394; makefile: 30
file content (54 lines) | stat: -rwxr-xr-x 1,147 bytes parent folder | download | duplicates (5)
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
#! /bin/sh

STYLESHEET=handbook.xsl
HANDBOOK=handbook.docbook

# check for xsltproc
xsltfound=`which xsltproc`
if [ -z "$xsltfound" ] ; then
  echo "Error: xsltproc not found!"
  echo "Please make sure xsltproc is installed and in your path"
  exit
fi

# check for sed
sedfound=`which sed`
if [ -z "$sedfound" ] ; then
  echo "Error: sed not found!"
  echo "Please make sure sed is installed and in your path"
  exit
fi

# check for tidy
tidyfound=`which tidy`
if [ -z "$tidyfound" ] ; then
  echo "Warning: tidy not found!"
fi

# create output directory
rm -rf book
mkdir book
cd book

# process xml
if [ -e ../$HANDBOOK ] ; then
  echo "Processing $HANDBOOK"
  xsltproc ../$STYLESHEET ../$HANDBOOK
  if [ -n "$tidyfound" ] ; then
    tidy -indent -quiet -modify *.html
  fi
  # add prefixes to filenames (would be nice if stylesheet could do this)
  htmllist=`ls *.html`
  for htmlfile in $htmllist ; do
    filelist=`ls *.html`
    for temp in $filelist ; do
      sed -i .bak -e s/"$htmlfile"/handbook-$htmlfile/g $temp
    done
    mv ${htmlfile} handbook-${htmlfile}
  done
  rm -f *.bak
else
  echo "WARNING: $HANDBOOK not found"
fi

cd ..