diff options
| author | Lars Ingebrigtsen | 2015-12-24 17:34:31 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2015-12-24 17:34:31 +0100 |
| commit | 45ebbc0301c8514a5f3215f45981c787cb26f915 (patch) | |
| tree | 0b564a888a417cfd81abb014796bc4dcfb344cf2 | |
| parent | 821107d53c2e390240d25c036b99ebbf9b4a93b6 (diff) | |
| download | emacs-45ebbc0301c8514a5f3215f45981c787cb26f915.tar.gz emacs-45ebbc0301c8514a5f3215f45981c787cb26f915.zip | |
Allow overriding shr functions from eww
* eww.el (eww-display-html): Allow overriding elements in
`shr-external-rendering-functions'.
| -rw-r--r-- | lisp/net/eww.el | 16 | ||||
| -rw-r--r-- | 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 5748e88bbca..2224b2e74e7 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." | |||
| 411 | (inhibit-modification-hooks t) | 411 | (inhibit-modification-hooks t) |
| 412 | (shr-target-id (url-target (url-generic-parse-url url))) | 412 | (shr-target-id (url-target (url-generic-parse-url url))) |
| 413 | (shr-external-rendering-functions | 413 | (shr-external-rendering-functions |
| 414 | '((title . eww-tag-title) | 414 | (append |
| 415 | (form . eww-tag-form) | 415 | shr-external-rendering-functions |
| 416 | (input . eww-tag-input) | 416 | '((title . eww-tag-title) |
| 417 | (textarea . eww-tag-textarea) | 417 | (form . eww-tag-form) |
| 418 | (select . eww-tag-select) | 418 | (input . eww-tag-input) |
| 419 | (link . eww-tag-link) | 419 | (textarea . eww-tag-textarea) |
| 420 | (a . eww-tag-a)))) | 420 | (select . eww-tag-select) |
| 421 | (link . eww-tag-link) | ||
| 422 | (a . eww-tag-a))))) | ||
| 421 | (erase-buffer) | 423 | (erase-buffer) |
| 422 | (shr-insert-document document) | 424 | (shr-insert-document document) |
| 423 | (cond | 425 | (cond |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index d51b8c73d10..23899521140 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -135,6 +135,14 @@ cid: URL as the argument.") | |||
| 135 | (defvar shr-inhibit-images nil | 135 | (defvar shr-inhibit-images nil |
| 136 | "If non-nil, inhibit loading images.") | 136 | "If non-nil, inhibit loading images.") |
| 137 | 137 | ||
| 138 | (defvar shr-external-rendering-functions nil | ||
| 139 | "Alist of tag/function pairs used to alter how shr renders certain tags. | ||
| 140 | For instance, eww uses this to alter rendering of title, forms | ||
| 141 | and other things: | ||
| 142 | ((title . eww-tag-title) | ||
| 143 | (form . eww-tag-form) | ||
| 144 | ...)") | ||
| 145 | |||
| 138 | ;;; Internal variables. | 146 | ;;; Internal variables. |
| 139 | 147 | ||
| 140 | (defvar shr-folding-mode nil) | 148 | (defvar shr-folding-mode nil) |
| @@ -150,7 +158,6 @@ cid: URL as the argument.") | |||
| 150 | (defvar shr-depth 0) | 158 | (defvar shr-depth 0) |
| 151 | (defvar shr-warning nil) | 159 | (defvar shr-warning nil) |
| 152 | (defvar shr-ignore-cache nil) | 160 | (defvar shr-ignore-cache nil) |
| 153 | (defvar shr-external-rendering-functions nil) | ||
| 154 | (defvar shr-target-id nil) | 161 | (defvar shr-target-id nil) |
| 155 | (defvar shr-table-separator-length 1) | 162 | (defvar shr-table-separator-length 1) |
| 156 | (defvar shr-table-separator-pixel-width 0) | 163 | (defvar shr-table-separator-pixel-width 0) |