diff options
| -rw-r--r-- | lisp/net/shr.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 0a7ea14b252..eae50a71438 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -805,8 +805,13 @@ size, and full-buffer size." | |||
| 805 | (url-expand-file-name url (concat (car base) (cadr base)))))) | 805 | (url-expand-file-name url (concat (car base) (cadr base)))))) |
| 806 | 806 | ||
| 807 | (defun shr-ensure-newline () | 807 | (defun shr-ensure-newline () |
| 808 | (unless (zerop (current-column)) | 808 | (unless (bobp) |
| 809 | (insert "\n"))) | 809 | (let ((prefix (get-text-property (line-beginning-position) |
| 810 | 'shr-prefix-length))) | ||
| 811 | (unless (or (zerop (current-column)) | ||
| 812 | (and prefix | ||
| 813 | (= prefix (- (point) (line-beginning-position))))) | ||
| 814 | (insert "\n"))))) | ||
| 810 | 815 | ||
| 811 | (defun shr-ensure-paragraph () | 816 | (defun shr-ensure-paragraph () |
| 812 | (unless (bobp) | 817 | (unless (bobp) |
| @@ -834,6 +839,10 @@ size, and full-buffer size." | |||
| 834 | (line-end-position)) | 839 | (line-end-position)) |
| 835 | (line-end-position))))) | 840 | (line-end-position))))) |
| 836 | (delete-region (match-beginning 0) (match-end 0))) | 841 | (delete-region (match-beginning 0) (match-end 0))) |
| 842 | ;; We have a single blank line. | ||
| 843 | ((and (eolp) (bolp)) | ||
| 844 | (insert "\n")) | ||
| 845 | ;; Insert new paragraph. | ||
| 837 | (t | 846 | (t |
| 838 | (insert "\n\n")))))) | 847 | (insert "\n\n")))))) |
| 839 | 848 | ||
| @@ -1247,7 +1256,7 @@ ones, in case fg and bg are nil." | |||
| 1247 | (shr-ensure-paragraph)) | 1256 | (shr-ensure-paragraph)) |
| 1248 | 1257 | ||
| 1249 | (defun shr-tag-div (dom) | 1258 | (defun shr-tag-div (dom) |
| 1250 | (shr-ensure-paragraph) | 1259 | (shr-ensure-newline) |
| 1251 | (shr-generic dom) | 1260 | (shr-generic dom) |
| 1252 | (shr-ensure-newline)) | 1261 | (shr-ensure-newline)) |
| 1253 | 1262 | ||