]> www.hackdaworld.org Git - lectures/dfb-slides.git/blob - parse.pl
updated
[lectures/dfb-slides.git] / parse.pl
1 #!/usr/bin/perl
2
3 @content=<STDIN>;
4 chomp @content;
5
6 @slide=();
7
8 @actions=( "",
9                             "slide top",
10                                 "slide top right",
11                                 "slide top left",
12                                 "slide bottom",
13                                 "slide bottom left",
14                                 "slide bottom right",
15                                 "slide left",
16                                 "slide right");
17
18 print "<?xml version='1.0' encoding='iso-8859-1'?>\n";
19 print "\n<slides bgcolor=\"#222266\" fgcolor=\"#9999ff\" 
20         face=\"../ttf/decker.ttf\" size=\"15\"
21         bullet=\"../img/bullet.png\"
22         screen_width=\"1024\" screen_height=\"768\">\n";
23
24 @topics=();
25
26 foreach(@content) {
27         if((/^\d/) or (/^ \d/)) {
28                 push(@topics,$_);
29         }
30 }
31
32 print "\n<slide effect=\"slide top left, blend\">\n";
33 print "<header size=\"20\" fgcolor=\"#22FF22\">Inhalt</header>\n<text></text>\n";
34 foreach(@topics) {
35         if(/^\d/) {
36                 print "<text></text>\n";
37                 $add="fgcolor=\"#ff00cc\"";
38         }
39         else {
40                 $add="";
41         }
42         print "<text $add>$_</text>\n";
43 }
44 print "</slide>\n\n";
45
46 $topic=0;
47
48 push(@content," 23");
49
50 foreach(@content) {
51         s/\#.*//;
52         s/&/&amp;/g;
53         s/</&lt;/;
54         s/>/&gt;/;
55         
56         #s/ue/ü/g;
57         #s/ae/ä/g;
58         #s/oe/ö/g;
59         
60         s/Ue/Ü/g;
61         s/Ae/Ä/g;
62         s/Oe/Ö/g;
63         # unterpunkt
64         if(/^ \d/) {
65                 if(@slide) {
66                         $action=$actions[int(rand($#actions))];
67                         if(length($action)>0) {
68                                 if(int(rand(2))==1) {
69                                         $action.=", blend";
70                                 }
71                         }
72                         else {
73                                 if(int(rand(2))==1) {
74                                         $action.="blend";
75                                 }
76                         }
77                         if(length($action)>0) {
78                                 $action=" effect=\"$action\"";
79                         }
80                         print "<slide$action>\n";
81                         print STDERR "$topics[$topic] $action\n";
82                         print "<header size=\"20\" fgcolor=\"#22FF22\">$topics[$topic]</header>\n<text></text>\n";
83                         foreach(@slide) {
84                                 if(/^  \+ /) {
85                                         s/\+//;
86                                         print "<text></text>\n<listitem fgcolor=\"#ff00cc\" size=\"20\">$_</listitem>\n";
87                                 }
88                                 elsif(/ \+ /) {
89                                         s/\+//;
90                                         print "<text></text>\n<listitem size=\"20\">$_</listitem>\n";
91                                 }
92                                 else {
93                                         print "<text>$_</text>\n";
94                                 }
95                         }
96                         print "</slide>\n\n";
97                         #$topic++;
98                 }
99                 @slide=();
100                 $topic++;
101                 $_=$topics[$topic];
102                 if(/^\d/) {
103                         $topic++;
104                 }
105         }
106         # ueberpunkt
107         elsif (/^\d/) {
108                 
109         }
110         # normaler content
111         else {
112                 push(@slide,$_);
113         }
114 }
115
116 print "</slides>\n";