From: canburak
Subject: htmlgen ignores function return value
Date: 
Message-ID: <1130691699.284629.147800@z14g2000cwz.googlegroups.com>
Hi cll,

Thanks for your time reading the following text. I am trying to use
htmlgen for output (inside AllegroServe). I couldn't print out
variables or functions returning strings. Here is a sample code which
works:

(html
 (:html
  (:head (:title "title"))
  (:body "b" "o" "d" "y")))

output: ... body ...

I, naturally tried the following substition:

(html
 (:html
  (:head (:title "title"))
  (:body "b" (format nil "~A" "o") "d" "y")))

output: ... bdy ...

but it didn't worked. After reading the reference[0], I saw "anything
else  - everything else is simply evaluated in the normal lisp way and
the value thrown away.". After a little discuss with a friend I tried
following codes:

(let ((o "o"))(html
 (:html
  (:head (:title "title"))
  (:body "b" o "d" "y"))))

output: ... bdy ...


(let ((o "o"))(html
 (:html
  (:head (:title "title"))
  (:body "b" (:princ o) "d" "y"))))

output: ... bdy ...

There should be a way simpler than these. Finally, tried the example
from the reference[0] but it also didn't worked.

        (:html
          (:head (:title "Test Table"))
          (:body
           ((:table border 2)
            (dotimes (i count)
              (html (:tr (:td (:princ i))
                         (:td (:princ (* i i)

output: ...<tr><td></td><td></td></tr>...

I couldn't find the missing part. I am doing all of these in Slime REPL
or writing to a file and evaluating via C-x C-e. The answers from you
will possibly make me to dislike myself as I guess that I am missing a
simple bit.

Thanks..

[0] http://opensource.franz.com/aserve/aserve-dist/doc/htmlgen.html

-- 
@n

From: Bulent Murtezaoglu
Subject: Re: htmlgen ignores function return value
Date: 
Message-ID: <871x22oqq0.fsf@p4.internal>
>>>>> "cb" == canburak  <········@gmail.com> writes:
[...]
    cb> I couldn't find the missing part. I am doing all of these in
    cb> Slime REPL or writing to a file and evaluating via C-x
    cb> C-e. The answers from you will possibly make me to dislike
    cb> myself as I guess that I am missing a simple bit.

Hmm, dunno, I think you can keep liking yourself.  I don't use that
package, but it seems to me what you are is that there's implicit stream 
for the output, namely net.html.generator:*HTML-STREAM*.  So using 
the document you provided the link to, I came up with the hints 
below that might be helpful:

;;badly formatted sorry
CL-USER> net.html.generator:*HTML-STREAM*
NIL 
CL-USER> (net.html.generator:html  (:html
  (:head (:title "title"))
  (:body "b" (:princ "o") "d" "y")))
<html><head><title>title</title></head><body>bdy</body></html>
"</html>"
;;NOTE: did not work
CL-USER> (net.html.generator:html-stream *standard-output* 
  (net.html.generator:html  
    (:html
      (:head (:title "title"))
      (:body "b" (:princ "o") "d" "y"))))
<html><head><title>title</title></head><body>body</body></html>
"</html>"
;;NOTE: did work 
cheers,

BM
From: Can Burak Cilingir
Subject: Re: htmlgen ignores function return value
Date: 
Message-ID: <1130695336.221121.147050@z14g2000cwz.googlegroups.com>
Bulent Murtezaoglu wrote:
>>>>>>"cb" == canburak  <········@gmail.com> writes:
>
> [...]
>     cb> I couldn't find the missing part. I am doing all of these in
>     cb> Slime REPL or writing to a file and evaluating via C-x
>     cb> C-e. The answers from you will possibly make me to dislike
>     cb> myself as I guess that I am missing a simple bit.
>
> Hmm, dunno, I think you can keep liking yourself.  I don't use that
> package, but it seems to me what you are is that there's implicit stream
> for the output, namely net.html.generator:*HTML-STREAM*.  So using
> the document you provided the link to, I came up with the hints
> below that might be helpful:

[ ... ]

> CL-USER> (net.html.generator:html-stream *standard-output*
>   (net.html.generator:html
>     (:html
>       (:head (:title "title"))
>       (:body "b" (:princ "o") "d" "y"))))
> <html><head><title>title</title></head><body>body</body></html>
> "</html>"
> ;;NOTE: did work
> cheers,

I see. After seeing that it works in the REPL with your suggestion, I
published my functions to AllegroServe and it worked there. Besides the
fact that I need *standart-output* "conversion" to work on REPL, it
worked as is on the server. So everything is OK on my side. Thanks!

My assumption about "it prints the return values" is absolutely false.
"The html macro is designed to run inside AllegroServe's with-http-body
macro which binds *html-stream* to the correct stream." I see that this
is the sentence I missed.

So let me correct my words:

>(let ((o "o"))(html
> (:html
>  (:head (:title "title"))
>  (:body "b" (:princ o) "d" "y"))))

this works on AllegroServ but not on REPL.


 
> BM


-- 
@n
From: Bulent Murtezaoglu
Subject: Re: htmlgen ignores function return value
Date: 
Message-ID: <87r7a2natj.fsf@p4.internal>
>>>>> "BM" I  writes:
[...]
    BM> ...  I don't use
    BM> that package, but it seems to me what you are is that there's ...

"missing" is missing above as in "what you are _missing_ is ..." 

BM