Subject: shr: Add support for "data-src" attribute in <img> nodes

From: 杨英超 <[email-masked]>
Date: Sat, 3 Jul 2021 08:56:00 +0800

Dear maintainers:

I found eww fails to show card-images which is described in the following
web page:

https://www.geeksforgeeks.org/why-card-images-use-data-src-not-src-for-image-in-bootstrap-4/

For example, if you open following page with eww & firefox, you will notice
the differences:   http://www.interdb.jp/pg/pgsql05.html

I modified shr.el a little bit to support "data-src" attribute, so eww can
display card-images properly.

 Hope it helps.

Regards
yc
From bb7537f18af348e27169fdb4675279a6ac936f91 Mon Sep 17 00:00:00 2001
From: yangyingchao <[email-masked]>
Date: Fri, 2 Jul 2021 11:46:12 +0800
Subject: [PATCH] Add support for "data-src" attribute in <img> tag.

* lisp/net/shr.el (shr--preferred-image) (shr-tag-img): support
  "data-src"  attribute
---
 lisp/net/shr.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 873f0457e3..cc2007b2a4 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1661,7 +1661,8 @@ shr-tag-img
   (when (or url
 	    (and dom
 		 (or (> (length (dom-attr dom 'src)) 0)
-                     (> (length (dom-attr dom 'srcset)) 0))))
+                     (> (length (dom-attr dom 'srcset)) 0)
+                     (> (length (dom-attr dom 'data-src)) 0))))
     (when (> (current-column) 0)
       (insert "\n"))
     (let ((alt (dom-attr dom 'alt))
@@ -1793,7 +1794,7 @@ shr--preferred-image
                   (> (cadr (car srcset)) frame-width))
         (setq candidate (caar srcset))
         (pop srcset)))
-    (or candidate (dom-attr dom 'src))))
+    (or candidate (dom-attr dom 'src) (dom-attr dom 'data-src))))
 
 (defun shr-string-number (string)
   (if (null string)
-- 
2.31.1