#!/bin/bash
#***************************************************************************************************
# *
# webify.bash: generate the automatic part of the web par of documentation. *
# *
#***************************************************************************************************
#***************************************************************************************************
# *
# Copyright (C) 2003, 2004 Joerg Kunze *
# *
# This file is part of siliconBrain. *
# *
# siliconBrain 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 of the License, or *
# (at your option) any later version. *
# *
# siliconBrain is distributed in the hope that it will be useful, *
# but WITHOUT ANY WARRANTY; without even the implied warranty of *
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# GNU General Public License for more details. *
# *
# You should have received a copy of the GNU General Public License *
# along with this program; if not, write to the Free Software *
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
# *
#***************************************************************************************************
siliconBrainRelease='$siliconBrainRelease: 0.2.3 $'
siliconBrainRcsIdentifier='$Id: webify.bash,v 1.46 2004/12/14 23:31:26 joerg Exp $'
siliconBrainSaveStamp='$siliconBrainSaveStamp: 2004/12/14 22:27:28, Joerg Kunze$'
source distribution/data/releaseInformation
#***************************************************************************************************
# *
# createHtmlHeader: *
# *
#***************************************************************************************************
function createHtmlHeader {
title=$1
echo "<!--"
formatHeader " " \
"$siliconBrainRelease" \
"$siliconBrainRcsIdentifier" \
"$siliconBrainSaveStamp" \
"$title" \
"$siliconBrainRelease" \
"$siliconBrainRcsIdentifier" \
"$siliconBrainSaveStamp"
echo "-->"
echo "<html>"
echo " <header>"
echo " <title>$title</title>"
echo " </header>"
echo " <body>"
echo " <h1>$title</h1>"
echo " <h2>Created $releaseDate (Release $release)</h2>"
}
#***************************************************************************************************
# *
# createHtmlFooter: *
# *
#***************************************************************************************************
function createHtmlFooter {
echo "<hr>
Copyright (C) 2003, 2004 Joerg Kunze
<p>
Verbatim copying and distribution of this entire article is permitted in any medium,
provided this notice is preserved."
echo "<p>$siliconBrainPackageName is publish under the GNU General Public License. Any of $siliconBrainPackageName's
documentation is published under the GNU Free Documentation License."
echo "<hr>
Created by: <br>
$siliconBrainRelease <br>
$siliconBrainRcsIdentifier <br>
$siliconBrainSaveStamp"
echo " </body>"
echo "</html>"
}
#***************************************************************************************************
# *
# webifyOneDirectory: *
# *
#***************************************************************************************************
function webifyOneDirectory {
local currentDirectory=$1
local sourceList
local fileList=$(ls --almost-all ${sourceRoot}$currentDirectory | grep -v 'CVS\|'$siliconBrainTemporary)
local fileInfo
local fileName
function fileInfo {
fileInfo=$(ls --format=long --full-time --directory ${sourceRoot}${currentDirectory}$fileName)
}
function htmlDirectory {
echo "<font color=\"0000FF\"><strong>${fileInfo% *} <a href=$fileName/index.html>$fileName</a></strong></font>"
}
#--------------------#
# create sourceIndex #
#--------------------#
{
createHtmlHeader "$siliconBrainPackageName Source index: $currentDirectory"
echo "<code><pre>"
if [ -n "$currentDirectory" ]; then
fileName=..
fileInfo
htmlDirectory
fi
for fileName in $fileList; do
fileInfo
if [ -d ${sourceRoot}${currentDirectory}$fileName ]; then
mkdir ${targetRoot}${currentDirectory}$fileName
webifyOneDirectory ${currentDirectory}$fileName/ >&2
htmlDirectory
else
echo "${fileInfo% *} <a href=$fileName.html>$fileName</a>"
sourceList="$sourceList ${currentDirectory}$fileName"
fi
done
echo "</pre></code>"
createHtmlFooter
} > ${targetRoot}/${currentDirectory}index.html
#-----------------------#
# htmlilize all sources #
#-----------------------#
emacs \
--no-init-file \
--no-site-file \
--batch \
--eval="(setq load-path (append $siliconBrainEmacsLoadPath load-path))" \
--eval="(setq sourceRoot \"$sourceRoot\")" \
--eval="(setq targetRoot \"$targetRoot\")" \
-l htmlilize \
$sourceList \
2> /dev/null
}
#***************************************************************************************************
# *
# main: *
# *
#***************************************************************************************************
web=$PWD/distribution/documentation/web
#-----------------#
# clean old stuff #
#-----------------#
rm --force --recursive $web/sourceTree/*
#------------------#
# create main page #
#------------------#
{
createHtmlHeader "$siliconBrainPackageName Main Page"
echo "<p>"
cat "distribution/data/longDescription.snippet.html"
echo "<p>"
echo "<a href=sourceTree/index.html>Sources</a> are syntax highlighted found here."
echo "</p>"
echo "<p>"
echo "The <a href=info/index.html>Manual</a>."
echo "</p>"
echo "<p>"
echo "Download sources and precompiled programs at
<a href=ftp://ftp.siliconbrain.com/pub/$releaseArchive>
ftp://ftp.siliconbrain.com/pub/$releaseArchive</a>."
echo "</p>"
echo "<p>
Copyright (C) 2003, 2004 Joerg Kunze
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled <a href=gnuFdl.html>\"GNU
Free Documentation License\"</a> (as <a href=gnuFdl.text>text</a>; as <a href=gnuFdl.include.texinfo>texi</a>)."
echo "<p>
All software of $siliconBrainPackageName is
Copyright (C) 2003, 2004 Joerg Kunze
<p>$siliconBrainPackageName 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
of the License, or (at your option) any later version.
$siliconBrainPackageName is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the <a href=gnuGpl.html>\"GNU General Public License\"</a>
(as <a href=gnuGpl.text>text</a>; as <a href=gnuGpl.include.texinfo>texi</a>)
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
createHtmlFooter
} > $web/index.html
sourceRoot=$PWD/
targetRoot=$web/sourceTree/
webifyOneDirectory
if [ -f packageSpecificWebify ] ; then
source packageSpecificWebify
fi
# $Log: webify.bash,v $
# Revision 1.46 2004/12/14 23:31:26 joerg
# published for new release 0.2.3
#
# Revision 1.45 2004/12/14 23:17:05 joerg
# published for new release 0.2.2
#
# Revision 1.44 2004/12/14 22:42:23 joerg
# allFiles: all sources have a Log CVS keyword at the end now.
#