X-Git-Url: https://hackdaworld.org/gitweb/?p=lectures%2Fdfb-slides.git;a=blobdiff_plain;f=create-xml;h=81990e1c685081ae9691e9365a6db327994158cd;hp=89d7f11a171d9b5340df7750dd58b35b62ac6baf;hb=5f12223b9a9a479085647770c25f83c1b677a17e;hpb=99373af6eedcba9c251dcfcaa6e10e6b1dc69128 diff --git a/create-xml b/create-xml index 89d7f11..81990e1 100755 --- a/create-xml +++ b/create-xml @@ -1,77 +1,103 @@ #!/bin/sh -if [ -z "$1" ]; then - echo "usage: $0 ... <... kappitel n>" +if [ -z "$1" -o -z "$2" ]; then + echo "usage: $0 " exit fi +name=$1 ; file=$2 -name=$1 ; shift 1 -dir=`echo $name | sed 's/.xml//'` -mkdir $dir +topic=`grep '^T' $file | awk -F^ '{ print $2 }'` +desc=`grep '^D' $file | awk -F^ '{ print $2 }'` +author=`grep '^A' $file | awk -F^ '{ print $2 }'` +email=`grep '^M' $file | awk -F^ '{ print $2 }'` +event=`grep '^E' $file | awk -F^ '{ print $2 }'` +location=`grep '^L' $file | awk -F^ '{ print $2 }'` # print normal header -cat > $dir/$name << EOF +cat > $name << EOF +
-
$dir
+
$topic
-
desc
+
$desc
- authors + $author - email: - event: - location: + email: $email + event: $event + location: $location
EOF -total=$# +total=`tail -1 $file | awk -F^ '{ print $1 }'` ((count = 0)) -for i in $@; do - ((count += 1)) - cat >> $dir/$name << EOF - +cat >> $name << EOF
-
Kapitel $count
+
Inhalt
EOF +while [ "1" ]; do ((j = 0)) - while [ "1" ]; do - ((j += 1)) - cat >> $dir/$name << EOF - $j - - dd, wenn zuviel! :) - dd, wenn zuviel! :) - dd, wenn zuviel! :) - dd, wenn zuviel! :) + ((count += 1)) + kapitel=`grep ^${count} $file | awk -F^ '{ print $2 }'` + # j_max=`grep ^${count} $file | sed 's/\^/ /g' | wc -w` + # ((j_max -= 2)) + cat >> $name << EOF + $kapitel + +EOF + grep ^${count} $file | awk -F^ '{ for(i=3;i<=NF;i++) print " "$i"" }' >> $name + cat >> $name << EOF EOF - if [ "$i" = "$j" ]; then - echo "debug: writing $j, finished" - break - else - echo "debug: writing $j from $i" - fi - done - cat >> $dir/$name << EOF + [ "$count" = "$total" ] && break +done +cat >> $name << EOF
EOF + + +((count = 0)) +while [ "1" ]; do + ((count += 1)) + kapitel=`grep ^${count} $file | awk -F^ '{ print $2 }'` + cat >> $name << EOF + + +
+
$kapitel
+
+ +EOF + ((j = 0)) + grep ^${count} $file | awk -F^ '{ for(i=3;i<=NF;i++) print " " $i " \ + \ + muster \ + muster \ + muster \ + muster \ + " }' >> $name + cat >> $name << EOF +
+EOF + [ "$count" = "$total" ] && break done -cat >> $dir/$name << EOF + +cat >> $name << EOF
EOF