Commit 96ac3142 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Allow several <tbody> tags in shr

* shr.el (shr-table-body): New function to find the real body
of a table.
(shr-tag-table): Use it to render several <tbody> tags in a
table (bug#22170).


(cherry picked from commit cdaf3302)
parent a7143faf
......@@ -1572,12 +1572,23 @@ The preference is a float determined from `shr-prefer-media-type'."
;; Then render the table again with these new "hard" widths.
(shr-insert-table (shr-make-table dom sketch-widths t) sketch-widths)))
(defun shr-table-body (dom)
(let ((tbodies (dom-by-tag dom 'tbody)))
((null tbodies)
((= (length tbodies) 1)
(car tbodies))
;; Table with multiple tbodies. Convert into a single tbody.
`(tbody nil
,@(reduce 'append (mapcar 'dom-non-text-children tbodies)))))))
(defun shr-tag-table (dom)
(let* ((caption (dom-children (dom-child-by-tag dom 'caption)))
(header (dom-non-text-children (dom-child-by-tag dom 'thead)))
(body (dom-non-text-children (or (dom-child-by-tag dom 'tbody)
(body (dom-non-text-children (shr-table-body dom)))
(footer (dom-non-text-children (dom-child-by-tag dom 'tfoot)))
(bgcolor (dom-attr dom 'bgcolor))
(start (point))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment