Re: Presentation software
Daniel Barlow <[email protected]> Mon, 11 Aug 2003 12:29:48 +0100
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Ruhi Bloodworth" <[email protected]> writes: > This is very useful. I have modified Acclaim to allow exporting to > html slides. http://lab.visionsnorth.ca/ruhi/software/viewer.lisp Cool. > I am a lisp newbie so any comments are appreciated. OK, well, the most obvious comments are - * this is almost the classic application for multiple specialisation (multimethods). Instead of introducing a new render-element-html method, change the render-element signature from (element) to (element backend). For example, suppose we create a couple of new classes for clx-backend and html-backend: (defclass clx-backend () ()) (defclass html-backend () ((stream :initarg :stream :reader output-stream))) then we could write (defmethod render-element ((e ul) (backend clx-backend)) (let ((*offset* (+ *offset* #c(20 15)))) (+ #c(20 30) (call-next-method)))) replacing the existing method, then do (defmethod render-element ((e ul) (backend html-backend)) (render-content-html e "<ul>" "</ul>" (output-stream backend))) (note that I've also extended your render-content-html method to take the stream as an argument). * All those similar render-element-html methods are a sign that something somewhere could be generalised. How about (untested) (defmethod render-element-html ((e element)) (let* ((n (class-name e)) (start (format nil "<~A>" n)) (end (format nil "</~A>" n))) (render-content-html e start end))) You still need to override this for the complicated elements like CENTER or SMALLPRE, but that's fair enough. * Personal Pet Peeve: pathnames are not strings Consider what happens when I invoke (export-html (merge-pathnames "slides.lisp" (user-homedir-pathname))) The CL pathname system is a thing of much beauty, modulo a few weird cases (and provided you mostly stay away from logical pathnames, which don't do quite what you think they do). It'd be worthwhile reading the appropriate CLHS chapter. Thanks for the patches, anyway, and hope this gives you a few things to think about. - -dan - -- http://www.cliki.net/ - Link farm for free CL-on-Unix resources -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/N34yHDK5ZnWQiRMRAlbPAJ9QX58G7O+wnXPNIASnnYLhnXCg+gCfY9k+ FmZRtSjmCOcshQNKUcA0u+g= =voeH -----END PGP SIGNATURE-----