Update of /project/clhp/cvsroot/public_html In directory common-lisp.net:/tmp/cvs-serv7957
Modified Files: view-source.clhp index.clhp Log Message: Ok here's a working source viewer, next up we work on making it pretty.
Date: Thu Nov 13 15:40:51 2003 Author: aventimiglia
Index: public_html/view-source.clhp diff -u public_html/view-source.clhp:1.1 public_html/view-source.clhp:1.2 --- public_html/view-source.clhp:1.1 Thu Nov 13 15:06:14 2003 +++ public_html/view-source.clhp Thu Nov 13 15:40:51 2003 @@ -1,21 +1,43 @@ -<?xml versio="1.0"?> +<?xml version="1.0"?> <?clhp (unless (find-package :www) (require "funcs.lisp")) (use-package :www)
+(defun real-path (page) + "Return the true path of URI" + (concatenate 'string (gethash :DOCUMENT_ROOT *SERVER-ENV*) + page)) + +(defun webify (string) + "This converts the offending characters in STRING to characters that +will allow for clean HTML output" + (concatenate 'string + (loop for char in (coerce string 'list) + appending + (case char + (#< '(#& #\l #\t #;)) + (#& '(#& #\a #\m #\p #;)) + (otherwise (list char)))) + "<br />")) + (echon +doctype+) ?> <html> <?clhp (echon (head "CLHP -- View Page Source")) ?> <body>
+<?clhp (echon (page-header "CLHP" ".clhp source viewer")) ?> + +<pre> <?clhp -(echon (page-header "CLHP" ".clhp source viewer")) -(echon (tag '|p| (list - "view page: " - (gethash "page" *query-vars*)))) +(with-open-file (str (real-path (gethash "page" *query-vars*))) + (loop for line = (read-line str nil 'eof) + while (not (eq 'eof line)) + do (princ (webify line)))) + ?> +</pre>
</body> </html>
Index: public_html/index.clhp diff -u public_html/index.clhp:1.7 public_html/index.clhp:1.8 --- public_html/index.clhp:1.7 Thu Nov 13 15:06:14 2003 +++ public_html/index.clhp Thu Nov 13 15:40:51 2003 @@ -1,16 +1,11 @@ <?xml version="1.0"?> <?clhp -;; Since the server is not yet equipped with CLHP, I will build run -;; these pages through the CLHP parser, and use the resulting pages -;; for the web site with the following command: +;; This loads an auxilary file, which contains common functions used +;; throughtout this site, the REQUIRE name is probably a bad function +;; name, but at the time INCLUDE was taken, now I can rename it. ;; -#| -$ lisp -core /usr/lib/cmucl/clhp.core \ - -eval '(clhp:parse "index.clhp")(quit)' > index.html && \ - echo -e "1,3d\nwq\n" | ed index.html -|# -;; The HTTP Headers will have to be deleted from the resulting file. - +;; If you want to see the contents of "funcs.lisp" goto +;; http://common-lisp.net/project/clhp/view-source.clhp?page=/funcs.lisp (unless (find-package :www) (require "funcs.lisp")) (use-package :www) @@ -19,19 +14,45 @@ ;; CAR as the section name and the CDR as the section contents. (setq *page-sections* '(("Introduction" - "CLHP combines the joys of common Lisp with the ease of PHP for web development. Just as with PHP, you embed code into an XML or HTML document using XML processing instructions <b><?clhp :like-this ?></b>. By using XML processing instructions, lisp code can be embedded in any valid XML document and still result in a valid XML document" - "The CLHP parser is integrated into the <a href='http://www.apache.org/'>Apache</a> web server as a module. When Apache recieves a request for a clhp page, Apache passes it on to a Lisp process which simply looks for the <?clhp processing instructions. The Lisp code inside the processing instructions is evaluated, all output through *STANDARD-OUTPUT* is printed in place of the processing instruction block. All other text outside of the processing instructions is passed on as is." - "The langauge inside CLHP is Common-Lisp, so CLHP itself defines very few functions. It allows you to build Web programs the same way you would write a Lisp program. You can define functions, structures etc inside your page, or you could load external precompiled files with utility functions in them.") + "CLHP combines the joys of common Lisp with the ease of PHP +for web development. Just as with PHP, you embed code into an XML or +HTML document using XML processing instructions <b><?clhp +:like-this ?></b>. By using XML processing instructions, lisp code +can be embedded in any valid XML document and still result in a valid +XML document" + "The CLHP parser is integrated into the <a +href='http://www.apache.org/%27%3EApache</a> web server as a module. When +Apache recieves a request for a clhp page, Apache passes it on to a +Lisp process which simply looks for the <?clhp processing +instructions. The Lisp code inside the processing instructions is +evaluated, all output through *STANDARD-OUTPUT* is printed in place of +the processing instruction block. All other text outside of the +processing instructions is passed on as is." + "The langauge inside CLHP is Common-Lisp, so CLHP itself +defines very few functions. It allows you to build Web programs the +same way you would write a Lisp program. You can define functions, +structures etc inside your page, or you could load external +precompiled files with utility functions in them.") ("Current version" - "The latest version is 0.2.0alpha, it brings the Apache module, asdf package building, and a few small enhancements to the CLHP package.") + "The latest version is 0.2.0alpha, it brings the Apache +module, asdf package building, and a few small enhancements to the +CLHP package.") ("Mailing Lists" "<ul> - <li><a href="http://common-lisp.net/mailman/listinfo/clhp-devel%5C%22%3Eclhp-devel</a> List for Developer discussion and bug reports.</li> - <li><a href="http://common-lisp.net/mailman/listinfo/clhp-announce%5C%22%3Eclhp-devel</a> Announcements on Releases, patches, bug-fixes and general news.</li> - <li><a href="http://common-lisp.net/mailman/listinfo/clhp-cvs%5C%22%3Eclhp-cvs</a> Reports on CVS activity.</li> +<li><a href="http://common-lisp.net/mailman/listinfo/clhp-devel%5C%22%3E + clhp-devel</a> List for Developer discussion and bug reports.</li> +<li><a href="http://common-lisp.net/mailman/listinfo/clhp-announce%5C%22%3E + clhp-announce</a> Announcements on Releases, patches, bug-fixes +and general news.</li> +<li><a href="http://common-lisp.net/mailman/listinfo/clhp-cvs%5C%22%3E + clhp-cvs</a> Reports on CVS activity.</li> </ul>") ("Documentation" - "Sorry, right now you're left to reading the source on how CLHP specific functions and variables work, but I'll have some basic documentation coming soon. If you want to see examples of CLHP in action, click the <b>View-Source</b> link at the top of any of the pages on this site."))) + "Sorry, right now you're left to reading the source on how +CLHP specific functions and variables work, but I'll have some basic +documentation coming soon. If you want to see examples of CLHP in +action, click the <b>View-Source</b> link at the top of any of the +pages on this site.")))
@@ -46,7 +67,7 @@ <body>
<?clhp -(loop for tag in (page-body "$Date: 2003/11/13 20:06:14 $") +(loop for tag in (page-body "$Date: 2003/11/13 20:40:51 $") do (echon tag)) ?>