#!/bin/bash
#####################################################################################################################
# defines
BIG="500"; SMALL="$[ $BIG / 4 ]";
LINKS="releases music pics linx supervision news";
FILES="temp/files.dat"
UML1="ÄÖÜäöüß"
UML2="ÄÖÜäöüß"
COLOR1="#333333";
COLOR2="#333333";
COLOR3="#222222";
TIDY="tidy -f /dev/null";
#####################################################################################################################
OLINE="
o
o
o
o
o
o
o
o
o
o"
OLINE=o$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE$OLINE;
OLINE=""
header ()
{
echo "create $1" >&2;
UTITEL="$1"; LTITEL=$(echo "$1"|tr "A-Z" "a-z");
echo "
";
for LINK in $LINKS; do
if [ "$LINK" != "$LTITEL" ]; then href "$LINK.htm" "$LINK "; else echo " "; fi; done; if [ "$1$2" != "" ]; then echo " "; fi; if [ "$2" != "" ]; then href "$2.htm" "<<<"; fi; if [ "$3" != "" ]; then href "$3.htm" ">>>"; fi; echo " ";
echo "email to ";
echo "last update: "; if [ "$2" != "" ]; then href "$2.htm" "<<<"; fi; if [ "$3" != "" ]; then href "$3.htm" ">>>"; fi; echo " | "
echo "$OLINE | " echo "#define __""$UTITEL""__" echo "struct $LTITEL={" echo "
| "
echo "$OLINE | " echo "
" # echo " | o | " echo "(webdesign by peter@grobner.at) | " # echo "o | " echo "
"; esac; done; done; cd ..; echo "
\1 \1+g" \
-e "s+\^\(.*\)$+ $2 +g" \
-e "s+#pic= *\(.*\) *\([0-9]*\) *\([0-9]*\).*$+ +g" \
-e "s+#pic= *\(.*\) *\([0-9]*\).*$+ +g" \
-e "s+#pic= *\([^ ]*\)$+ +g" \
-e "s+#tabon++g" \
-e "s+\*\*\(.*\)$+
\1+g" \
-e "s+\*\(.*\)$+
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Interpret: *\(.*\)|\(.*\)$+Interpret[]=
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Year: *\(.*\)|\(.*\)$+Year[]=
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Format: *\(.*\)|\(.*\)$+Format[]=
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Label: *\(.*\)|\(.*\)$+Label[]=
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Distribution: *\(.*\)|\(.*\)$+Distribution[]=
{
\ \"\1\",
\ \"\2\";
}+g" \
-e "s+#Title: *\(.*\)$+Title=\"\1\";+g" \
-e "s+#Interpret: *\(.*\)$+Interpret=\"\1\";+g" \
-e "s+#Year: *\(.*\)$+Year=\"\1\";+g" \
-e "s+#Format: *\(.*\)$+Format=\"\1\";+g" \
-e "s+#Label: *\(.*\)$+Label=\"\1\";+g" \
-e "s+#Distribution: *\(.*\)$+Distribution=\"\1\";+g" \
-e "s+#pic: .*$++g" \
-e "s+^|||||\(.*\)$+
+g" \
-e "s+#liston+ +g" \
-e "s+^||||\(.*\)$+ \ \1
+g" \
-e "s+^|||\(.*\)$+ \ \1
+g" \
-e "s+^||\(.*\)$+ \ \1
+g" \
-e "s+^|\([^|]*\)|\(.*\)$+ \ \1
+g" \
-e "s+^|\(.*\)$+\ \1 \2
+g" \
-e "s+|+\ \1 +g" \
-e "s+#taboff+
+g" \
-e "s+^- +
+g" \
-e "s+[ ]*\"+\"+g" \
-e "s+\(.*\)$+\1
+g" \
-e "s+#link:\([^ #]*\) *#\([^#]*\)#+\2+g" \
-e "s+#http://\([^ \"<]*\)+http://\1+g" \
-e "s+#mail:\([^ \"<]*\)+\1+g" \
-e "s+TABLE>
+TABLE>+g" \
-e "s++
+g" \
-e "s+
++g" \
-e "s+UL>
+UL>+g" \
-e "s+CENTER>
+CENTER>+g" \
-e "s+\(
\)*
+
+g" \
-e "s+^[ ]*
++g" \
-e "s+^
$++g";
}
mkjpg ()
{
convert -geometry "$1" "$3" tmp$$.jpg;
djpeg tmp$$.jpg|cjpeg -qu "$2" -opt >"$4";
rm tmp$$.jpg
}
#####################################################################################################################
# main
OUT=""; T=""; rm $FILES;
cat allpages.txt|tr -d "\r" > temp/allpages.txt;
while read A B C D E; do
case "$A" in
\#\#*) A="===";;
\#Umlaute:) UML1="$B"; echo "convert $UML1 -> $UML2";;
===*) if [ "$OUT" != "" ]; then htmlpage $OUT $U temp/$OUT|$TIDY >html/$OUT.htm; fi;
A="==="; OUT=""; U=""; T=""; if [ "$C" == "/" ]; then OUT="$B"; U="$D"; rm "temp/$OUT"; fi;;
\#Title:) T="TITLE";;
\#pic:*) if [ "$T" == "TITLE" ]; then echo "$OUT $U temp/$OUT $B" >>$FILES; fi;;
\|*) if [ "$T" != "TABLE" ]; then T="TABLE"; echo "#tabon" >>temp/$OUT; fi;;
-*) if [ "$T" != "LIST" ]; then T="LIST"; echo "#liston" >>temp/$OUT; fi;;
"") if [ "$T" == "LIST" ]; then T=""; echo "#listoff" >>temp/$OUT; fi;
if [ "$T" == "TABLE" ]; then T=""; echo "#taboff" >>temp/$OUT; fi;;
*) if [ "$T" == "TABLE" ]; then T=""; echo "#taboff" >>temp/$OUT; fi;;
esac;
if [ "$A" != "===" -a "$OUT" != "" ]; then echo "$A $B $C $D $E" >>temp/$OUT; fi;
done < temp/allpages.txt;
echo >>$FILES;
if [ "$1" == "-qu" ]; then
echo "image quality set to $2"
while read FILE NAME DOC PIC DUMMY; do
if [ -f "$PIC" ]; then
echo "updating $FILE""1.jpg"; mkjpg "$BIG" "$2" "$PIC" "html/$FILE""1.jpg";
echo "updating $FILE""2.jpg"; mkjpg "$SMALL" "$2" "$PIC" "html/$FILE""2.jpg";
else
if [ "$PIC" != "" ]; then echo "Warning: $PIC not found!"; fi;
fi;
done < "$FILES";
echo "updating ahub.jpg"; mkjpg "$BIG" "95" "photos/ahub.jpg" "html/ahub.jpg";
# echo "updating talisman.jpg"; mkjpg "$BIG" "95" "photos/talisman.jpg" "html/talisman.jpg";
echo "updating innen.jpg"; mkjpg "$BIG" "95" "photos/Innen02a.jpg" "html/innen.jpg";
echo "updating 2l1.jpg"; mkjpg "$BIG" "95" "photos/2l1.jpg" "html/2l1.jpg";
echo "updating supervision.jpg"; mkjpg "$BIG" "$2" "photos/supervision.jpg" "html/supervision.jpg";
echo "updating aph.gif"; if [ "$2" -ge "30" ]; then cp "photos/aph1.gif" "html/aph.gif";
else cp "photos/aph2.gif" "html/aph.gif"; fi;
echo "updating bg.jpg"; cp "photos/bg.jpg" "html/bg.jpg";
fi;
music|$TIDY >html/music.htm;
#linx > html/linx.htm;
###for FILE in $LINKS; do $FILE > html/$FILE.htm; done;
cp html/releases.htm html/index.htm
cp html/releases.htm html/index.html
cp temp/allpages.txt allpages.txt; recode "lat1..lat1/CR-LF" allpages.txt;
cp allpages.txt html/allpages.txt;
echo "Dir html/ has a amount of $(du -bh html|grep html\$|sed -e "s/[ ]*html//") bytes";
if [ "$1" == "-ftp" ]; then sitecopy -u laton; exit; fi;
#####################################################################################################################