* net/shr.el (shr-make-table-1): dom.el changes for table rendering.

This commit is contained in:
Lars Magne Ingebrigtsen
2014-11-27 00:03:09 +01:00
parent fc4d2c7784
commit 803df8492d
2 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
2014-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-make-table-1): dom.el changes for table rendering.
* dom.el (dom-by-tag): Use `equal' for comparisons so that tags
can be strings.
(dom-elements): Protect against non-text nodes.

View File

@@ -1582,7 +1582,7 @@ The preference is a float determined from `shr-prefer-media-type'."
(shr-inhibit-decoration (not fill))
(rowspans (make-vector (length widths) 0))
width colspan)
(dolist (row (dom-children dom))
(dolist (row (dom-non-text-children dom))
(when (eq (dom-tag row) 'tr)
(let ((tds nil)
(columns (dom-children row))
@@ -1731,7 +1731,7 @@ The preference is a float determined from `shr-prefer-media-type'."
;; Return a summary of the number and shape of the TDs in the table.
(defun shr-column-specs (dom)
(let ((columns (make-vector (shr-max-columns dom) 1)))
(dolist (row (dom-children dom))
(dolist (row (dom-non-text-children dom))
(when (eq (dom-tag row) 'tr)
(let ((i 0))
(dolist (column (dom-children row))
@@ -1757,7 +1757,8 @@ The preference is a float determined from `shr-prefer-media-type'."
(defun shr-max-columns (dom)
(let ((max 0))
(dolist (row (dom-children dom))
(when (eq (dom-tag row) 'tr)
(when (and (not (stringp row))
(eq (dom-tag row) 'tr))
(setq max (max max (+ (shr-count row 'td)
(shr-count row 'th))))))
max))