(shr-find-fill-point): Don't leave blanks at the start of some lines.
[gnus] / lisp / shr.el
index d16899c..cdb6ea6 100644 (file)
@@ -241,8 +241,8 @@ redirects somewhere else."
                  (insert "\n"))
          (put-text-property (1- (point)) (point) 'shr-break t)
          ;; No space is needed at the beginning of a line.
-         (if (eq (following-char) ? )
-             (delete-char 1)))
+         (when (eq (following-char) ? )
+           (delete-char 1)))
        (when (> shr-indentation 0)
          (shr-indent))
        (end-of-line))
@@ -280,6 +280,8 @@ redirects somewhere else."
              (while (and (> count 0)
                          (aref (char-category-set (following-char)) ?>))
                (forward-char 1)))
+           (when (eq (following-char) ? )
+             (forward-char 1))
            t)))))
 
 (defun shr-ensure-newline ()
@@ -410,6 +412,29 @@ Return a string with image data."
 (defun shr-tag-s (cont)
   (shr-fontize-cont cont 'strike-through))
 
+(defun shr-tag-span (cont)
+  (let ((start (point))
+       (color (cdr (assq 'color (shr-parse-style (cdr (assq :style cont)))))))
+    (shr-generic cont)
+    (when color
+      (let ((overlay (make-overlay start (point))))
+       (overlay-put overlay 'face (cons 'foreground-color color))))))
+
+(defun shr-parse-style (style)
+  (when style
+    (let ((plist nil))
+      (dolist (elem (split-string style ";"))
+       (when elem
+         (setq elem (split-string elem ":"))
+         (when (and (car elem)
+                    (cadr elem))
+           (let ((name (replace-regexp-in-string "^ +\\| +$" "" (car elem)))
+                 (value (replace-regexp-in-string "^ +\\| +$" "" (cadr elem))))
+             (push (cons (intern name obarray)
+                         value)
+                   plist)))))
+      plist)))
+
 (defun shr-tag-a (cont)
   (let ((url (cdr (assq :href cont)))
        (start (point))