2005-06-29 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / web / web / icaza.pl
1 #!/usr/bin/perl
2 $q = 1;
3
4 # Modified by Edwin Lima (edwinlima@hotmail.com; edwin.lima@nec-computers.com)
5 # Date: 08/21/01, The Netherlands
6 # $f: Variable used as a flag to create the list of questions on top of the question-answers set. This
7 # is the only way that I found to scan the questions which have a <CR><LF>, in such a way that I will not
8 # scan the answer together at same time.
9 # @aname: Buffer used to store the question-answers set to print them out just after the print of the
10 # questions.
11 # @href: Buffer used to store the anchors (only questions) to the questions-answers set on the bottom 
12 # of the page.
13 # I opened explicitly the file for input (input.txt) but U can change this as it was originally.
14 #
15 #
16
17 #comment this line if you are not open the file explicitly
18 #open(IN, "input.txt") || die "cannot open file input.txt" ; 
19
20 print("<A name=TOP>") ;
21
22 #Uncomment line bellow to make it work as it was originally.
23 while (<>){ 
24
25 #comment line bellow
26
27 #while (<IN>){
28         chop;
29         if (/^\* (.*)$/){
30                 push(@aname,"<h1>$1</h1>\n");
31 #               print $body;
32         } elsif (/^\*\* (.*)$/) {
33                 push(@aname, "<h2>$1</h2>\n");
34                 push(@href, "<h2>$1</h2>\n");
35         } elsif (/^\*\*\* (.*)$/) {
36                 push(@aname, "<h3>$1</h3>\n");
37                 
38         } elsif (/^$/) {
39                 push(@aname, "<p>\n");
40 #               push(@href, "<p>\n");           NOT NEEDED
41         } elsif (/^\t\t\* (.*)$/) {
42                 push(@aname, "<li>$1\n");
43         } elsif (/^Q: (.*)$/){
44                 push(@aname, "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n");
45                 push(@href,"<p><a href=\"#q$q\"><b>Question $q:</b></a> $1\n");
46                 $f=1; 
47                 $q++;
48         } elsif (/^A: (.*)$/){
49                 push(@aname,"<P>\n<A HREF=#TOP>Top</A>\n<P>");
50                 push(@aname,"$1\n");
51                 $f=0;
52         } elsif (/^TODO=(.*),$/){
53                 push(@aname, "<a name=\"$1\">\n");
54                 #push(@href, "<a name=\"$1\">\n");
55         } else {
56                 push(@aname,"$_\n");
57                 if ($f==1) {
58                 push(@href,"$_\n");
59                 }
60         }
61 }
62
63 foreach $line (@href) #"\n\n";
64 {
65         print $line;
66         }
67
68 foreach $line (@aname) #"\n\n";
69 {
70         print $line;
71         }
72
73
74 #comment this line if you are not open the file explicitly
75 #   close(IN) || die "cannot close file" ; 
76