guile-user
[Top][All Lists]
Advanced

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

Re: avoid character encoding/escaping in sxml->xml or htmlprag's sxml->h


From: Maxime Devos
Subject: Re: avoid character encoding/escaping in sxml->xml or htmlprag's sxml->html
Date: Sat, 20 Aug 2022 23:48:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

The GuileScript looks nice, for interested readers, see <https://github.com/aconchillo/guilescript>

On 20-08-2022 21:59, Aleix Conchillo Flaqué wrote:
However, I'm not able to find a way to avoid character encoding/escaping and the generated code inside <script> will always have "&lt;", etc. And <script> is a place where encodings can be avoided. This is true for both Guile and guile-lib's (htmlprag), even though htmlprag's escapes less characters (e.g. double quotes).

One way I found to solve this was to have <script src="fib.js"> and then have a handler for fib.js that would just return the transpiled string. But it's not as nice, it's extra work and it's also an additional roundtrip to the server.

Has anyone ran into this issue? Would is make sense to add a keyword argument to (sxml->xml)? For example, (sxml->xml SXML PORT #:escape #f).

Having unescaped < in <script>...</script> does not seem valid XML to me.

Does escaping &lt; actually cause problems?  If so, you could look into declaring your web page as XHTML, with an appropriate doctype and Content-Type.

I would expect XHTML to accept &lt; and reject unescaped <, being XML and not the messy syntax of HTML, but it's not something I have tried out myself.

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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