]> matita.cs.unibo.it Git - helm.git/commitdiff
Added Files (for webeq):
authorLuca Padovani <luca.padovani@unito.it>
Mon, 20 Nov 2000 12:09:23 +0000 (12:09 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Mon, 20 Nov 2000 12:09:23 +0000 (12:09 +0000)
use_webeqp.pl webeq.pl webeqp.pl

helm/cgi/use_webeqp.pl [new file with mode: 0755]
helm/cgi/webeq.pl [new file with mode: 0755]
helm/cgi/webeqp.pl [new file with mode: 0755]

diff --git a/helm/cgi/use_webeqp.pl b/helm/cgi/use_webeqp.pl
new file mode 100755 (executable)
index 0000000..80a375b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+require CGI;
+require "/local/lib/helm/configuration.pl";
+
+$q = new CGI;
+$uri = $q->param("uri");
+
+print <<EOT;
+Content-type: text/html
+Location: $webeqp_url?mmlurl=$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$uri
+
+EOT
diff --git a/helm/cgi/webeq.pl b/helm/cgi/webeq.pl
new file mode 100755 (executable)
index 0000000..f858f7b
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+require HTTP::Request;
+require LWP::UserAgent;
+use CGI;
+
+$url = $ENV{"REQUEST_URI"};
+$url =~ s/.*mmlurl=(.*)/$1/;
+
+$content = "";
+
+$ua = LWP::UserAgent->new;
+$request = HTTP::Request->new(GET => "$url");
+$response = $ua->request($request, \&callback);
+
+$content =~ s/\r//sg;
+$content =~ s/\n/ /sg;
+$content =~ s/<!DOCTYPE[^>]*(.*)>/$1/sg;
+$content =~ s/<m:/</g;
+$content =~ s/<\/m:/<\//g;
+$content =~ s/<math[^>]*>/<math>/sg;
+$content =~ s/"/'/g;
+$content =~ s/&/&amp;/g;
+
+print <<EOT;
+Content-type: text/html
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>Generato in automatico a partire da $url</title>
+</head>
+<body bgcolor="#ffffff" text="#000000">
+<applet codebase="http://www.webeq.com/WebEQ/2.2/classes" code="webeq.Main"
++width=600 height=2000 align=middle>
+<param name=eq value="$content">
+<param name=color value="#cccccc">
+<param name=parser value="mathml">
+<param name=size value="14">
+</applet>
+</body>
+</html>
+EOT
+
+#=========================
+
+sub callback
+{ 
+ my ($data) = @_;
+ $content .= $data;
+}
diff --git a/helm/cgi/webeqp.pl b/helm/cgi/webeqp.pl
new file mode 100755 (executable)
index 0000000..50e8cfd
--- /dev/null
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+require HTTP::Request;
+require LWP::UserAgent;
+require "/local/lib/helm/configuration.pl";
+use CGI;
+
+$url = $ENV{"REQUEST_URI"};
+$url =~ s/.*mmlurl=(.*)/$1/;
+
+$content = "";
+
+$ua = LWP::UserAgent->new;
+$request = HTTP::Request->new(GET => "$url");
+$response = $ua->request($request, \&callback);
+
+$content =~ s/\r//sg;
+$content =~ s/\n/ /sg;
+$content =~ s/<!DOCTYPE[^>]*>//sg;
+$content =~ s/<\?xml[^?]*\?>//sg;
+$content =~ s/"/'/g;
+$content =~ s/&/&amp;/g;
+$content =~ s/<m:/</g;
+$content =~ s/<\/m:/<\//g;
+$content =~ s/<math[^>]*>/<math>/sg;
+$content =~ s/(<\/?semantics[^>]*>)/<!-- $1 -->/sg;
+$content =~ s/(<annotation-xml)/<!-- $1/sg;
+$content =~ s/(<\/annotation-xml>)/$1 -->/sg;
+$content =~ s/<mo helm:xref='[^']*' xlink:href='([^']*)'>([^<]*)<\/mo>/<maction actiontype='href' other='$use_webeqp_url?uri=$1'><mo>$2<\/mo><\/maction>/sg;
+$content =~ s/<mi helm:xref='[^']*' xlink:href='([^']*)'>([^<]*)<\/mi>/<maction actiontype='href' other='$use_webeqp_url?uri=$1'><mi>$2<\/mi><\/maction>/sg;
+$content =~ s/helm:xref='[^']*'//sg;
+$content =~ s/xmlns:helm='[^']*'//sg;
+$content =~ s/xlink:href='[^']*'//sg;
+$content =~ s/xmlns:xlink='[^']*'//sg;
+$content =~ s/<mchar name='([^']*)' \/>/&$1;/sg;
+
+print <<EOT;
+Content-type: text/html
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>Generato in automatico a partire da $url</title>
+</head>
+<body bgcolor="#ffffff" text="#000000">
+<applet codebase="http://www.webeq.com/WebEQ/2.2/classes" code="webeq.Main"
++width=600 height=2000 align=middle>
+<param name=eq value="$content">
+<param name=color value="#cccccc">
+<param name=parser value="mathml">
+<param name=size value="14">
+</applet>
+</body>
+</html>
+EOT
+
+#=========================
+
+sub callback
+{ 
+ my ($data) = @_;
+ $content .= $data;
+}