(shr-tag-br): Allow <br> to end lines or to make a single blank line.
(shr-ensure-paragraph): Consider lines with white space to be blank.
* shr.el (shr-insert): Treat non-breaking space just like normal
space. This seems to produce more pleasing results.
(shr-insert): Only insert a blank line if we're starting from an image.
+ (shr-tag-br): Allow <br> to end lines or to make a single blank line.
+ (shr-ensure-paragraph): Consider lines with white space to be blank.
2012-03-15 Elias Pipping <pipping@lavabit.com>
(if (save-excursion
(beginning-of-line)
(looking-at " *$"))
- (insert "\n")
+ (delete-region (match-beginning 0) (match-end 0))
(insert "\n\n")))))
(defun shr-indent ()
(shr-generic cont)))
(defun shr-tag-br (cont)
- (unless (bobp)
+ (when (and (not (bobp))
+ ;; Only add a newline if we break the current line, or
+ ;; the previous line isn't a blank line.
+ (or (not (bolp))
+ (and (> (- (point) 2) (point-min))
+ (not (= (char-after (- (point) 2)) ?\n)))))
(insert "\n")
(shr-indent))
(shr-generic cont))