aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Shmakov2015-03-05 23:26:34 +0100
committerLars Magne Ingebrigtsen2015-03-05 23:26:34 +0100
commitb08f8bb06a012b46cb932762b002a48c6efe5396 (patch)
treed320745acd03339097e4f7da67b7a038012b0b4c
parentcbc9d8d4269f2cca7950060b5e37747b27dac1de (diff)
downloademacs-b08f8bb06a012b46cb932762b002a48c6efe5396.tar.gz
emacs-b08f8bb06a012b46cb932762b002a48c6efe5396.zip
Render application/xhtml+xml as HTML
Fixes: debbugs:20009 * lisp/net/eww.el (eww-html-p): New function. (eww-render): Use it.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/eww.el11
2 files changed, 13 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ef010d46093..0f905e65711 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12015-03-05 Ivan Shmakov <ivan@siamics.net>
2
3 * net/eww.el (eww-html-p): New function (bug#20009).
4 (eww-render): Use it.
5
12015-03-05 Artur Malabarba <bruce.connor.am@gmail.com> 62015-03-05 Artur Malabarba <bruce.connor.am@gmail.com>
2 7
3 * desktop.el (desktop-buffer-info): Write docstring. 8 * desktop.el (desktop-buffer-info): Write docstring.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 577cd41e30a..a128ffb9d06 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -306,6 +306,12 @@ See the `eww-search-prefix' variable for the search engine used."
306 (interactive "r") 306 (interactive "r")
307 (eww (buffer-substring beg end))) 307 (eww (buffer-substring beg end)))
308 308
309(defun eww-html-p (content-type)
310 "Return non-nil if CONTENT-TYPE designates an HTML content type.
311Currently this means either text/html or application/xhtml+xml."
312 (member content-type '("text/html"
313 "application/xhtml+xml")))
314
309(defun eww-render (status url &optional point buffer encode) 315(defun eww-render (status url &optional point buffer encode)
310 (let ((redirect (plist-get status :redirect))) 316 (let ((redirect (plist-get status :redirect)))
311 (when redirect 317 (when redirect
@@ -318,8 +324,7 @@ See the `eww-search-prefix' variable for the search engine used."
318 (charset (intern 324 (charset (intern
319 (downcase 325 (downcase
320 (or (cdr (assq 'charset (cdr content-type))) 326 (or (cdr (assq 'charset (cdr content-type)))
321 (eww-detect-charset (equal (car content-type) 327 (eww-detect-charset (eww-html-p (car content-type)))
322 "text/html"))
323 "utf-8")))) 328 "utf-8"))))
324 (data-buffer (current-buffer))) 329 (data-buffer (current-buffer)))
325 ;; Save the https peer status. 330 ;; Save the https peer status.
@@ -332,7 +337,7 @@ See the `eww-search-prefix' variable for the search engine used."
332 (string-match-p eww-use-external-browser-for-content-type 337 (string-match-p eww-use-external-browser-for-content-type
333 (car content-type))) 338 (car content-type)))
334 (eww-browse-with-external-browser url)) 339 (eww-browse-with-external-browser url))
335 ((equal (car content-type) "text/html") 340 ((eww-html-p (car content-type))
336 (eww-display-html charset url nil point buffer encode)) 341 (eww-display-html charset url nil point buffer encode))
337 ((equal (car content-type) "application/pdf") 342 ((equal (car content-type) "application/pdf")
338 (eww-display-pdf)) 343 (eww-display-pdf))