* net/shr.el (shr-make-table-1): Fix colspan typo.
(shr-make-table-1): Add comments.
+ (shr-make-table-1): Make colspan display more sensibly.
* net/eww.el (eww-add-bookmark): Fix prompt and clean up the code
slightly.
(let ((trs nil)
(shr-inhibit-decoration (not fill))
(rowspans (make-vector (length widths) 0))
+ (colspan-remaining 0)
+ colspan-width colspan-count
width colspan)
(dolist (row (dom-non-text-children dom))
(when (eq (dom-tag row) 'tr)
(if column
(aref widths width-column)
10))
- (when (and fill
- (setq colspan (dom-attr column 'colspan)))
+ (when (setq colspan (dom-attr column 'colspan))
(setq colspan (min (string-to-number colspan)
;; The colspan may be wrong, so
;; truncate it to the length of the
(+ width
shr-table-separator-length
(aref widths (+ i 1 j))))))
- (setq width-column (+ width-column (1- colspan))))
+ (setq width-column (+ width-column (1- colspan))
+ colspan-count colspan
+ colspan-remaining colspan))
(when (or column
(not fill))
- (push (shr-render-td column width fill)
- tds))
+ (let ((data (shr-render-td column width fill)))
+ (if (and (not fill)
+ (> colspan-remaining 0))
+ (progn
+ (when (= colspan-count colspan-remaining)
+ (setq colspan-width data))
+ (let ((this-width (/ colspan-width colspan-count)))
+ (push this-width tds)
+ (setq colspan-remaining (1- colspan-remaining))))
+ (push data tds))))
(setq i (1+ i)
width-column (1+ width-column))))
(push (nreverse tds) trs))))