]> matita.cs.unibo.it Git - helm.git/blob - helm/cgi/webeq.pl
Changed syntax for 'ls' method:
[helm.git] / helm / cgi / webeq.pl
1 #!/usr/bin/perl
2
3 my $HELM_CONFIGURATION_PREFIX = $ENV{"HELM_CONFIGURATION_PREFIX"};
4 my $HELM_CONFIGURATION_PATH =
5  $HELM_CONFIGURATION_PREFIX."/local/lib/helm/configuration.pl";
6  # next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
7  require $HELM_CONFIGURATION_PATH;
8
9 require HTTP::Request;
10 require LWP::UserAgent;
11 use CGI;
12
13 $url = $ENV{"REQUEST_URI"};
14 $url =~ s/.*mmlurl=(.*)/$1/;
15
16 $content = "";
17
18 $ua = LWP::UserAgent->new;
19 $request = HTTP::Request->new(GET => "$url");
20 $response = $ua->request($request, \&callback);
21
22 $content =~ s/\r//sg;
23 $content =~ s/\n/ /sg;
24 $content =~ s/<!DOCTYPE[^>]*(.*)>/$1/sg;
25 $content =~ s/<m:/</g;
26 $content =~ s/<\/m:/<\//g;
27 $content =~ s/<math[^>]*>/<math>/sg;
28 $content =~ s/"/'/g;
29 $content =~ s/&/&amp;/g;
30
31 print <<EOT;
32 Content-type: text/html
33
34 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
35 "http://www.w3.org/TR/REC-html40/loose.dtd">
36 <html>
37 <head>
38 <title>Generato in automatico a partire da $url</title>
39 </head>
40 <body bgcolor="#ffffff" text="#000000">
41 <applet codebase="http://www.webeq.com/WebEQ/2.2/classes" code="webeq.Main"
42 +width=600 height=2000 align=middle>
43 <param name=eq value="$content">
44 <param name=color value="#cccccc">
45 <param name=parser value="mathml">
46 <param name=size value="14">
47 </applet>
48 </body>
49 </html>
50 EOT
51
52 #=========================
53
54 sub callback
55
56  my ($data) = @_;
57  $content .= $data;
58 }