(Sorry for the rich text mail, I needed to show some html output.)

I'm looking for a way to mark lisp expressions so that the html output (for 
now?) can have some sort of syntax coloring. I'm now using the following 
mapping:

        functions →     @command
        arguments →     @var
        constants →     @strong (for now only "t" and "()")
        comments →      @r

With the modified HTML.pm that I use (the small patch that I sent the other day 
that adds different classes to identical tags) I have:

        'command'     => 'code class="command"'
        'var'         => 'var'
        'strong'      => 'strong'
        'r'           => 'span class="roman"'

I can isolate constants (@strong) with the css selectors because they are 
inside lisp blocks (or marked with an extra @code when within explanatory 
text), hence @strong is not ideal.

Here is some sample marking:

@lisp
(@command{defun} @var{subst} (@var{x y z})
  (@command{cond} ((@command{atom} @var{z})
         (@command{cond} ((@command{eq} @var{z y}) @var{x})
               (@command{'}@strong{t} @var{z})))
        (@command{'}@strong{t} (@command{cons} (@command{subst} @var{x y} 
(@command{car} @var{z}))
                  (@command{subst} @var{x y} (@command{cdr} @var{z}))))))
@end lisp

and the styled html output (I use a style sheet similar to the one I showed in 
the html+css thread) :
(defun subst (x y z)
  (cond ((atom z)
         (cond ((eq z y) x)
               ('t z)))
        ('t (cons (subst x y (car z))
                  (subst x y (cdr z))))))

(this is taken from "The Roots of Lisp" by Paul Graham)

My questions are

1) are there better semantic markers for arguments, constants and comments ?

2) if not, would it be acceptable to create a few more semantic markers that 
correspond to "arguments", "constants" and "comments" ?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com <http://mac4translators.blogspot.com/> 
@brandelune


Reply via email to