[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 96ac314 05/12: Allow several <tbody> tags in shr
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] emacs-25 96ac314 05/12: Allow several <tbody> tags in shr |
Date: |
Fri, 25 Dec 2015 16:06:01 +0000 |
branch: emacs-25
commit 96ac31425d898d853a15763288d5e360a0f0430a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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).
Backport:
(cherry picked from commit cdaf33029d6620073833876d76056045ecfbc7c4)
---
lisp/net/shr.el | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index d51b8c7..18eadcb 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -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)))
+ (cond
+ ((null tbodies)
+ dom)
+ ((= (length tbodies) 1)
+ (car tbodies))
+ (t
+ ;; Table with multiple tbodies. Convert into a single tbody.
+ `(tbody nil
+ ,@(reduce 'append (mapcar 'dom-non-text-children tbodies)))))))
+
(defun shr-tag-table (dom)
(shr-ensure-paragraph)
(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)
- dom)))
+ (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))
- [Emacs-diffs] emacs-25 updated (cc3de97 -> e59b2ee), Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 5bd3a0c 02/12: Add FreeBSD cert bundle, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 6ef896c 01/12: Ignore invalid SVG images, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 90f82ff 03/12: Decode hex-encoded URLs before using them as file names, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 ec2a509 06/12: Use cl-reduce, not reduce., Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 96ac314 05/12: Allow several <tbody> tags in shr,
Lars Ingebrigtsen <=
- [Emacs-diffs] emacs-25 eeff251 08/12: Don't store cookies with empty names, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 5b2401d 07/12: Stop rendering HTML before specdlr exhaustion, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 6c12691 11/12: Always save eww history, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 a7143fa 04/12: Make prettier unique file names in eww, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 2d33a9c 09/12: Make toggling checkboxes work again, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 1a99bd6 10/12: Default web pages to right-to-left, Lars Ingebrigtsen, 2015/12/25
- [Emacs-diffs] emacs-25 e59b2ee 12/12: More eww file name coding fixes, Lars Ingebrigtsen, 2015/12/25