From 670761dd6bd6321d65beeacdc81d68c0a2ebe92b Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Mon, 13 Mar 2000 05:14:23 +0000 Subject: Updated web pages. --- html/elispmarkup.php3 | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 html/elispmarkup.php3 (limited to 'html/elispmarkup.php3') diff --git a/html/elispmarkup.php3 b/html/elispmarkup.php3 new file mode 100644 index 00000000..a18586c9 --- /dev/null +++ b/html/elispmarkup.php3 @@ -0,0 +1,134 @@ +" . $text . "\n"; +} + +// FIXME: this is a nonsense really. Might be okay if it +// used dynamic HTML but it's too much of a faff at the moment. +// Also, we should use the tree structure properly and keep a stack! + +function outline_markup($filename,$thispage,$expanded) { + if ($title=="") { $title=$filename; }; + $outline = false; + $file = file($filename); + $i = 0; + $level=0; + $headingno=0; + /* Now parse file, watching for outline headers */ + for (;$i < count($file);$i++) { + $line = $file[$i]; + // HTML escapes + $line = htmlentities($line); + // Anchors for URLs + $line = ereg_replace("((http://|mailto:)[-a-zA-Z0-9\.~/_@]+)","\\1",$line); + // Assume a heading + $multipar=false; + if (ereg("-\*- (mode:)?outline -\*-",$line)) { + // Found line with outline mode header, set flag + // and print message + $outline = true; + print "
";
+ print "This is a flattened outline file: click on a title to hide/reveal the leaf underneath it.";
+ print "
Click ";
+ print "here to show body, or ";
+ print "here to hide all.";
+ print "
\n"; }; + $newpara = true; + } elseif (ereg("^([\*]+) (.*)\n",$line,$heading)) { + $newlevel = strlen($heading[1])+1; + // if ($newlevel < $level) { + // Up a level + // $p = strpos($path,"-"); + // $path = substr($path,0,$p-1); + if ($newpara && + $level<=$newlevel && + isexpanded($headingno,$expanded)) { print "
\n"; }
+ $headingno++;
+ $level=$newlevel;
+ $text="
\n"; } + print $line; + $newpara=false; + $level=0; + } + } else { + print $line; + } + } +} + +// +// For browsing source. Unfinished. +// + +function elisp_markup($filename,$thispage,$title="") { + if ($title=="") { $title=$filename; }; + $file = file($filename); + $i = 0; + $level=0; + $headingno=0; + /* Now parse file, watching for outline headers */ + for (;$i < count($file);$i++) { + $line = $file[$i]; + // HTML escapes + $line = htmlentities($line); + // Anchors for URLs + $line = ereg_replace("((http://|mailto:)[-a-zA-Z0-9\.~/_@]+)","\\1",$line); + // Font-lock equivalents... + // 1. comments + $line = ereg_replace("(;+.*\n)", + "