[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Marking lisp expressions

From: Jean-Christophe Helary
Subject: Marking lisp expressions
Date: Sun, 26 Jan 2020 13:17:54 +0900

(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 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:

(@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
----------------------------------------------- @brandelune

reply via email to

[Prev in Thread] Current Thread [Next in Thread]