From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jakub Jankiewicz Newsgroups: gmane.lisp.guile.user Subject: Re: How to render raw data using sxml? Date: Tue, 12 Jul 2016 22:20:30 +0200 Message-ID: <20160712222030.04b5218f@jcubic> References: <20160710215849.455f55fa@jcubic> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1468355199 23292 80.91.229.3 (12 Jul 2016 20:26:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jul 2016 20:26:39 +0000 (UTC) Cc: guile-user@gnu.org To: Amirouche Boubekki Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jul 12 22:26:29 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bN4GD-0000ed-7B for guile-user@m.gmane.org; Tue, 12 Jul 2016 22:26:29 +0200 Original-Received: from localhost ([::1]:43247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4GC-0006Lf-Et for guile-user@m.gmane.org; Tue, 12 Jul 2016 16:26:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4Aa-00008O-Gn for guile-user@gnu.org; Tue, 12 Jul 2016 16:20:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bN4AU-0000Zo-7N for guile-user@gnu.org; Tue, 12 Jul 2016 16:20:39 -0400 Original-Received: from n111.domenomania.pl ([144.76.86.235]:54907 helo=mx3.n111.domenomania.pl) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN4AT-0000Zk-QS for guile-user@gnu.org; Tue, 12 Jul 2016 16:20:34 -0400 Original-Received: from [91.239.251.231] (helo=jcubic) by n111.domenomania.pl with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1bN4AQ-000V3J-In; Tue, 12 Jul 2016 22:20:30 +0200 In-Reply-To: X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 144.76.86.235 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12736 Archived-At: Hi, On Mon, 11 Jul 2016 22:58:32 +0200 Amirouche Boubekki wrote: > H=C3=A9llo Jakub, >=20 > On 2016-07-10 21:58, Jakub Jankiewicz wrote: > > Hi, > >=20 > > I want to render scheme code inside script tag to be executed by=20 > > biwascheme > > in the browser so I've try to create simple page using sxml (cgi=20 > > script): > >=20 > > (sxml->xml `(html > > (head > > (title "BiwaScheme test") > > (script (@ (src "biwascheme-min.js")) "(display=20 > > \"hello\")")) > > (body (p "BiwaScheme test")))) > > =20 >=20 > 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
... and doing more > escaping... >=20 > That said it has the same issue with script tag! >=20 > I attached a fixed version of html.scm which works in the case where > `script' has a single element as body... >=20 > Here is an example: >=20 > >>> (sxml->html-string '(html (head (script (@ (lang "biwascheme"))=20 > >>> "load(app.scm)")) (body (h1 "h=C3=A9llo") "world"))) =20 > $1 =3D lang=3D"biwascheme">load(app.scm)

hllo

world= =20 >=20 > Biwascheme is super nice! Do you plan to work with a particular > javascript library? >=20 > HTH! >=20 > [1] https://git.dthompson.us/haunt.git/blob_plain/HEAD:/haunt/html.scm >=20 I've included the lib using: (load "html.scm") (use-modules (haunt html)) but when I run the code I still have " instead of ": (sxml->html `(html (head (title "BiwaScheme test") (script (@ (src "biwascheme-min.js")) "(display \"hello\")= ")) (body (p "BiwaScheme test")))) BiwaScheme test

BiwaScheme test

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