]> code.delx.au - gnu-emacs/commitdiff
Fix display of <pre> elements
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2016 06:38:58 +0000 (17:38 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2016 06:39:21 +0000 (17:39 +1100)
* lisp/net/eww.el (eww-display-html): Remove CRLF before
parsing so that <pre> elements don't render with ^M at the end
of the lines.

lisp/net/eww.el

index da920c14aecdc42fa31a6b32b029badd27c420cb..551517b9d6444fe2383000604b58e462828893b9 100644 (file)
@@ -402,6 +402,10 @@ Currently this means either text/html or application/xhtml+xml."
                (condition-case nil
                    (decode-coding-region (point) (point-max) encode)
                  (coding-system-error nil))
+                (save-excursion
+                  ;; Remove CRLF before parsing.
+                  (while (re-search-forward "\r$" nil t)
+                    (replace-match "" t t)))
                (libxml-parse-html-region (point) (point-max))))))
        (source (and (null document)
                     (buffer-substring (point) (point-max)))))