From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Amirouche Boubekki Newsgroups: gmane.lisp.guile.user Subject: Re: How to render raw data using sxml? Date: Mon, 11 Jul 2016 22:58:32 +0200 Message-ID: References: <20160710215849.455f55fa@jcubic> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1468270774 4110 80.91.229.3 (11 Jul 2016 20:59:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jul 2016 20:59:34 +0000 (UTC) Cc: guile-user@gnu.org, guile-user To: Jakub Jankiewicz Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jul 11 22:59:25 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 1bMiIU-0007kD-5V for guile-user@m.gmane.org; Mon, 11 Jul 2016 22:59:22 +0200 Original-Received: from localhost ([::1]:36035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMiIT-0002FB-C9 for guile-user@m.gmane.org; Mon, 11 Jul 2016 16:59:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMiHu-0002CS-LV for guile-user@gnu.org; Mon, 11 Jul 2016 16:58:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMiHs-0007wg-Ik for guile-user@gnu.org; Mon, 11 Jul 2016 16:58:45 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:41482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMiHk-0007qg-BQ; Mon, 11 Jul 2016 16:58:36 -0400 Original-Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id AFA8417209D; Mon, 11 Jul 2016 22:58:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Original-Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id NgxS2fCT6hVE; Mon, 11 Jul 2016 22:58:33 +0200 (CEST) X-Originating-IP: 10.58.1.145 Original-Received: from webmail.gandi.net (webmail5-d.mgt.gandi.net [10.58.1.145]) (Authenticated sender: amirouche@hypermove.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPA id 89D681720A4; Mon, 11 Jul 2016 22:58:32 +0200 (CEST) In-Reply-To: <20160710215849.455f55fa@jcubic> X-Sender: amirouche@hypermove.net User-Agent: Roundcube Webmail/1.1.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.70.183.196 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:12734 Archived-At: 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
... 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 =

hllo

world 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