#!/bin/sh
processline()
{
echo "- $1 -"
name="$1"
# I changed "0" to "$" because my sed
# doesn't want to understand "0".
# -- Zoltan
cat xaos.hlp | sed '1,/%'"$1"'/d;/^%/,$ d' | sed \
's_
__g
s_
__g
s/'\'\''/"/g
s/``/"/g
s_LICENSE
_LICENSE - _g' | sed \
'1,2s_
\([^<]*\)_====== \1 ======\
_g
s__**_g
s__\
_g
s_
_===== _g
s__ =====\
_g
s___g
s___g
s__//_g
s__//_g
s___g
s___g
s___g
s___g
s___g
s___g
s___g
s___g
s___g
s_
__g
s___g
s___g
s_
_\
_g
s_ [ ]*_ _g
s__//_g
s__ * _g
s___g
s___g
s__**_g
s__'\'\''_g
s__'\'\''_g
s_]*>_//_g
s__//_g
s_]*\)>_[[\1|_g
s__]]_g' > $1.txt
tolower=`echo $1 | awk '{print tolower($1)}'`
if [ "$1" != "$tolower" ] ; then
ln -sf $1.txt $tolower.txt
fi
shift
while [ "$1" != "" ] ; do
echo Link "$1" "$name"
if [ "$1" != "$name" ] ; then
ln -sf $name.txt $1.txt
fi
tolower=`echo $1 | awk '{print tolower($1)}'`
if [ "$1" != "$tolower" ] ; then
ln -sf $1.txt $tolower.txt
fi
shift
done
}
process()
{
while read line ; do
eval "processline $line"
done
}
grep "^%" xaos.hlp | sed '/%%/d;s/%//g' | process