all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 24893@debbugs.gnu.org
Subject: bug#24893: 26.0.50; shr doesn't parse srcset <img> correctly
Date: Tue, 08 Nov 2016 14:55:49 +0900	[thread overview]
Message-ID: <b4m1symo6qi.fsf@jpl.org> (raw)
In-Reply-To: <m3lgwv7de0.fsf@gnus.org>

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

On Mon, 07 Nov 2016 12:11:51 +0100, Lars Ingebrigtsen wrote:
> (shr--preferred-image
[...]
> => "
> "
> I'm guessing it's the newlines or something that's the problem.  Or the
> protocol-less URLs?  I haven't examined.

Though this is no more than a workaround:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 954 bytes --]

--- shr.el~	2016-11-04 10:32:58.932040100 +0000
+++ shr.el	2016-11-08 05:54:35.912122700 +0000
@@ -1529,7 +1529,7 @@
       (setq srcset
             (sort (mapcar
                    (lambda (elem)
-                     (let ((spec (split-string elem " ")))
+                     (let ((spec (split-string elem "[\t\n ]+")))
                        (cond
                         ((= (length spec) 1)
                          ;; Make sure it's well formed.
@@ -1543,7 +1543,9 @@
                         (t
                          (list (car spec)
                                (string-to-number (cadr spec)))))))
-                   (split-string srcset ", "))
+                   (split-string (replace-regexp-in-string
+				  "\\`[\t\n ]+\\|[\t\n ]+\\'" "" srcset)
+				 "[\t\n ]*,[\t\n ]*"))
                   (lambda (e1 e2)
                     (> (cadr e1) (cadr e2)))))
       ;; Choose the smallest picture that's bigger than the current

  reply	other threads:[~2016-11-08  5:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 11:11 bug#24893: 26.0.50; shr doesn't parse srcset <img> correctly Lars Ingebrigtsen
2016-11-08  5:55 ` Katsumi Yamaoka [this message]
2016-11-08  8:39   ` Andreas Schwab
2016-11-09  1:16     ` Katsumi Yamaoka
2016-11-09  9:55       ` Andreas Schwab
2016-11-10 18:09   ` Lars Ingebrigtsen
2016-11-11  0:28     ` Katsumi Yamaoka

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=b4m1symo6qi.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=24893@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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.