guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to render raw data using sxml?


From: Jakub Jankiewicz
Subject: Re: How to render raw data using sxml?
Date: Tue, 12 Jul 2016 22:20:30 +0200

Hi,

On Mon, 11 Jul 2016 22:58:32 +0200
Amirouche Boubekki <address@hidden> wrote:

> Héllo Jakub,
> 
> On 2016-07-10 21:58, Jakub Jankiewicz wrote:
> > Hi,
> > 
> > I want to render scheme code inside script tag to be executed by 
> > biwascheme
> > in the browser so I've try to create simple page using sxml (cgi 
> > script):
> > 
> > (sxml->xml `(html
> >               (head
> >                  (title "BiwaScheme test")
> >                  (script (@ (src "biwascheme-min.js")) "(display 
> > \"hello\")"))
> >               (body (p "BiwaScheme test"))))
> >   
> 
> This is sxml to *xml*. The correct procedure you have to use
> is `sxml->html' which can be found in haunt code [1]. Basically
> it takes care of auto-closing tags like <br/>... and doing more
> escaping...
> 
> That said it has the same issue with script tag!
> 
> I attached a fixed version of html.scm which works in the case where
> `script' has a single element as body...
> 
> Here is an example:
> 
> >>> (sxml->html-string '(html (head (script (@ (lang "biwascheme")) 
> >>> "load(app.scm)")) (body (h1 "héllo") "world")))  
> $1 = <html><head><script 
> lang="biwascheme">load(app.scm)</script></head><body><h1>hllo</h1>world</body></html>
>   
> 
> Biwascheme is super nice! Do you plan to work with a particular
> javascript library?
> 
> HTH!
> 
> [1] https://git.dthompson.us/haunt.git/blob_plain/HEAD:/haunt/html.scm
> 

I've included the lib using:

(load "html.scm")
(use-modules (haunt html))

but when I run the code I still have &quot; instead of ":

(sxml->html `(html
              (head
                 (title "BiwaScheme test")
                 (script (@ (src "biwascheme-min.js")) "(display \"hello\")"))
              (body (p "BiwaScheme test"))))

<html><head><title>BiwaScheme test</title><script
src="biwascheme-min.js">(display
&quot;hello&quot;)</script></head><body><p>BiwaScheme test</p></body></html>

PS: I plan to use jQuery, I already have binding for biwascheme:
http://terminal.jcubic.pl/js/jqbiwa.js but it don't have Ajax functions or
deferreds in it, I need to update it.


--
Jakub Jankiewicz, Web Developer
http://jcubic.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]