[cl-who-devel] Changing *attribute-quote-char*

By default the variable is initialized to #\' If I want to change it to #\" via local binding I still get the single quotes in the resulting string. (let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords"))))) I get: "<html><head><title>title</title><meta name='DESCRIPTION' content='description' /><meta name='KEYWORDS' content='keywords' /></head></html>" Is it possible to make a local new binding or I should change it only globally? Thank you, Andrew

Andrei Stebakov schrieb:
By default the variable is initialized to #\' If I want to change it to #\" via local binding I still get the single quotes in the resulting string.
(let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords")))))
I get: "<html><head><title>title</title><meta name='DESCRIPTION' content='description' /><meta name='KEYWORDS' content='keywords' /></head></html>"
I get the correct result evaluating exactly your form: CL-WHO 507 > (let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords"))))) "<html><head><title>title</title><meta name=\"DESCRIPTION\" content=\"description\" /><meta name=\"KEYWORDS\" content=\"keywords\" /></head></html>" LW 5.1 cl-who 0.11.0 Mac OS X 10.5 Jens

It should work, I am quite baffled that it doesn't... It's Ubuntu with sbcl 1.0.18, cl-who 0.11.0 What's funny is that even when I set it to #\" globally and evaluate it in the lisp, it's not enough for hunchentoot to pick it up. I have to evaluate it in the lisp image + put the (setf *attribute-quote-char* #\") in the body of the hunchentoot handler! I tried to put the cl-who prefix to the variable, but it doesn't make any difference. Andrew On Tue, Aug 12, 2008 at 6:21 PM, Jens Teich <info@jensteich.de> wrote:
Andrei Stebakov schrieb:
By default the variable is initialized to #\' If I want to change it to #\" via local binding I still get the single quotes in the resulting string.
(let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords")))))
I get: "<html><head><title>title</title><meta name='DESCRIPTION' content='description' /><meta name='KEYWORDS' content='keywords' /></head></html>"
I get the correct result evaluating exactly your form:
CL-WHO 507 > (let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords"))))) "<html><head><title>title</title><meta name=\"DESCRIPTION\" content=\"description\" /><meta name=\"KEYWORDS\" content=\"keywords\" /></head></html>"
LW 5.1 cl-who 0.11.0 Mac OS X 10.5
Jens _______________________________________________ cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel

Andrei Stebakov schrieb:
It should work, I am quite baffled that it doesn't... It's Ubuntu with sbcl 1.0.18, cl-who 0.11.0 What's funny is that even when I set it to #\" globally and evaluate it in the lisp, it's not enough for hunchentoot to pick it up. I have to evaluate it in the lisp image + put the (setf *attribute-quote-char* #\") in the body of the hunchentoot handler! I tried to put the cl-who prefix to the variable, but it doesn't make any difference.
Andrew
Ah, with SBCL 1.0.15 I see the same: WHO> (let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords"))))) "<html><head><title>title</title><meta name='DESCRIPTION' content='description' /><meta name='KEYWORDS' content='keywords' /></head></html>" Unfortunately Edi is on vacation ... Jens

Changing in specials.lisp helps of course: (defparameter *attribute-quote-char* #\" "Quote character for attributes.") But then you can't switch back to #\'. Jens

This is what I did for now. Not the cleanest solution but it works ;) On Tue, Aug 12, 2008 at 7:32 PM, Jens Teich <info@jensteich.de> wrote:
Changing in specials.lisp helps of course:
(defparameter *attribute-quote-char* #\" "Quote character for attributes.")
But then you can't switch back to #\'.
Jens _______________________________________________ cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel

On Tue, 12 Aug 2008 18:07:46 -0400, "Andrei Stebakov" <lispercat@gmail.com> wrote:
By default the variable is initialized to #\' If I want to change it to #\" via local binding I still get the single quotes in the resulting string.
WITH-HTML-OUTPUT is a macro, so what is relevant is the value of *ATTRIBUTE-QUOTE-CHAR* at macro expansion time. If you play around in the REPL, this is obviously different for Lisps which always compile everything (like SBCL) and Lisps which use an interpreter for REPL forms (like LispWorks). See chapter 3 of the CLHS for details. Edi (still on vacation).

I was not just playing with REPL, I tried to compile the code and reloaded the image (let ((*attribute-quote-char* #\")) (with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "title") (:meta :name "DESCRIPTION" :content "description") (:meta :name "KEYWORDS" :content "keywords"))))) but I still had a single quote in the resulting code. Andrew On Wed, Aug 13, 2008 at 7:16 AM, Edi Weitz <edi@agharta.de> wrote:
On Tue, 12 Aug 2008 18:07:46 -0400, "Andrei Stebakov" <lispercat@gmail.com> wrote:
By default the variable is initialized to #\' If I want to change it to #\" via local binding I still get the single quotes in the resulting string.
WITH-HTML-OUTPUT is a macro, so what is relevant is the value of *ATTRIBUTE-QUOTE-CHAR* at macro expansion time. If you play around in the REPL, this is obviously different for Lisps which always compile everything (like SBCL) and Lisps which use an interpreter for REPL forms (like LispWorks). See chapter 3 of the CLHS for details.
Edi (still on vacation). _______________________________________________ cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel

On Fri, 15 Aug 2008 15:47:54 -0400, "Andrei Stebakov" <lispercat@gmail.com> wrote:
I was not just playing with REPL, I tried to compile the code and reloaded the image
I don't understand. What do you mean when you say "reloaded the image"? Could you provide a detailed explanation of what you've done? Can you check if this works differently for other Lisps like LispWorks?

I have a lisp image that I load with detachtty. What I do is call sb-ext:save-lisp-and-die and then reload the image with detachtty. I don't have any other lisps installed. I can only refer to Jens who tried it with LispWorks on Mac. When I have a chance I'll check it with CLisp. Thank you, Andrew On Fri, Aug 15, 2008 at 6:31 PM, Edi Weitz <edi@agharta.de> wrote:
On Fri, 15 Aug 2008 15:47:54 -0400, "Andrei Stebakov" <lispercat@gmail.com> wrote:
I was not just playing with REPL, I tried to compile the code and reloaded the image
I don't understand. What do you mean when you say "reloaded the image"? Could you provide a detailed explanation of what you've done? Can you check if this works differently for other Lisps like LispWorks? _______________________________________________ cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel
participants (3)
-
Andrei Stebakov
-
Edi Weitz
-
Jens Teich