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: Amirouche Boubekki
Subject: Re: How to render raw data using sxml?
Date: Mon, 11 Jul 2016 22:58:32 +0200
User-agent: Roundcube Webmail/1.1.2

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

--
Amirouche ~ amz3 ~ http://www.hyperdev.fr



reply via email to

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