Karakas Online

4.11. Set up your start and end scripts

You are going to need two scripts, with the endings .start and .end respectively, and the same basename as your LyX document (without the LyX ending). Example: if you are processing myLyxfile.lyx, then you can create myLyxfile.start and myLyxfile.end. These files can contain code of your choice to be executed at the start and at the end of the lyxtox script. The .start file should contain at least the lines:

# Title of this document.
TITLE="LyX and SGML"
FORMATSFILE="formats.html"
COPYRIGHT="All contents <a href=\"license.html\">\&copy;<\/a> 2002-2006 <a href=\"http:\/\/www.karakas-online.de\">Chris Karakas<\/a>"
HOMEFILE="book1.html"
# Flags
# Set to "1" to process math.
process_math="1"
# Set to "1" if you have RefDB installed
# and want to create the bibliography.sgml file 
# through RefDB.
process_RefDB="1"
RefDB_db="ck_refdb"
REFDB_style="J.Biol.Chem."

The values for TITLE, FORMATSFILE, COPYRIGHT, HOMEFILE etc. are used in the HTML file generation. You may need them or not, depending on whether you use them in your part1, part2 and part3 files, which are responsible for your custom header and footer (see Section 7.1.4.6).

The values for process_math and process_RefDB are necessary. If you don't use mathematics (see Section 5.17), set process_math to 0. If you don't use RefDB (see Section 5.19.2), set process_RefDB to 0.

See example.start for an example of a .start file.

The .end file (myLyXfile.end in our example above) is there for you to add whatever additional processing steps you like. I use it to create all the tar archives found in Section 1.2, but you can use it for whatever you like. Here is a typical .end file that you would use to massage the HTML files a bit (with sedscr_val, in order to make them HTML standards compliant) and then create all those tar archives found in Section 1.2:

# Do some changes that are necessary for the HTML file to be validated
# as a conforming one, according to the standards
# of the W3C (see http://validator.w3c.org).
$RUNSED sedscr_val $1/*.html
rm $1/*.bak
rm $1/*.tar.gz
cp sedscr_top $1/
# Admonitions and Callouts.
cp -v admonitions.tar.gz $1/
cp -v callouts.tar.gz $1/
# TAR, all files.
$TAR --exclude=$1/index.html -czvf $1.tar.gz $1/
cp $1.tar.gz $1/
rm $1.tar.gz
# TAR, one big HTML file with images.
$TAR -czvf $1-onehtml.tar.gz $1/$1.html $1/images/*.png $1/images/*.gif $1/images/*/*.png $1/ck-style.css $tarfilelist
cp $1-onehtml.tar.gz $1/
rm $1-onehtml.tar.gz
# TAR, many HTML files with images.
$TAR --exclude=$1/$1.html --exclude=$1/index.html -czvf $1-html.tar.gz $1/*.html $1/images/*.png $1/images/*.gif $1/images/*/*.png $1/ck-style.css $tarfilelist
cp $1-html.tar.gz $1/
rm $1-html.tar.gz
# TAR, RTF file with images.
$TAR -czvf $1-rtf.tar.gz $1/$1.rtf $1/images/*.bmp $1/images/*/*.bmp $tarfilelist
cp $1-rtf.tar.gz $1/
rm $1-rtf.tar.gz
# TAR, SGML file with images.
$TAR -czvf $1-sgml.tar.gz $1/$1.sgml $1/images/* $1/images/*/* $1/appendix.sgml $tarfilelist
cp $1-sgml.tar.gz $1/
rm $1-sgml.tar.gz
# TAR, only the filelist.
$TAR -czvf $1-scripts.tar.gz $tarfilelist
cp $1-scripts.tar.gz $1/
rm $1-scripts.tar.gz

See example.end for an example of an .end file.

Last updated Mon Sep 24 01:19:25 CEST 2007 Permalink: http://www.karakas-online.de/mySGML/start-and-end-scripts.html All contents © 2002-2007 Chris Karakas