I'm trying to produce this output
"<texarea name='NAME' type='TYPE'>value</texarea>"
With this everything is ok:
(cl-who:with-html-output-to-string (s)
(:texarea :name 'name :type 'type "value"))
"<texarea name='NAME' type='TYPE'>value</texarea>"
but why doesn't below work (value is missing)
(cl-who:with-html-output-to-string (s)
(:texarea :name 'name :type 'type 'value))
"<texarea name='NAME' type='TYPE'></texarea>"
or this
(cl-who:with-html-output-to-string (s)
(:texarea :name 'name :type 'type (princ-to-string 'value)))
or this
(let ((val "value"))
(cl-who:with-html-output-to-string (s)
(:texarea :name 'name :type 'type val)))
"<texarea name='NAME' type='TYPE'></texarea>"
How to write a function like this
(defun test (name type value)
(cl-who:with-html-output-to-string (s)
(:texarea :name name :type type value)))
that will render the value
(test 'name 'type 'value)
"<texarea name='NAME' type='TYPE'></texarea>"
(test 'name 'type "value")
"<texarea name='NAME' type='TYPE'></texarea>"
thanks
Slobodan
> but why doesn't below work (value is missing)
> (cl-who:with-html-output-to-string (s)
> (:texarea :name 'name :type 'type 'value))
> "<texarea name='NAME' type='TYPE'></texarea>"
>
> or this
> (cl-who:with-html-output-to-string (s)
> (:texarea :name 'name :type 'type (princ-to-string
'value)))
> or this
> (let ((val "value"))
> (cl-who:with-html-output-to-string (s)
> (:texarea :name 'name :type 'type val)))
> "<texarea name='NAME' type='TYPE'></texarea>"
I think you have to change the use to something like:
(:textarea :name 'name :type 'type (cl-who:str (princ-to-string 'value)))
--
Sohail Somani
http://uint32t.blogspot.com
>> (let ((val "value"))
>> (cl-who:with-html-output-to-string (s)
>> (:texarea :name 'name :type 'type val)))
>> "<texarea name='NAME' type='TYPE'></texarea>"
>
> I think you have to change the use to something like:
>
> (:textarea :name 'name :type 'type (cl-who:str (princ-to-string
> 'value)))
PRINC-TO-STRING is unnecessary, cl-who:str knows how to deal with symbols
already (though symbols in general are printed a bit ugly, as they get
upcased).
Cheers,
Maciej
(cl-who:with-html-output-to-string (s)
(your-print-function some-value s))
i.e. inside the body of cl-who:with-html-output-to-string, s is bound
to a stream you can write to, just like with-output-to-string.
cheers
Alessio
Many thanks Sohail, it solved my problem
Slobodan
Well in my case that is expected behaviour, thanks for noticing .
Thanks to everybody for their advices.
Slobodan
cheers
Slobodan