#!/bin/sh
-if [ -z "$1" ]; then
- echo "usage: $0 <name.xml> <unterpunkte kapitel 1> ... <... kappitel n>"
+if [ -z "$1" -o -z "$2" ]; then
+ echo "usage: $0 <name.xml> <metafile>"
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
<?xml version='1.0'?>
<slides effect="slide top left, blend"
<slide effect="none">
<header size="10"></header>
- <header fgcolor="#5080FF" size="80">$dir</header>
+ <header fgcolor="#5080FF" size="80">$topic</header>
<header size="20"></header>
- <header fgcolor="#5080FF" size="35">desc</header>
+ <header fgcolor="#5080FF" size="35">$desc</header>
<header size="40"></header>
- <text>authors</text>
+ <text>$author</text>
<text/>
- <text>email: </text>
- <text>event: </text>
- <text>location: </text>
+ <text>email: $email</text>
+ <text>event: $event</text>
+ <text>location: $location</text>
</slide>
EOF
-total=$#
+total=`tail -1 $file | awk -F^ '{ print $1 }'`
((count = 0))
-cat >> $dir/$name << EOF
+cat >> $name << EOF
<slide>
<header size="10"></header>
<header fgcolor="#8080FF" size="35">Inhalt</header>
<header size="20"></header>
EOF
-for i in $@; do
+while [ "1" ]; do
((j = 0))
((count += 1))
- cat >> $dir/$name << EOF
- <text size="20">Kapitel $count</text>
+ kapitel=`grep ^${count} $file | awk -F^ '{ print $2 }'`
+ # j_max=`grep ^${count} $file | sed 's/\^/ /g' | wc -w`
+ # ((j_max -= 2))
+ cat >> $name << EOF
+ <text size="20">$kapitel</text>
<text/>
EOF
- while [ "1" ]; do
- ((j += 1))
- cat >> $dir/$name << EOF
- <listitem size="20">$j</listitem>
+ for up in `grep ^${count} $file | awk -F^ '{ for(i=3;i<=NF;i++) print $i }'`; do
+ cat >> $name << EOF
+ <listitem size="20">$up</listitem>
EOF
- [ "$j" = "$i" ] && break
done
- cat >> $dir/$name << EOF
+ cat >> $name << EOF
<text/>
EOF
+ [ "$count" = "$total" ] && break
done
-cat >> $dir/$name << EOF
+cat >> $name << EOF
</slide>
EOF
-((count = 0))
-for i in $@; do
+((count = 0))
+while [ "1" ]; do
((count += 1))
- cat >> $dir/$name << EOF
+ kapitel=`grep ^${count} $file | awk -F^ '{ print $2 }'`
+ cat >> $name << EOF
<slide>
<header size="10"></header>
- <header fgcolor="#8080FF" size="35">Kapitel $count</header>
+ <header fgcolor="#8080FF" size="35">$kapitel</header>
<header size="20"></header>
EOF
((j = 0))
- while [ "1" ]; do
- ((j += 1))
- cat >> $dir/$name << EOF
- <text size="20">$j</text>
+ for up in `grep ^${count} $file | awk -F^ '{ for(i=3;i<=NF;i++) print $i }'`; do
+ cat >> $name << EOF
+ <text size="20">$up</text>
<text/>
- <listitem size="20">dd, wenn zuviel! :)</listitem>
- <listitem size="20">dd, wenn zuviel! :)</listitem>
- <listitem size="20">dd, wenn zuviel! :)</listitem>
- <listitem size="20">dd, wenn zuviel! :)</listitem>
+ <listitem size="20">muster</listitem>
+ <listitem size="20">muster</listitem>
+ <listitem size="20">muster</listitem>
+ <listitem size="20">muster</listitem>
<text/>
EOF
- if [ "$i" = "$j" ]; then
- echo "debug: writing $j, finished"
- break
- else
- echo "debug: writing $j from $i"
- fi
done
- cat >> $dir/$name << EOF
+ cat >> $name << EOF
</slide>
-
EOF
+ [ "$count" = "$total" ] && break
done
-cat >> $dir/$name << EOF
+
+cat >> $name << EOF
</slides>
EOF