* eww.el (eww-tag-select): Don't render totally empty <select> forms.
[gnus] / lisp / shr.el
index b5dddae..2d0c910 100644 (file)
@@ -350,7 +350,7 @@ size, and full-buffer size."
        (shr-stylesheet shr-stylesheet)
        (start (point)))
     (when style
-      (if (string-match "color\\|display" style)
+      (if (string-match "color\\|display\\|border-collapse" style)
          (setq shr-stylesheet (nconc (shr-parse-style style)
                                      shr-stylesheet))
        (setq style nil)))
@@ -596,7 +596,14 @@ size, and full-buffer size."
          (insert "\n"))
       (if (save-excursion
            (beginning-of-line)
-           (looking-at " *$"))
+           ;; If the current line is totally blank, and doesn't even
+           ;; have any face properties set, then delete the blank
+           ;; space.
+           (and (looking-at " *$")
+                (not (get-text-property (point) 'face))
+                (not (= (next-single-property-change (point) 'face nil
+                                                     (line-end-position))
+                        (line-end-position)))))
          (delete-region (match-beginning 0) (match-end 0))
        (insert "\n\n")))))
 
@@ -1016,7 +1023,9 @@ ones, in case fg and bg are nil."
       plist)))
 
 (defun shr-tag-base (cont)
-  (setq shr-base (shr-parse-base (cdr (assq :href cont))))
+  (let ((base (cdr (assq :href cont))))
+    (when base
+      (setq shr-base (shr-parse-base base))))
   (shr-generic cont))
 
 (defun shr-tag-a (cont)
@@ -1163,7 +1172,7 @@ ones, in case fg and bg are nil."
   (shr-generic cont))
 
 (defun shr-tag-span (cont)
-  (shr-generic cont)))
+  (shr-generic cont))
 
 (defun shr-tag-h1 (cont)
   (shr-heading cont 'bold 'underline))
@@ -1317,35 +1326,40 @@ ones, in case fg and bg are nil."
     (nreverse result)))
 
 (defun shr-insert-table (table widths)
-  (shr-insert-table-ruler widths)
-  (dolist (row table)
-    (let ((start (point))
-         (height (let ((max 0))
-                   (dolist (column row)
-                     (setq max (max max (cadr column))))
-                   max)))
-      (dotimes (i height)
-       (shr-indent)
-       (insert shr-table-vertical-line "\n"))
-      (dolist (column row)
-       (goto-char start)
-       (let ((lines (nth 2 column)))
-         (dolist (line lines)
-           (end-of-line)
-           (insert line shr-table-vertical-line)
-           (forward-line 1))
-         ;; Add blank lines at padding at the bottom of the TD,
-         ;; possibly.
-         (dotimes (i (- height (length lines)))
-           (end-of-line)
-           (let ((start (point)))
-             (insert (make-string (string-width (car lines)) ? )
-                     shr-table-vertical-line)
-             (when (nth 4 column)
-               (shr-add-font start (1- (point))
-                             (list :background (nth 4 column)))))
-           (forward-line 1)))))
-    (shr-insert-table-ruler widths)))
+  (let* ((collapse (equal (cdr (assq 'border-collapse shr-stylesheet))
+                         "collapse"))
+        (shr-table-vertical-line (if collapse "" shr-table-vertical-line)))
+    (unless collapse
+      (shr-insert-table-ruler widths))
+    (dolist (row table)
+      (let ((start (point))
+           (height (let ((max 0))
+                     (dolist (column row)
+                       (setq max (max max (cadr column))))
+                     max)))
+       (dotimes (i height)
+         (shr-indent)
+         (insert shr-table-vertical-line "\n"))
+       (dolist (column row)
+         (goto-char start)
+         (let ((lines (nth 2 column)))
+           (dolist (line lines)
+             (end-of-line)
+             (insert line shr-table-vertical-line)
+             (forward-line 1))
+           ;; Add blank lines at padding at the bottom of the TD,
+           ;; possibly.
+           (dotimes (i (- height (length lines)))
+             (end-of-line)
+             (let ((start (point)))
+               (insert (make-string (string-width (car lines)) ? )
+                       shr-table-vertical-line)
+               (when (nth 4 column)
+                 (shr-add-font start (1- (point))
+                               (list :background (nth 4 column)))))
+             (forward-line 1)))))
+      (unless collapse
+       (shr-insert-table-ruler widths)))))
 
 (defun shr-insert-table-ruler (widths)
   (when (and (bolp)