This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ldb2pdf script that uses different stylesheets ...


Hi,

Here is a modification to the db2pdf script that comes with RedHat 7.0 ...
as part of the stylesheets-1.54 RPM.

This modification allows you to have a stylesheet with the same name as the
document sgml file in the directory containing the SGML source (if document
is called fred.sgml, the script looks for fred.dsl), but if that cannot be
found, the script looks for stylesheet.dsl in the same directory as the
source, otherwise it falls back to the default one.

#! /bin/sh

#STYLESHEET=/usr/lib/sgml/stylesheets/cygnus-both.dsl
#STYLESHEET=./stylesheet.dsl

TMPFN=`echo $1 | sed 's/\.sgml//'`
TMPFN1=${TMPFN}_tmp

if [ $# -gt 2 ]
then
  echo "Usage: `basename $0` [filename.sgml]" >&2
  exit 1
fi

if [ $# -eq 1 ]
then
  if [ ! -r $1 ]
  then
    echo Cannot read \"$1\".  Exiting. >&2
    exit 1
  fi
  if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1
  then
    output="`echo $1 | sed 's,\.sgml$,.pdf,;s,\.sgm$,.pdf,'`"
  fi
fi

SOURCEDIR=`dirname $1`
SOURCEFILE=`basename $1 .sgml`

if [ -f ${SOURCEDIR}/${SOURCEFILE}.dsl ]; then
  STYLESHEET=${SOURCEDIR}/${SOURCEFILE}.dsl
else
  if [ -f ${SOURCEDIR}/stylesheet.dsl ]; then
    STYLESHEET=${SOURCEDIR}/stylesheet.dsl
  else
    STYLESHEET=/usr/lib/sgml/stylesheets/cygnus-both.dsl
  fi
fi

jade -E 1000 -t tex -d ${STYLESHEET}\#print -o ${TMPFN1}.tex $1

# Now, check for any <<, >> etc sequences

sed -e 's/>>/>{>}/' -e 's/<</<{<}/' ${TMPFN1}.tex > ${TMPFN}.tex
rm -f ${TMPFN1}.tex

pdfjadetex $TMPFN

if egrep '^LaTeX Warning: There were undefined references.$' ${TMPFN}.log >/dev/null 2>&1
then
  pdfjadetex $TMPFN
  pdfjadetex $TMPFN
fi


#if [ -f ${TMPFN}.cfg ]
#then
#  mv ${TMPFN}.cfg jade.cfg
#fi

exit 0



Regards
-------
Richard Sharpe, sharpe@ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.ethereal.com)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]