]> git.eshelyaron.com Git - emacs.git/commitdiff
Make titles in eww prettier
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 3 Nov 2014 00:35:44 +0000 (01:35 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 3 Nov 2014 00:35:44 +0000 (01:35 +0100)
(eww-tag-title): Remove newlines and extra whitespace from the
displayed title.

lisp/ChangeLog
lisp/net/eww.el

index 2288bba4c5e47fdf67cd7d89db98779c6b021de0..b4f3f109855327adddce97d0ec7e8a4eba0f98d7 100644 (file)
@@ -7,6 +7,8 @@
        go back to the non-readable version.
        (eww-display-html): Don't try to decode the text if we've been
        passed in a pre-parsed DOM.
+       (eww-tag-title): Remove newlines and extra whitespace from the
+       displayed title.
 
 2014-11-02  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
index 954810ad0c974ff956f839a21ce97c941d598f03..2e4a7d76d8da30f506978d92170fd57dee08898e 100644 (file)
@@ -350,6 +350,10 @@ word(s) will be searched for via `eww-search-prefix'."
   (dolist (sub cont)
     (when (eq (car sub) 'text)
       (setq eww-current-title (concat eww-current-title (cdr sub)))))
+  (setq eww-current-title
+       (replace-regexp-in-string
+        "^ \\| $" ""
+        (replace-regexp-in-string "[ \t\r\n]+" " " eww-current-title)))
   (eww-update-header-line-format))
 
 (defun eww-tag-body (cont)