[gnus git] branch master updated: m0-7-123-g2e7fb7e =1= (shr-make-table-1): Implement <td colspan=> support.
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 2e7fb7ec6bfd3d398f6fa719bd442739624c8318 (commit)
from 6e62edb5c345e5d733470a5b8fd9c9a400b9b3c6 (commit)
- Log -----------------------------------------------------------------
commit 2e7fb7ec6bfd3d398f6fa719bd442739624c8318
Author: Lars Magne Ingebrigtsen <[email protected]>
Date: Tue Jun 18 16:56:16 2013 +0200
(shr-make-table-1): Implement <td colspan=> support.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 695fb16..baca99e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -5,6 +5,7 @@
awkward.
(shr-tag-dl, shr-tag-dt, shr-tag-dd): Add support for <dl>, <dt> and
<dd>.
+ (shr-make-table-1): Implement <td colspan=> support.
2013-06-18 Katsumi Yamaoka <[email protected]>
diff --git a/lisp/shr.el b/lisp/shr.el
index f3a396a..6a26c08 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -126,6 +126,7 @@ cid: URL as the argument.")
(defvar shr-external-rendering-functions nil)
(defvar shr-target-id nil)
(defvar shr-inhibit-decoration nil)
+(defvar shr-table-separator-length 1)
(defvar shr-map
(let ((map (make-sparse-keymap)))
@@ -1347,6 +1348,7 @@ ones, in case fg and bg are nil."
(defun shr-insert-table (table widths)
(let* ((collapse (equal (cdr (assq 'border-collapse shr-stylesheet))
"collapse"))
+ (shr-table-separator-length (if collapse 0 1))
(shr-table-vertical-line (if collapse "" shr-table-vertical-line)))
(unless collapse
(shr-insert-table-ruler widths))
@@ -1432,20 +1434,39 @@ ones, in case fg and bg are nil."
(defun shr-make-table-1 (cont widths &optional fill)
(let ((trs nil)
- (shr-inhibit-decoration (not fill)))
+ (shr-inhibit-decoration (not fill))
+ width colspan)
(dolist (row cont)
(when (eq (car row) 'tr)
(let ((tds nil)
(columns (cdr row))
(i 0)
+ (width-column 0)
column)
(while (< i (length widths))
(setq column (pop columns))
(when (or (memq (car column) '(td th))
- (null column))
- (push (shr-render-td (cdr column) (aref widths i) fill)
- tds)
- (setq i (1+ i))))
+ (not column))
+ (setq width
+ (if column
+ (aref widths width-column)
+ 0))
+ (when (and fill
+ (setq colspan (cdr (assq :colspan (cdr column)))))
+ (setq colspan (string-to-number colspan))
+ (dotimes (j (1- colspan))
+ (if (> (+ i 1 j) (1- (length widths)))
+ (setq width (aref widths (1- (length widths))))
+ (setq width (+ width
+ shr-table-separator-length
+ (aref widths (+ i 1 j))))))
+ (setq width-column (+ width-column (1- colspan))))
+ (when (or column
+ (not fill))
+ (push (shr-render-td (cdr column) width fill)
+ tds))
+ (setq i (1+ i)
+ width-column (1+ width-column))))
(push (nreverse tds) trs))))
(nreverse trs)))
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 1 +
lisp/shr.el | 31 ++++++++++++++++++++++++++-----
2 files changed, 27 insertions(+), 5 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project