aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2015-12-27 07:18:29 +0100
committerLars Ingebrigtsen2015-12-27 07:18:29 +0100
commit531b28b4d96adf39d853fcb5e0bba7251fcce4b6 (patch)
treeba19a4c40384903a2e38eb0f009c873c07c209a2
parentde8837599112608feecea65a1e520866bc171569 (diff)
downloademacs-531b28b4d96adf39d853fcb5e0bba7251fcce4b6.tar.gz
emacs-531b28b4d96adf39d853fcb5e0bba7251fcce4b6.zip
* shr.el (shr-descend): Allow using lambdas in external functions.
-rw-r--r--lisp/net/shr.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 3d5f02c359b..469ef4ec52f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -429,11 +429,10 @@ size, and full-buffer size."
429 429
430(defun shr-descend (dom) 430(defun shr-descend (dom)
431 (let ((function 431 (let ((function
432 (or 432 (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray))
433 ;; Allow other packages to override (or provide) rendering 433 ;; Allow other packages to override (or provide) rendering
434 ;; of elements. 434 ;; of elements.
435 (cdr (assq (dom-tag dom) shr-external-rendering-functions)) 435 (external (cdr (assq (dom-tag dom) shr-external-rendering-functions)))
436 (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray)))
437 (style (dom-attr dom 'style)) 436 (style (dom-attr dom 'style))
438 (shr-stylesheet shr-stylesheet) 437 (shr-stylesheet shr-stylesheet)
439 (shr-depth (1+ shr-depth)) 438 (shr-depth (1+ shr-depth))
@@ -448,9 +447,12 @@ size, and full-buffer size."
448 (setq style nil))) 447 (setq style nil)))
449 ;; If we have a display:none, then just ignore this part of the DOM. 448 ;; If we have a display:none, then just ignore this part of the DOM.
450 (unless (equal (cdr (assq 'display shr-stylesheet)) "none") 449 (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
451 (if (fboundp function) 450 (cond (external
452 (funcall function dom) 451 (funcall external dom))
453 (shr-generic dom)) 452 ((fboundp function)
453 (funcall function dom))
454 (t
455 (shr-generic dom)))
454 (when (and shr-target-id 456 (when (and shr-target-id
455 (equal (dom-attr dom 'id) shr-target-id)) 457 (equal (dom-attr dom 'id) shr-target-id))
456 ;; If the element was empty, we don't have anything to put the 458 ;; If the element was empty, we don't have anything to put the