From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] shr.el: correct SVG attribute case Date: Sat, 27 Jan 2024 18:18:06 +0100 Message-ID: <87y1cawv8x.fsf@ledu-giraud.fr> References: <878r4cxjt8.fsf@sachachua.com> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37844"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Sacha Chua Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 27 18:18:43 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rTmKJ-0009dk-1T for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Jan 2024 18:18:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTmJs-0007vu-7x; Sat, 27 Jan 2024 12:18:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTmJn-0007uB-UE for emacs-devel@gnu.org; Sat, 27 Jan 2024 12:18:12 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTmJl-0003qD-N2 for emacs-devel@gnu.org; Sat, 27 Jan 2024 12:18:11 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=4q6I0gAF g3VApF265ObAeJn9Yrm58aB9fJ+2+rRCS/c=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=mL8gyl1ZMdL6IqdGAwSODo+wkGjkvv /lbFOwP469MawtSZiMxU3FUgBSSvhKXh9f0NIRHtU5LRskqlKYYZ6xDw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=4q6I0gAFg3VApF26 5ObAeJn9Yrm58aB9fJ+2+rRCS/c=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=MVFynddnsmf/qD4XH53Yktb/eJ54AaEtEK52J2 5ldWm6C73i+QSkF/eH1lT81vuVUnq5CnpeW/TDNUXTDLiVMrxPHdskVX7r7TBHTICojWvu eYjjq6s/SjgmVp+Rwra5VXHTWQUaieGa/CJoycvPYtdulU1USAy99rUgzRGHnRBeU3DoFY 4FtuGRSJ9f8Fy7WpnS8o60wzNVqS90KsLuf/8ZQ0cXfn1Nm0hwmCXz3Bk3Gzz3FJKCKzaJ FgskFFWZpQJb7MHl3ADRl3jGaTIniOKXqKHNwp0KW5zhxFmfAew55aFsOLuLerr+/NG/Dd Oya/sW7Sfl+z46wU5+hQdPRg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e51f006f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 27 Jan 2024 18:18:07 +0100 (CET) In-Reply-To: <878r4cxjt8.fsf@sachachua.com> (Sacha Chua's message of "Fri, 26 Jan 2024 09:15:15 -0500") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315494 Archived-At: Sacha Chua 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 "\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