emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 45ebbc0: Allow overriding shr functions from eww


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 45ebbc0: Allow overriding shr functions from eww
Date: Thu, 24 Dec 2015 16:34:41 +0000

branch: master
commit 45ebbc0301c8514a5f3215f45981c787cb26f915
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Allow overriding shr functions from eww
    
    * eww.el (eww-display-html): Allow overriding elements in
    `shr-external-rendering-functions'.
---
 lisp/net/eww.el |   16 +++++++++-------
 lisp/net/shr.el |    9 ++++++++-
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 5748e88..2224b2e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -411,13 +411,15 @@ Currently this means either text/html or 
application/xhtml+xml."
            (inhibit-modification-hooks t)
            (shr-target-id (url-target (url-generic-parse-url url)))
            (shr-external-rendering-functions
-            '((title . eww-tag-title)
-              (form . eww-tag-form)
-              (input . eww-tag-input)
-              (textarea . eww-tag-textarea)
-              (select . eww-tag-select)
-              (link . eww-tag-link)
-              (a . eww-tag-a))))
+             (append
+              shr-external-rendering-functions
+              '((title . eww-tag-title)
+                (form . eww-tag-form)
+                (input . eww-tag-input)
+                (textarea . eww-tag-textarea)
+                (select . eww-tag-select)
+                (link . eww-tag-link)
+                (a . eww-tag-a)))))
        (erase-buffer)
        (shr-insert-document document)
        (cond
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index d51b8c7..2389952 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -135,6 +135,14 @@ cid: URL as the argument.")
 (defvar shr-inhibit-images nil
   "If non-nil, inhibit loading images.")
 
+(defvar shr-external-rendering-functions nil
+  "Alist of tag/function pairs used to alter how shr renders certain tags.
+For instance, eww uses this to alter rendering of title, forms
+and other things:
+((title . eww-tag-title)
+ (form . eww-tag-form)
+ ...)")
+
 ;;; Internal variables.
 
 (defvar shr-folding-mode nil)
@@ -150,7 +158,6 @@ cid: URL as the argument.")
 (defvar shr-depth 0)
 (defvar shr-warning nil)
 (defvar shr-ignore-cache nil)
-(defvar shr-external-rendering-functions nil)
 (defvar shr-target-id nil)
 (defvar shr-table-separator-length 1)
 (defvar shr-table-separator-pixel-width 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]