X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=cont2xml;fp=cont2xml;h=dac9a5183a7f3f210ab8c83eee4bd1eb8059980a;hb=dcfe13a60d4b22e8d1da061da18e5a2e42687c82;hp=0000000000000000000000000000000000000000;hpb=ef88c26763ef7326d23eb2f782157ae3f2222477;p=lectures%2Fdfb-slides.git diff --git a/cont2xml b/cont2xml new file mode 100755 index 0000000..dac9a51 --- /dev/null +++ b/cont2xml @@ -0,0 +1,103 @@ +#!/bin/sh + +if [ -z "$1" -o -z "$2" ]; then + echo "usage: $0 " + exit +fi +trgfile=$1 ; srcfile=$2 + +# general +topic=`grep '#\ T' $srcfile | awk -F^ '{ print $2 }'` +desc=`grep '#\ D' $srcfile | awk -F^ '{ print $2 }'` +author=`grep '#\ A' $srcfile | awk -F^ '{ print $2 }'` +email=`grep '#\ M' $srcfile | awk -F^ '{ print $2 }'` +event=`grep '#\ E' $srcfile | awk -F^ '{ print $2 }'` +location=`grep '#\ L' $srcfile | awk -F^ '{ print $2 }'` +xwidth=`grep '#\ X' $srcfile | awk -F^ '{ print $2 }'` +ywidth=`grep '#\ Y' $srcfile | awk -F^ '{ print $2 }'` + +# information needed to parse contents +total=`grep '^[0-9]' $srcfile | tail -1 | awk '{ print $1 }'` +echo "found $total chapters ..." +((count = 0)) + +# print normal header +cat > $trgfile << EOF + + + + + +
+
$topic
+
+
$desc
+
+$author + +email: $email +event: $event +location: $location +
+ +EOF + +# contents overview page +cat >> $trgfile << EOF + +
+
Inhalt
+
+ +EOF +while [ "1" ]; do + ((j = 0)) + ((count += 1)) + cat >> $trgfile << EOF +`grep ^${count} $srcfile | awk -F^ '{ print $0 }'` + +EOF + grep ^\ ${count}\.[0-9] $srcfile | awk '{ print ""$0"" }' >> $trgfile + cat >> $trgfile << EOF + +EOF + [ "$count" = "$total" ] && break +done +cat >> $trgfile << EOF +
+ +EOF + +# the conetent +# to be continued ... ;) +((count = 0)) +while [ "1" ]; do + ((j = 0)) + ((count += 1)) + echo "creating content chapter $count ..." + cat >> $trgfile << EOF + +
+
`grep ^${count} $srcfile`
+
+
+ +EOF + +# total_2 + +# hunz's 1337.pl inserts content here ;) + +[ "$count" = "$total" ] && break +done + + +cat >> $trgfile << EOF +
+EOF +echo "done ..."