all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Manuel Giraud via "Emacs development discussions." <emacs-devel@gnu.org>
To: Sacha Chua <sacha@sachachua.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] shr.el: correct SVG attribute case
Date: Sat, 27 Jan 2024 18:18:06 +0100	[thread overview]
Message-ID: <87y1cawv8x.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <878r4cxjt8.fsf@sachachua.com> (Sacha Chua's message of "Fri, 26 Jan 2024 09:15:15 -0500")

Sacha Chua <sacha@sachachua.com> writes:

> I've attached a patch for restoring the correct case of SVG attributes
> parsed with libxml-parse-html-region when displayed with shr, so that
> SVGs can be displayed properly. HTML attributes are case-insensitive and
> converted to lowercase, but SVG attributes are case-sensitive, so things
> like viewBox don't work if they're lowercased. It looks like other
> implementations (ex: https://github.com/w3c/svgwg/issues/161 ) also use
> the workaround of fixing attribute cases for SVGs, so I took the list
> from
> https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
> and fixed those attributes.
>
> Here's a small test to demonstrate the issue:
>
> ;; The following should display a full circle, not a quarter circle
> (with-current-buffer (get-buffer-create "*test*")
> 	(erase-buffer)
> 	(insert "<svg width=\"100px\" height=\"100px\" viewBox=\"0 0 200 200\"><circle cx=\"100\" cy=\"100\" r=\"100\"/></svg>\n")
> 	(shr-insert-document (libxml-parse-html-region (point-min) (point-max)))
> 	(display-buffer (current-buffer)))

Hi,

FWIW, it seems that 'libxml-parse-xml-region' seems to do the right
thing.
-- 
Manuel Giraud



  reply	other threads:[~2024-01-27 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 14:15 [PATCH] shr.el: correct SVG attribute case Sacha Chua
2024-01-27 17:18 ` Manuel Giraud via Emacs development discussions. [this message]
2024-01-27 17:29   ` Sacha Chua
2024-01-29 21:20     ` Manuel Giraud via Emacs development discussions.
2024-02-01 10:02 ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=87y1cawv8x.fsf@ledu-giraud.fr \
    --to=emacs-devel@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    --cc=sacha@sachachua.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.