Discussion:
indent textarea
Inge Bylemans
2007-03-13 15:07:54 UTC
Permalink
Hi,

When I put the :indent option to true in with-html-output-to-string, the
textarea is filled with spaces, even when it is not empty, a new line start
with spaces behind it. Is there a way to put :indent to true without side
effect on my textarea?

Thanks
Inge
Jens Teich
2007-03-13 15:52:54 UTC
Permalink
Post by Inge Bylemans
Hi,
When I put the :indent option to true in with-html-output-to-string,
the textarea is filled with spaces, even when it is not empty, a new
line start with spaces behind it. Is there a way to put :indent to
true without side effect on my textarea?
(fmt "<textarea></textarea>") should do the trick.

-jens
Inge Bylemans
2007-03-13 15:59:35 UTC
Permalink
Post by Jens Teich
(fmt "<textarea></textarea>") should do the trick.
Thanks for the quick response
Where should I put that?
Now this is what I have:
(:textarea :name "comment" :rows 3 :cols 50 (princ comment))

Thanks
Edi Weitz
2007-03-13 19:17:36 UTC
Permalink
Post by Inge Bylemans
(:textarea :name "comment" :rows 3 :cols 50 (princ comment))
What is the PRINC supposed to do there?
Inge Bylemans
2007-03-14 07:31:49 UTC
Permalink
The princ is for entering the data from comment variable in the textarea,
like :value for a input field. I don't know how else to get the data to be
shown.
Post by Edi Weitz
Post by Inge Bylemans
(:textarea :name "comment" :rows 3 :cols 50 (princ comment))
What is the PRINC supposed to do there?
_______________________________________________
cl-who-devel site list
http://common-lisp.net/mailman/listinfo/cl-who-devel
Edi Weitz
2007-03-14 10:58:35 UTC
Permalink
Post by Inge Bylemans
The princ is for entering the data from comment variable in the
textarea, like :value for a input field. I don't know how else to
get the data to be shown.
Reading the documentation might help in this case:

http://weitz.de/cl-who/#syntax

Look at STR, ESC, and FMT. Your PRINC will only work if the stream
CL-WHO is currently writing to is *STANDARD-OUTPUT*.
Edi Weitz
2007-03-13 19:17:00 UTC
Permalink
Post by Inge Bylemans
When I put the :indent option to true in with-html-output-to-string,
the textarea is filled with spaces, even when it is not empty, a new
line start with spaces behind it.
Yes, I'm aware of that. I personally don't mind as I only use the
:INDENT option for debugging.
Post by Inge Bylemans
Is there a way to put :indent to true without side effect on my
textarea?
Something like this (untested):

(defmethod who:convert-tag-to-string-list :around ((tag (eql :textarea)) attr-list body body-fn)
(let ((who::*indent* nil))
(call-next-method)))

See <http://weitz.de/cl-who/#convert-tag-to-string-list>.
Toby Allsopp
2007-03-15 07:02:54 UTC
Permalink
Post by Inge Bylemans
Hi,
When I put the :indent option to true in with-html-output-to-string, the
textarea is filled with spaces, even when it is not empty, a new line start
with spaces behind it. Is there a way to put :indent to true without side
effect on my textarea?
What I do is to wrap the textarea in another with-html-output without
:indent t, e.g.

(with-html-output-to-string (s nil :prologue t :indent t)
(with-html-output (s)
(:textarea :name name
:rows rows
:cols cols
(esc (or value "")))))

Cheers,
Toby.

Loading...