* How to render raw data using sxml? @ 2016-07-10 19:58 Jakub Jankiewicz 2016-07-11 6:48 ` tomas ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Jakub Jankiewicz @ 2016-07-10 19:58 UTC (permalink / raw) To: guile-user 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): (display "Content-Type: text/html") (newline) (newline) (display "<!DOCTYPE html>") (newline) (sxml->xml `(html (head (title "BiwaScheme test") (script (@ (src "biwascheme-min.js")) "(display \"hello\")")) (body (p "BiwaScheme test")))) but the output was: <!DOCTYPE html> <html><head><title>BiwaScheme test</title><script src="biwascheme-min.js">(display "hello")</script></head><body><p>BiwaScheme test</p></body></html> which is invalid scheme code. I've also try this: (script (@ (src "biwascheme-min.js")) "(display " #\" "hello" #\" ")") but got the same result. How can I display raw data using sxml->xml thanks in advance Jakub -- Jakub Jankiewicz, Web Developer http://jcubic.pl ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-10 19:58 How to render raw data using sxml? Jakub Jankiewicz @ 2016-07-11 6:48 ` tomas 2016-07-11 20:58 ` Amirouche Boubekki 2016-07-13 12:28 ` Matt Wette 2 siblings, 0 replies; 15+ messages in thread From: tomas @ 2016-07-11 6:48 UTC (permalink / raw) To: guile-user -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Jul 10, 2016 at 09:58:49PM +0200, 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): > > (display "Content-Type: text/html") > (newline) > (newline) > (display "<!DOCTYPE html>") > (newline) > (sxml->xml `(html > (head > (title "BiwaScheme test") > (script (@ (src "biwascheme-min.js")) "(display \"hello\")")) > (body (p "BiwaScheme test")))) > > but the output was: > > <!DOCTYPE html> > <html><head><title>BiwaScheme test</title><script > src="biwascheme-min.js">(display > "hello")</script></head><body><p>BiwaScheme test</p></body></html> > > which is invalid scheme code. I've also try this: > > (script (@ (src "biwascheme-min.js")) "(display " #\" "hello" #\" ")") > > but got the same result. How can I display raw data using sxml->xml Ahhh... the HTML <script> tag. This one sticks out like a sore thumb :-) Note that embedded Javascript can be... interesting. How would you parse this: <script type="text/javascript> var kidding="the end of </script>"; # the above is just kidding </script> The html parser would have to parse the embedded script to grok that the first close tag is just fake. Strictly one has to quote (at least the '<') whithin the <script>, better to quote all the (five?) magic XML entities. So the generated code above seems OK. The client (aka browser) is supposed to unescape the text before handing it over to the script machinery. So if it doesn't, yo'd have to look there. That said, you could try the XHTML trick and wrap the script in a CDATA section. See e.g. [1], under "Differences Between HTML and XHTML" for an example. [1] http://www.w3schools.com/tags/tag_script.asp regards - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAleDQUoACgkQBcgs9XrR2kbAswCfSpow0DUWEYOQL6NLXrncVYCW AuAAnjeB8UdIkTfiGTARon4O21KFU5Jx =WlJT -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-10 19:58 How to render raw data using sxml? Jakub Jankiewicz 2016-07-11 6:48 ` tomas @ 2016-07-11 20:58 ` Amirouche Boubekki 2016-07-12 20:20 ` Jakub Jankiewicz 2016-07-13 12:28 ` Matt Wette 2 siblings, 1 reply; 15+ messages in thread From: Amirouche Boubekki @ 2016-07-11 20:58 UTC (permalink / raw) To: Jakub Jankiewicz; +Cc: guile-user, guile-user 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-11 20:58 ` Amirouche Boubekki @ 2016-07-12 20:20 ` Jakub Jankiewicz 2016-07-12 20:23 ` Jakub Jankiewicz 0 siblings, 1 reply; 15+ messages in thread From: Jakub Jankiewicz @ 2016-07-12 20:20 UTC (permalink / raw) To: Amirouche Boubekki; +Cc: guile-user Hi, On Mon, 11 Jul 2016 22:58:32 +0200 Amirouche Boubekki <amirouche@hypermove.net> 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 " 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 "hello")</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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-12 20:20 ` Jakub Jankiewicz @ 2016-07-12 20:23 ` Jakub Jankiewicz 2016-07-13 9:57 ` tomas 0 siblings, 1 reply; 15+ messages in thread From: Jakub Jankiewicz @ 2016-07-12 20:23 UTC (permalink / raw) To: Amirouche Boubekki; +Cc: guile-user On Tue, 12 Jul 2016 22:20:30 +0200 Jakub Jankiewicz <jcubic@jcubic.pl> wrote: > Hi, > > On Mon, 11 Jul 2016 22:58:32 +0200 > Amirouche Boubekki <amirouche@hypermove.net> 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 " 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 > "hello")</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 I've commented out (#\" . "quot") in alist->hash-table and it work. thanks for your help. -- Jakub Jankiewicz, Web Developer http://jcubic.pl ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-12 20:23 ` Jakub Jankiewicz @ 2016-07-13 9:57 ` tomas 2016-07-14 10:29 ` Andy Wingo 0 siblings, 1 reply; 15+ messages in thread From: tomas @ 2016-07-13 9:57 UTC (permalink / raw) To: Jakub Jankiewicz; +Cc: guile-user -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Jul 12, 2016 at 10:23:20PM +0200, Jakub Jankiewicz wrote: [...] > I've commented out (#\" . "quot") in alist->hash-table and it work. thanks > for your help. I wised up a bit, to get an idea on how it's supposed to work (if there's such a thing on the Internet ;-) and found out: - in XHTML, the content of the script tag is parsed character data (#PCDATA). This means that entities (" and so on) *will be parsed and substituted*. Not so for HTML: there it's raw character data (#CDATA), and no entity substitution is supposed to happen [1] So your approach goes in the right direction. When outputting HTML, no substitution is supposed to be done (no " and no < and so on). - But how you keep your thing from tripping over some nasty </script> deeply embedded in the javascript text, then? The very readable [2] suggests: don't do it, then. That means: munge the javascript until it doesn't contain that nastygram. E.g. var nasty="</script\>"; Whee. Looks kinda cool, somehow. (that means you can only automate this task if you manage to kinda half-parse the provided javascript thing, right? But perhaps one can prove that "</" isn't a valid sequence in javascript outside a string literal?). Hope you enjoyed that ;-) [1] http://www.w3schools.com/tags/tag_script.asp [2] http://jibbering.com/faq/faq_notes/script_tags.html - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAleGEJkACgkQBcgs9XrR2kZxlgCfR+ypMDs0oAeT/G5NbGnqw0Ib 2Y0An3Ll/SbA8QH7V88u965pXVj9Ovfu =2Ow0 -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-13 9:57 ` tomas @ 2016-07-14 10:29 ` Andy Wingo 2016-07-14 10:47 ` tomas 2016-07-14 13:21 ` Matt Wette 0 siblings, 2 replies; 15+ messages in thread From: Andy Wingo @ 2016-07-14 10:29 UTC (permalink / raw) To: tomas; +Cc: Jakub Jankiewicz, guile-user On Wed 13 Jul 2016 11:57, <tomas@tuxteam.de> writes: > - in XHTML, For better or for worse, I think we need to treat XHTML as a deprecated dead-end at this point. Browsers prefer HTML, authors prefer HTML, it's only some tooling people that prefer XHTML, and *actually valid* XHTML is a vanishingly small and diminishing part of the web. (I say this as someone who spent the last few years working on web browsers: Chromium and Firefox.) This article is a bit polemic but I think it captures the truth: http://diveintohtml5.info/past.html In Guile, we should optimize for HTML, not XHTML. Andy ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-14 10:29 ` Andy Wingo @ 2016-07-14 10:47 ` tomas 2016-07-14 13:21 ` Matt Wette 1 sibling, 0 replies; 15+ messages in thread From: tomas @ 2016-07-14 10:47 UTC (permalink / raw) To: Andy Wingo; +Cc: Jakub Jankiewicz, guile-user -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Jul 14, 2016 at 12:29:20PM +0200, Andy Wingo wrote: > On Wed 13 Jul 2016 11:57, <tomas@tuxteam.de> writes: > > > - in XHTML, > > For better or for worse, I think we need to treat XHTML as a deprecated > dead-end at this point [...] Violent agreement. Besides, XHTML *is* XML, and we have the tooling for that, anyway. > [...] (I say this as someone who spent the last few years working on > web browsers: Chromium and Firefox.) I know :-) > This article is a bit polemic but I think it captures the truth: > > http://diveintohtml5.info/past.html Thanks for this one! (now I wish I had an e-reader to take that for long evenings in the tent :-) > In Guile, we should optimize for HTML, not XHTML. Yes. If it says "HTML", it should do HTML. Otherwise it's XML, anyway. Thanks, regards - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAleHbboACgkQBcgs9XrR2kacpQCcDK3Zmb+VLNQy4f8KCA11pHec 3doAn2NGgzX0GVa+lK/fQzDIW28TLBSC =qVlP -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-14 10:29 ` Andy Wingo 2016-07-14 10:47 ` tomas @ 2016-07-14 13:21 ` Matt Wette 2016-07-14 20:45 ` tomas 2016-07-15 10:40 ` Amirouche Boubekki 1 sibling, 2 replies; 15+ messages in thread From: Matt Wette @ 2016-07-14 13:21 UTC (permalink / raw) To: guile-user > On Jul 14, 2016, at 3:29 AM, Andy Wingo <wingo@pobox.com> wrote: > > In Guile, we should optimize for HTML, not XHTML. > Being a glutton for foolish tasks, last year I started working on a HTML5->SXML parser, trying to avoid !. The approach is based on the definition in http://www.w3.org/TR/html5/syntax.html. The code is currently at about 1400 lines. I am not sure I will finish. Matt ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-14 13:21 ` Matt Wette @ 2016-07-14 20:45 ` tomas 2016-07-15 10:40 ` Amirouche Boubekki 1 sibling, 0 replies; 15+ messages in thread From: tomas @ 2016-07-14 20:45 UTC (permalink / raw) To: Matt Wette; +Cc: guile-user -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Jul 14, 2016 at 06:21:36AM -0700, Matt Wette wrote: > > > On Jul 14, 2016, at 3:29 AM, Andy Wingo <wingo@pobox.com> wrote: > > > > In Guile, we should optimize for HTML, not XHTML. > > > > Being a glutton for foolish tasks, last year I started working on a > HTML5->SXML parser, trying to avoid !. The approach is based on > the definition in http://www.w3.org/TR/html5/syntax.html. > The code is currently at about 1400 lines. I am not sure I will > finish. Eek. Somehow I guess it'd be easier to train a network on sample data off the 'net (not completely serious, but nearly so). regards - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAleH+eEACgkQBcgs9XrR2kZqiQCeOCIQBCs/7jkqr5eicAcpMun8 a/sAnjqiEDk1QL9g9V4IMypCJy3ITHXJ =71mw -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-14 13:21 ` Matt Wette 2016-07-14 20:45 ` tomas @ 2016-07-15 10:40 ` Amirouche Boubekki 2016-07-15 12:44 ` Matt Wette 1 sibling, 1 reply; 15+ messages in thread From: Amirouche Boubekki @ 2016-07-15 10:40 UTC (permalink / raw) To: Matt Wette; +Cc: guile-user, guile-user On 2016-07-14 15:21, Matt Wette wrote: >> On Jul 14, 2016, at 3:29 AM, Andy Wingo <wingo@pobox.com> wrote: >> >> In Guile, we should optimize for HTML, not XHTML. >> > > Being a glutton for foolish tasks, last year I started working on a > HTML5->SXML parser, trying to avoid !. The approach is based on the > definition in http://www.w3.org/TR/html5/syntax.html. The code is > currently at about 1400 lines. I am not sure I will finish. How this is different from guilelib html parser? [1] http://git.savannah.gnu.org/gitweb/?p=guile-lib.git;a=blob;f=src/htmlprag.scm;h=3bd352b11fc39203828f56cf79246291ad41a273;hb=HEAD ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-15 10:40 ` Amirouche Boubekki @ 2016-07-15 12:44 ` Matt Wette 0 siblings, 0 replies; 15+ messages in thread From: Matt Wette @ 2016-07-15 12:44 UTC (permalink / raw) To: guile-user > On Jul 15, 2016, at 3:40 AM, Amirouche Boubekki <amirouche@hypermove.net> wrote: > > On 2016-07-14 15:21, Matt Wette wrote: >>> On Jul 14, 2016, at 3:29 AM, Andy Wingo <wingo@pobox.com> wrote: >>> In Guile, we should optimize for HTML, not XHTML. >> Being a glutton for foolish tasks, last year I started working on a >> HTML5->SXML parser, trying to avoid !. The approach is based on the >> definition in http://www.w3.org/TR/html5/syntax.html. The code is >> currently at about 1400 lines. I am not sure I will finish. > > How this is different from guilelib html parser? > > [1] http://git.savannah.gnu.org/gitweb/?p=guile-lib.git;a=blob;f=src/htmlprag.scm;h=3bd352b11fc39203828f56cf79246291ad41a273;hb=HEAD > I did not find this in my search for HTML parsers. I only found some based on SXML that didn’t work. I will take a look. I am interested to see if it will parser SVG and MathML. Thanks for the link. Matt ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-10 19:58 How to render raw data using sxml? Jakub Jankiewicz 2016-07-11 6:48 ` tomas 2016-07-11 20:58 ` Amirouche Boubekki @ 2016-07-13 12:28 ` Matt Wette 2016-07-13 13:36 ` tomas 2016-07-14 10:23 ` Andy Wingo 2 siblings, 2 replies; 15+ messages in thread From: Matt Wette @ 2016-07-13 12:28 UTC (permalink / raw) To: Jakub Jankiewicz; +Cc: guile-user > On Jul 10, 2016, at 12:58 PM, Jakub Jankiewicz <jcubic@jcubic.pl> 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): > > (display "Content-Type: text/html") > (newline) > (newline) > (display "<!DOCTYPE html>") > (newline) > (sxml->xml `(html > (head > (title "BiwaScheme test") > (script (@ (src "biwascheme-min.js")) "(display \"hello\")")) > (body (p "BiwaScheme test")))) > > but the output was: > > <!DOCTYPE html> > <html><head><title>BiwaScheme test</title><script > src="biwascheme-min.js">(display > "hello")</script></head><body><p>BiwaScheme test</p></body></html> > > which is invalid scheme code. I've also try this: > > (script (@ (src "biwascheme-min.js")) "(display " #\" "hello" #\" ")") > > but got the same result. How can I display raw data using sxml->xml I googled “sxml CDATA” and found that Chicken Scheme has a “sxml-serialize” procedure that takes an optional keyword argument cdata-section-elements which is a list of elements which should have contents serialized to a CDATA section. It seems like if sxml->xml had something like that you might have a solution. Does <script><![CDATA[(display “hello”)]]></script> work on HTML? Matt ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-13 12:28 ` Matt Wette @ 2016-07-13 13:36 ` tomas 2016-07-14 10:23 ` Andy Wingo 1 sibling, 0 replies; 15+ messages in thread From: tomas @ 2016-07-13 13:36 UTC (permalink / raw) To: guile-user -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, Jul 13, 2016 at 05:28:02AM -0700, Matt Wette wrote: > > > On Jul 10, 2016, at 12:58 PM, Jakub Jankiewicz <jcubic@jcubic.pl> 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): > > > > (display "Content-Type: text/html") > > (newline) > > (newline) > > (display "<!DOCTYPE html>") > > (newline) > > (sxml->xml `(html > > (head > > (title "BiwaScheme test") > > (script (@ (src "biwascheme-min.js")) "(display \"hello\")")) > > (body (p "BiwaScheme test")))) > > > > but the output was: > > > > <!DOCTYPE html> > > <html><head><title>BiwaScheme test</title><script > > src="biwascheme-min.js">(display > > "hello")</script></head><body><p>BiwaScheme test</p></body></html> > > > > which is invalid scheme code. I've also try this: > > > > (script (@ (src "biwascheme-min.js")) "(display " #\" "hello" #\" ")") > > > > but got the same result. How can I display raw data using sxml->xml > > I googled “sxml CDATA” and found that Chicken Scheme has a > “sxml-serialize” procedure that takes an optional keyword > argument cdata-section-elements which is a list of elements > which should have contents serialized to a CDATA section. > It seems like if sxml->xml had something like that you might > have a solution. > Does <script><![CDATA[(display “hello”)]]></script> work on HTML? As far as I understand, this is the way to do it in XHTML. In HTML it's at least... uncommon (I don't know whether it's officially sanctioned, but I guess the browsers will cope, somehow, as they always do :-) Ah, no. It's even funnier, see [1], [2] TL;DR: HTML doesn't know about CDATA. But if you want your thingie to parse as HTML *and* to validate as XML, you can do this: <script type="text/javascript"> //<![CDATA[ document.write("<"); //]]> </script> Otherwise the javascript processor would get passed "<![CDATA[..." and would freak out). I am speechless. Someday, this rat's nest will become sentient, and it will be ugly. regards [1] http://stackoverflow.com/questions/66837/when-is-a-cdata-section-necessary-within-a-script-tag [2] http://stackoverflow.com/questions/7092236/what-is-cdata-in-html - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAleGQ9QACgkQBcgs9XrR2kag7wCfY2EqxFnQ6mFjyE5HIIhoz5M2 dq8AnRuB6WgNwMmcEJd0c+CaOPi4+fK8 =8777 -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: How to render raw data using sxml? 2016-07-13 12:28 ` Matt Wette 2016-07-13 13:36 ` tomas @ 2016-07-14 10:23 ` Andy Wingo 1 sibling, 0 replies; 15+ messages in thread From: Andy Wingo @ 2016-07-14 10:23 UTC (permalink / raw) To: Matt Wette; +Cc: Jakub Jankiewicz, guile-user On Wed 13 Jul 2016 14:28, Matt Wette <matt.wette@gmail.com> writes: > I googled “sxml CDATA” and found that Chicken Scheme has a > “sxml-serialize” procedure that takes an optional keyword argument > cdata-section-elements which is a list of elements which should have > contents serialized to a CDATA section. SGTM. Andy ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-07-15 12:44 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-10 19:58 How to render raw data using sxml? Jakub Jankiewicz 2016-07-11 6:48 ` tomas 2016-07-11 20:58 ` Amirouche Boubekki 2016-07-12 20:20 ` Jakub Jankiewicz 2016-07-12 20:23 ` Jakub Jankiewicz 2016-07-13 9:57 ` tomas 2016-07-14 10:29 ` Andy Wingo 2016-07-14 10:47 ` tomas 2016-07-14 13:21 ` Matt Wette 2016-07-14 20:45 ` tomas 2016-07-15 10:40 ` Amirouche Boubekki 2016-07-15 12:44 ` Matt Wette 2016-07-13 12:28 ` Matt Wette 2016-07-13 13:36 ` tomas 2016-07-14 10:23 ` Andy Wingo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).