unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guile-user <guile-user@gnu.org>, guile-devel <guile-devel@gnu.org>
Subject: Re: avoid character encoding/escaping in sxml->xml or htmlprag's sxml->html
Date: Sun, 21 Aug 2022 15:34:54 -0700	[thread overview]
Message-ID: <CA+XASoUY3cAg7tU1Q0Hvnqvg7CJ93VZYSFw8dVgVE9buSGsRVw@mail.gmail.com> (raw)
In-Reply-To: <f604d73d-0ed1-68f9-d86b-9bf2d038b3e1@telenet.be>

[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]

Thank you Maxime,

On Sun, Aug 21, 2022 at 3:16 AM Maxime Devos <maximedevos@telenet.be> wrote:

> On 21-08-2022 02:05, Aleix Conchillo Flaqué wrote:
>
> According to the spec, embedding inline content in the <script> tag should
> conform to the language defined by the "type" attribute (defaults to
> javascript). So, I would expect you could put any string that conforms to
> JS.
>
> """
> When used to include dynamic scripts, the scripts may either be embedded
> inline or may be imported from an external file using the src attribute. If
> the language is not that described by "text/javascript", then the type
> attribute must be present, as described below. Whatever language is used,
> the contents of the script element must conform with the requirements of
> that language's specification
>
> I am proposing to use XHTML (which is XML), not HTML. HTML's special
> parsing quirks are irrelevant here.
>
> It does, browsers (at least Chrome) don't interpret that correctly, since
> it's not valid JavaScript.
>
> As <script> ... </script> is XML, the XML parser  (not the HTML parser,
> this is XHTML!) will decode the &lt; inside the <script>...</script>, the
> result _after decoding_ is valid JavaScript.  In XML, <script> is not
> special -- everything is parsed the same way in XML.
>
>
Got it! I didn't know that was treated differently. I just tried it and it
works perfectly and it's exactly what I wanted:

https://github.com/aconchillo/guilescript/commit/c959ceff15e8e9fdf81cc59a754ed66e6bb53cc0

I avoided the <?xml?> declaration. I know that's mandatory in XML
documents, but it seemed to work without it.

Thanks again!

Aleix

[-- Attachment #2: Type: text/html, Size: 3473 bytes --]

      parent reply	other threads:[~2022-08-21 22:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 19:59 avoid character encoding/escaping in sxml->xml or htmlprag's sxml->html Aleix Conchillo Flaqué
2022-08-20 21:48 ` Maxime Devos
2022-08-21  0:05   ` Aleix Conchillo Flaqué
2022-08-21  5:09     ` tomas
2022-08-21 10:16     ` Maxime Devos
2022-08-21 10:23       ` tomas
2022-08-21 22:34       ` Aleix Conchillo Flaqué [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+XASoUY3cAg7tU1Q0Hvnqvg7CJ93VZYSFw8dVgVE9buSGsRVw@mail.gmail.com \
    --to=aconchillo@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).