HTMLize CL code with Hyperspec Links
Friday, May 7, 2004
Lispmeister,
Play with the Machine, and
Notes from my terminal all mentioned the Lisp site
bknr in various posts. I had a look at their site and was
pretty impressed by some of the things they're doing. So, I decided to check out some of their
Lisp code and had a play with their
htmlize utility. It's similar to the Emacs
htmlize.el utility that converts font-lock colorizing in an Emacs buffer
to HTML. I've used htmlize.el in the past to colorize Lisp code
snippets that
I've posted on this blog. However, the bknr version of htmlize is designed specifically for CL and
it has a nice unique feature - it
automatically puts in hyperlinks to the CL Hyperspec for all CL
symbols. For example, here's a snippet of the htmlize.lisp code after it's been
run through itself:
(defun htmlize (input output) (let ((*standard-output* output)) (write-string "<pre class="htmlize">") (loop for form = (bknr-read input nil 'eof) until (eq form 'eof) do (to-html form)) (write-string "</pre>")))
Click on any of the highlighted Lisp symbols in the above code snippet to be taken to the relevant page in the CL Hyperspec - very cool!

