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 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#!/bin/bash
# Copyright (c) 2002 by Niklaus Giger
# Last modification, 24 february 2002
#
#
# A script to automate the generation of the output of LyX-DocBook files
#
#
# ----------------- Built-in options ----------
#
export LYX=lyx
export PICT_FORMAT=.png
export CHARSET=EUC-KR
#
#
# ----------------- Check-User inpurt ---------
#
if [ $# -ne 1 ]
then
echo "useage:> treat <lyxfile>"
exit
fi
#
# ----------------- LYX -> SGML ---------------
#
for i in $@
do
echo "Transforming $i.lyx -> $i.sgml file"
$LYX -e docbook $@
done
#
# ----------------- SGML -> HTML ---------------
#
for i in $@
do
echo "Transforming $i.smgl -> $i/*.html files"
sgmltools -b html $@.sgml
done
#
# ----------------- Patching HTML --------------
#
for i in $@/*html
do
echo "Patching HTML-file $i "
awk \
'{ /.gif/ gsub( ".gif", ENVIRON["PICT_FORMAT"])} \
{ /\/HEAD>/ gsub( "/HEAD", "meta http-equiv=\"Content-Type\" \
content=\"text/html; charset=\""ENVIRON["CHARSET"]"\"> </HEAD"); print } '\
$i > $i.tmp
mv $i.tmp $i
done
#
# ----------------- Copy/Convert pictures --------------
#
for i in `grep '\<SRC=' $1/*html | cut -d\" -f2`
do
if test -f ${i/.eps/$PICT_FORMAT}
then
# if there is a newer $PICT_FORMAT in our directory
# then we copy it into the new directory
echo "copying ${i/.eps/$PICT_FORMAT} -> $1/${i/.eps/$PICT_FORMAT}"
cp ${i/.eps/$PICT_FORMAT} $1/${i/.eps/$PICT_FORMAT}
else
# we convert it
echo "convert $i -> $1/${i/.eps/$PICT_FORMAT}"
convert $i $1/${i/.eps/$PICT_FORMAT}
fi
done
|