/[clhp]/public_html/view-source.clhp
ViewVC logotype

Contents of /public_html/view-source.clhp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Nov 25 19:46:09 2003 UTC (10 years, 4 months ago) by aventimiglia
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +8 -4 lines
Modified to be used as static page until clhp is allowed to run on common-lisp.net
1 <?xml version="1.0"?>
2 <?clhp
3 (unless (find-package :www)
4 (require "funcs.lisp"))
5 (use-package :www)
6
7 (defun real-path (page)
8 "Return the true path of URI"
9 (concatenate 'string (gethash :DOCUMENT_ROOT *SERVER-ENV*)
10 (if (search "../" page) "/index.clhp"
11 page)))
12
13 (defun webify (string)
14 "This converts the offending characters in STRING to characters that
15 will allow for clean HTML output"
16 (concatenate 'string
17 (loop for char in (coerce string 'list)
18 appending
19 (case char
20 (#\< '(#\& #\l #\t #\;))
21 (#\& '(#\& #\a #\m #\p #\;))
22 (otherwise (list char))))))
23 (defun fontify (string)
24 "Syntax Highlighting function"
25 string)
26
27 (echon +doctype+)
28 ?>
29 <html>
30 <?clhp (echon (head "CLHP -- View Page Source")) ?>
31 <body>
32
33 <?clhp (echon (page-header "CLHP" ".clhp source viewer")) ?>
34
35 <pre>
36 <?clhp
37 (with-open-file (str (real-path (gethash "page" *query-vars*)))
38 (echo (tag '|h1| (real-path (gethash "page" *query-vars*))))
39 (loop for line = (read-line str nil 'eof)
40 while (not (eq 'eof line))
41 do (echo (fontify (webify line)) (tag '|br|))))
42
43 ?>
44 </pre>
45
46 </body>
47 </html>

  ViewVC Help
Powered by ViewVC 1.1.5