From 4399a59c122c1a3cb239361f6d437732e16653e2 Mon Sep 17 00:00:00 2001 From: Tim Bishop Date: Wed, 24 Mar 2004 13:11:42 +0000 Subject: [PATCH] Make docs.cgi XHTML 1.1 compliant (and tidied up the layout). Problem with this doc is it doesn't have a .xhtml extension, so will always have to be served as text/html - until I come up with a solution. --- cgi-bin/docs.cgi | 64 +++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/cgi-bin/docs.cgi b/cgi-bin/docs.cgi index 402c9e5..bdcd3f9 100755 --- a/cgi-bin/docs.cgi +++ b/cgi-bin/docs.cgi @@ -6,10 +6,14 @@ use CGI; $| = 1; # Settings -my ($menu) = "../nwww/menu.inc" ; -my ($header) = "../nwww/header.inc"; -my ($footer) = "../nwww/footer.inc"; -my ($style) = "../nwww/style.inc"; +my ($incdir) = "../nwww"; + +# Include files +my ($doctype) = "$incdir/doctype.inc"; +my ($style) = "$incdir/style.inc"; +my ($header) = "$incdir/header.inc"; +my ($footer) = "$incdir/footer.inc"; +my ($menu) = "$incdir/menu.inc" ; my ($query) = new CGI; @@ -17,6 +21,7 @@ my ($query) = new CGI; # This prevents malicious users using "../" to view files. my ($doc) = ($query->param('doc') =~ /^\s*([^\.]*?\.txt)\s*$/); +# This should be application/xhtml+xml print "Content-type: text/html\n\n"; unless (defined $doc) { @@ -34,50 +39,59 @@ $doc = "../htdocs/documentation/".$doc; my($docname) = $doc =~ /\/([^\/]+)$/; -print <<"END"; - +&print_html($doctype); - +print <<"END"; - - i-scream plain text documentation viewer + + + i-scream plain text documentation viewer + END &print_html($style); print <<"END"; - - - -
- -
+ + +
+
END &print_html($header); print <<"END"; -
-

i-scream documentation viewer

-

$docname

+
+

+ i-scream documentation viewer +

+

+ $docname +

END &print_file($doc); -print "
"; + +print <<"END"; + +
+END &print_html($footer); -print "
"; +print <<"END"; + +
+END &print_html($menu); print <<"END"; -
- +
+ END @@ -101,7 +115,7 @@ my ($punc) = '.:?\-'; my ($any) = "${ltrs}${gunk}${punc}"; my ($filename) = @_; if(open(FILE, $filename)) { - print "
\n";
+    print "          
\n";
     # Use $_ implicitly throughout.
     while () {
         # Must do the next line first!
@@ -112,7 +126,7 @@ if(open(FILE, $filename)) {
         s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/$1<\/a>/igox;
         print;
     }
-    print "
"; + print "\n
"; } else { print "Failed to open $docname."; -- 2.44.0