Discussion:
setting *attribute-quote-char*
Austin Haas
2006-03-20 04:01:46 UTC
Permalink
Hi,

Could someone please tell me the proper way to set *attribute-quote-char*?

I'm a noob, but I've spent the past 4 hours trying every way I could think of,
to no avail. If I recompile a handler function, then it will take, but I can't
get it to be set when I load the system via asdf.

It's likely some ignorance on my part regarding packages or macros, but I would
really appreciate it if someone could show me an example of how they use it.

Thanks.

-austin
Edi Weitz
2006-03-20 10:44:10 UTC
Permalink
Post by Austin Haas
Could someone please tell me the proper way to set
*attribute-quote-char*?
I'm a noob, but I've spent the past 4 hours trying every way I could
think of, to no avail. If I recompile a handler function, then it
will take, but I can't get it to be set when I load the system via
asdf.
What do you mean by "get it to be set when I load the system?" Which
system, CL-WHO or your own system which requires CL-WHO? You want to
set the variable before CL-WHO is loaded?
Austin Haas
2006-03-20 14:28:31 UTC
Permalink
Sorry, I meant my system, which requires CL-WHO.

I have this in the main component file of my system:

(setq tbnl:*tbnl-port* 3000)


(setq cl-who:*attribute-quote-char* #\")


(setq cl-who:*prologue* "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")




(in-package #:pettomato)





(defun test-handler()


(with-html-output-to-string (*standard-output* nil :prologue t)


(:html (:body :bgcolor "black"


"Not much there"))


(values)))





(defun start ()


(print "Starting server")


(terpri)


(tbnl:start-tbnl))





(defun stop ()


(print "Stopping server")


(terpri)


(tbnl:stop-tbnl))





;; Route requests to handlers.


(setq *dispatch-table*


(nconc


(mapcar (lambda (args)


(apply #'create-regex-dispatcher args))


'(("test\.l" test-handler)))


(list #'default-dispatcher)))








(start)

After the server starts, if I hit the test.l page, I will see that the prologue
is still 'strict' and the *attribute-quote-char* is still #\'. If I reevaluate
test-handler, then it will take the new values that I set above.

Please feel free to bash anything that I'm doing naively. I would very much
appreciate it.

-austin
Post by Edi Weitz
Post by Austin Haas
Could someone please tell me the proper way to set
*attribute-quote-char*?
I'm a noob, but I've spent the past 4 hours trying every way I could
think of, to no avail. If I recompile a handler function, then it
will take, but I can't get it to be set when I load the system via
asdf.
What do you mean by "get it to be set when I load the system?" Which
system, CL-WHO or your own system which requires CL-WHO? You want to
set the variable before CL-WHO is loaded?
Edi Weitz
2006-03-20 15:30:55 UTC
Permalink
Post by Austin Haas
Sorry, I meant my system, which requires CL-WHO.
[...]
After the server starts, if I hit the test.l page, I will see that
the prologue is still 'strict' and the *attribute-quote-char* is
still #\'. If I reevaluate test-handler, then it will take the new
values that I set above.
Yeah, that's a matter of macro expansion time vs. compile time
vs. load time. Wrap the SETQs with EVAL-WHEN or (better) put them
into a file that is LOADed before your functions (using CL-WHO macros)
are compiled.

<http://www.lispworks.com/documentation/HyperSpec/Body/03_b.htm>
<http://www.gigamonkeys.com/book/macros-defining-your-own.html>

HTH,
Edi.

Loading...