]> www.hackdaworld.org Git - lectures/dfb-slides.git/blob - parse.pl
added header support
[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 open(IN,"../head2xml header|") or die "no head2xml / header!!\n";
25 while(<IN>) {
26         print $_;
27 }
28 close(IN);
29
30 @topics=();
31
32 foreach(@content) {
33         if((/^\d/) or (/^ \d/)) {
34                 push(@topics,$_);
35         }
36 }
37
38 print "\n<slide effect=\"slide top left, blend\">\n";
39 print "<header size=\"20\" fgcolor=\"#22FF22\">Inhalt</header>\n<text></text>\n";
40 foreach(@topics) {
41         if(/^\d/) {
42                 print "<text></text>\n";
43                 $add="fgcolor=\"#ff00cc\"";
44         }
45         else {
46                 $add="";
47         }
48         print "<text $add>$_</text>\n";
49 }
50 print "</slide>\n\n";
51
52 $topic=0;
53
54 push(@content," 23");
55
56 foreach(@content) {
57         s/\#.*//;
58         s/&/&amp;/g;
59         s/</&lt;/;
60         s/>/&gt;/;
61         
62         #s/ue/ü/g;
63         #s/ae/ä/g;
64         #s/oe/ö/g;
65         
66         s/Ue/Ü/g;
67         s/Ae/Ä/g;
68         s/Oe/Ö/g;
69         # unterpunkt
70         if(/^ \d/) {
71                 if(@slide) {
72                         $action=$actions[int(rand($#actions))];
73                         if(length($action)>0) {
74                                 if(int(rand(2))==1) {
75                                         $action.=", blend";
76                                 }
77                         }
78                         else {
79                                 if(int(rand(2))==1) {
80                                         $action.="blend";
81                                 }
82                         }
83                         if(length($action)>0) {
84                                 $action=" effect=\"$action\"";
85                         }
86                         print "<slide$action>\n";
87                         print STDERR "$topics[$topic] $action\n";
88                         print "<header size=\"20\" fgcolor=\"#22FF22\">$topics[$topic]</header>\n<text></text>\n";
89                         foreach(@slide) {
90                                 if(/^  \+ /) {
91                                         s/\+//;
92                                         print "<text></text>\n<listitem fgcolor=\"#ff00cc\" size=\"20\">$_</listitem>\n";
93                                 }
94                                 elsif(/ \+ /) {
95                                         s/\+//;
96                                         print "<text></text>\n<listitem size=\"20\">$_</listitem>\n";
97                                 }
98                                 else {
99                                         print "<text>$_</text>\n";
100                                 }
101                         }
102                         print "</slide>\n\n";
103                         #$topic++;
104                 }
105                 @slide=();
106                 $topic++;
107                 $_=$topics[$topic];
108                 if(/^\d/) {
109                         $topic++;
110                 }
111         }
112         # ueberpunkt
113         elsif (/^\d/) {
114                 
115         }
116         # normaler content
117         else {
118                 push(@slide,$_);
119         }
120 }
121
122 print "</slides>\n";