Discussion:
Changing *attribute-quote-char*
Andrei Stebakov
2008-08-12 22:07:46 UTC
Permalink
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
Jens Teich
2008-08-12 22:21:11 UTC
Permalink
Post by Andrei Stebakov
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")))))
"<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
Andrei Stebakov
2008-08-12 22:40:03 UTC
Permalink
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
Post by Jens Teich
Post by Andrei Stebakov
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")))))
"<html><head><title>title</title><meta name='DESCRIPTION'
content='description' /><meta name='KEYWORDS' content='keywords'
/></head></html>"
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
http://common-lisp.net/mailman/listinfo/cl-who-devel
Jens Teich
2008-08-12 23:01:39 UTC
Permalink
Post by Andrei Stebakov
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
Jens Teich
2008-08-12 23:32:13 UTC
Permalink
Changing in specials.lisp helps of course:

(defparameter *attribute-quote-char* #\"
"Quote character for attributes.")

But then you can't switch back to #\'.

Jens
Andrei Stebakov
2008-08-12 23:38:33 UTC
Permalink
This is what I did for now. Not the cleanest solution but it works ;)
Post by Jens Teich
(defparameter *attribute-quote-char* #\"
"Quote character for attributes.")
But then you can't switch back to #\'.
Jens
_______________________________________________
cl-who-devel site list
http://common-lisp.net/mailman/listinfo/cl-who-devel
Edi Weitz
2008-08-13 11:16:05 UTC
Permalink
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).
Andrei Stebakov
2008-08-15 19:47:54 UTC
Permalink
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
Post by Edi Weitz
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
http://common-lisp.net/mailman/listinfo/cl-who-devel
Edi Weitz
2008-08-15 22:31:45 UTC
Permalink
Post by Andrei Stebakov
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?
Andrei Stebakov
2008-08-15 23:52:44 UTC
Permalink
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
Post by Edi Weitz
Post by Andrei Stebakov
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
http://common-lisp.net/mailman/listinfo/cl-who-devel
Loading...