diff options
| author | Lars Magne Ingebrigtsen | 2013-06-17 22:06:27 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-06-17 22:06:27 +0000 |
| commit | be2aa135787e32fc93b2163834e7460056e6e1a7 (patch) | |
| tree | 889189ea9f2bbf09aebefb92aa3be80e296f4d68 | |
| parent | ec6ecaad44f4ca36e1ee7224c300222c6433471b (diff) | |
| download | emacs-be2aa135787e32fc93b2163834e7460056e6e1a7.tar.gz emacs-be2aa135787e32fc93b2163834e7460056e6e1a7.zip | |
lisp/gnus/{eww,shr}.el: Merge changes made in Gnus master
lisp/gnus/eww.el (eww-tag-select): Don't render totally empty <select> forms.
(eww-convert-widgets): Don't bug out if the first widget starts at the beginning of the buffer.
(eww-convert-widgets): Fix last patch.
lisp/gnus/shr.el (shr-insert-table): Respect border-collapse: collapse.
(shr-tag-base): Protect against base specs that are degenerate.
(shr-ensure-paragraph): Don't delete empty lines that have text properties, because these may be input fields.
lisp/gnus/eww.el (eww-convert-widgets): Put `help-echo' on input fields so that we can navigate to them.
lisp/gnus/shr.el (shr-colorize-region): Put the colours over the entire region.
(shr-inhibit-decoration): New variable.
(shr-add-font): Use it to inhibit text property decorations while doing preliminary table renderings. This speeds up typical Wikipedia page renderings by 15%.
(shr-tag-span): Don't respect the <title>, because that overwrites the help-echo from links inside the spans.
(shr-next-link): Use `help-echo' for navigation, so that we can navigate to form elements, too.
lisp/gnus/eww.el (eww-button): New face.
(eww-convert-widgets): Use it to make submit buttons more button-like.
| -rw-r--r-- | lisp/gnus/ChangeLog | 26 | ||||
| -rw-r--r-- | lisp/gnus/eww.el | 53 | ||||
| -rw-r--r-- | lisp/gnus/shr.el | 136 |
3 files changed, 142 insertions, 73 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7ceaac31e7e..b9c1d735f2d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,31 @@ | |||
| 1 | 2013-06-17 Lars Magne Ingebrigtsen <larsi@gnus.org> | 1 | 2013-06-17 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * eww.el (eww-tag-select): Don't render totally empty <select> forms. | ||
| 4 | (eww-convert-widgets): Don't bug out if the first widget starts at the | ||
| 5 | beginning of the buffer. | ||
| 6 | (eww-convert-widgets): Fix last patch. | ||
| 7 | |||
| 8 | * shr.el (shr-insert-table): Respect border-collapse: collapse. | ||
| 9 | (shr-tag-base): Protect against base specs that are degenerate. | ||
| 10 | (shr-ensure-paragraph): Don't delete empty lines that have text | ||
| 11 | properties, because these may be input fields. | ||
| 12 | |||
| 13 | * eww.el (eww-convert-widgets): Put `help-echo' on input fields so that | ||
| 14 | we can navigate to them. | ||
| 15 | |||
| 16 | * shr.el (shr-colorize-region): Put the colours over the entire region. | ||
| 17 | (shr-inhibit-decoration): New variable. | ||
| 18 | (shr-add-font): Use it to inhibit text property decorations while doing | ||
| 19 | preliminary table renderings. This speeds up typical Wikipedia page | ||
| 20 | renderings by 15%. | ||
| 21 | (shr-tag-span): Don't respect the <title>, because that overwrites the | ||
| 22 | help-echo from links inside the spans. | ||
| 23 | (shr-next-link): Use `help-echo' for navigation, so that we can | ||
| 24 | navigate to form elements, too. | ||
| 25 | |||
| 26 | * eww.el (eww-button): New face. | ||
| 27 | (eww-convert-widgets): Use it to make submit buttons more button-like. | ||
| 28 | |||
| 3 | * mm-decode.el (mm-convert-shr-links): Override the shr local map, so | 29 | * mm-decode.el (mm-convert-shr-links): Override the shr local map, so |
| 4 | that Gnus commands work. | 30 | that Gnus commands work. |
| 5 | 31 | ||
diff --git a/lisp/gnus/eww.el b/lisp/gnus/eww.el index fc0e413248a..fc6f591e0ce 100644 --- a/lisp/gnus/eww.el +++ b/lisp/gnus/eww.el | |||
| @@ -43,6 +43,14 @@ | |||
| 43 | :group 'eww | 43 | :group 'eww |
| 44 | :type 'string) | 44 | :type 'string) |
| 45 | 45 | ||
| 46 | (defface eww-button | ||
| 47 | '((((type x w32 ns) (class color)) ; Like default mode line | ||
| 48 | :box (:line-width 2 :style released-button) | ||
| 49 | :background "lightgrey" :foreground "black")) | ||
| 50 | "Face for eww buffer buttons." | ||
| 51 | :version "24.4" | ||
| 52 | :group 'eww) | ||
| 53 | |||
| 46 | (defvar eww-current-url nil) | 54 | (defvar eww-current-url nil) |
| 47 | (defvar eww-current-title "" | 55 | (defvar eww-current-title "" |
| 48 | "Title of current page.") | 56 | "Title of current page.") |
| @@ -268,34 +276,39 @@ | |||
| 268 | (let* ((start (point)) | 276 | (let* ((start (point)) |
| 269 | (type (downcase (or (cdr (assq :type cont)) | 277 | (type (downcase (or (cdr (assq :type cont)) |
| 270 | "text"))) | 278 | "text"))) |
| 279 | (value (cdr (assq :value cont))) | ||
| 271 | (widget | 280 | (widget |
| 272 | (cond | 281 | (cond |
| 273 | ((equal type "submit") | 282 | ((equal type "submit") |
| 274 | (list 'push-button | 283 | (list 'push-button |
| 275 | :notify 'eww-submit | 284 | :notify 'eww-submit |
| 276 | :name (cdr (assq :name cont)) | 285 | :name (cdr (assq :name cont)) |
| 277 | :value (cdr (assq :value cont)) | 286 | :value (if (zerop (length value)) |
| 287 | "Submit" | ||
| 288 | value) | ||
| 278 | :eww-form eww-form | 289 | :eww-form eww-form |
| 279 | (or (cdr (assq :value cont)) "Submit"))) | 290 | (or (if (zerop (length value)) |
| 291 | "Submit" | ||
| 292 | value)))) | ||
| 280 | ((or (equal type "radio") | 293 | ((or (equal type "radio") |
| 281 | (equal type "checkbox")) | 294 | (equal type "checkbox")) |
| 282 | (list 'checkbox | 295 | (list 'checkbox |
| 283 | :notify 'eww-click-radio | 296 | :notify 'eww-click-radio |
| 284 | :name (cdr (assq :name cont)) | 297 | :name (cdr (assq :name cont)) |
| 285 | :checkbox-value (cdr (assq :value cont)) | 298 | :checkbox-value value |
| 286 | :checkbox-type type | 299 | :checkbox-type type |
| 287 | :eww-form eww-form | 300 | :eww-form eww-form |
| 288 | (cdr (assq :checked cont)))) | 301 | (cdr (assq :checked cont)))) |
| 289 | ((equal type "hidden") | 302 | ((equal type "hidden") |
| 290 | (list 'hidden | 303 | (list 'hidden |
| 291 | :name (cdr (assq :name cont)) | 304 | :name (cdr (assq :name cont)) |
| 292 | :value (cdr (assq :value cont)))) | 305 | :value value)) |
| 293 | (t | 306 | (t |
| 294 | (list 'editable-field | 307 | (list 'editable-field |
| 295 | :size (string-to-number | 308 | :size (string-to-number |
| 296 | (or (cdr (assq :size cont)) | 309 | (or (cdr (assq :size cont)) |
| 297 | "40")) | 310 | "40")) |
| 298 | :value (or (cdr (assq :value cont)) "") | 311 | :value (or value "") |
| 299 | :secret (and (equal type "password") ?*) | 312 | :secret (and (equal type "password") ?*) |
| 300 | :action 'eww-submit | 313 | :action 'eww-submit |
| 301 | :name (cdr (assq :name cont)) | 314 | :name (cdr (assq :name cont)) |
| @@ -303,7 +316,8 @@ | |||
| 303 | (nconc eww-form (list widget)) | 316 | (nconc eww-form (list widget)) |
| 304 | (unless (eq (car widget) 'hidden) | 317 | (unless (eq (car widget) 'hidden) |
| 305 | (apply 'widget-create widget) | 318 | (apply 'widget-create widget) |
| 306 | (put-text-property start (point) 'eww-widget widget)))) | 319 | (put-text-property start (point) 'eww-widget widget) |
| 320 | (insert " ")))) | ||
| 307 | 321 | ||
| 308 | (defun eww-tag-textarea (cont) | 322 | (defun eww-tag-textarea (cont) |
| 309 | (let* ((start (point)) | 323 | (let* ((start (point)) |
| @@ -336,13 +350,14 @@ | |||
| 336 | :value (cdr (assq :value (cdr elem))) | 350 | :value (cdr (assq :value (cdr elem))) |
| 337 | :tag (cdr (assq 'text (cdr elem)))) | 351 | :tag (cdr (assq 'text (cdr elem)))) |
| 338 | options))) | 352 | options))) |
| 339 | ;; If we have no selected values, default to the first value. | 353 | (when options |
| 340 | (unless (plist-get (cdr menu) :value) | 354 | ;; If we have no selected values, default to the first value. |
| 341 | (nconc menu (list :value (nth 2 (car options))))) | 355 | (unless (plist-get (cdr menu) :value) |
| 342 | (nconc menu options) | 356 | (nconc menu (list :value (nth 2 (car options))))) |
| 343 | (apply 'widget-create menu) | 357 | (nconc menu options) |
| 344 | (put-text-property start (point) 'eww-widget menu) | 358 | (apply 'widget-create menu) |
| 345 | (shr-ensure-paragraph))) | 359 | (put-text-property start (point) 'eww-widget menu) |
| 360 | (shr-ensure-paragraph)))) | ||
| 346 | 361 | ||
| 347 | (defun eww-click-radio (widget &rest ignore) | 362 | (defun eww-click-radio (widget &rest ignore) |
| 348 | (let ((form (plist-get (cdr widget) :eww-form)) | 363 | (let ((form (plist-get (cdr widget) :eww-form)) |
| @@ -434,7 +449,9 @@ | |||
| 434 | ;; so we need to nix out the list of widgets and recreate them. | 449 | ;; so we need to nix out the list of widgets and recreate them. |
| 435 | (setq widget-field-list nil | 450 | (setq widget-field-list nil |
| 436 | widget-field-new nil) | 451 | widget-field-new nil) |
| 437 | (while (setq start (next-single-property-change start 'eww-widget)) | 452 | (while (setq start (if (get-text-property start 'eww-widget) |
| 453 | start | ||
| 454 | (next-single-property-change start 'eww-widget))) | ||
| 438 | (setq widget (get-text-property start 'eww-widget)) | 455 | (setq widget (get-text-property start 'eww-widget)) |
| 439 | (goto-char start) | 456 | (goto-char start) |
| 440 | (let ((end (next-single-property-change start 'eww-widget))) | 457 | (let ((end (next-single-property-change start 'eww-widget))) |
| @@ -445,7 +462,13 @@ | |||
| 445 | (delete-region start end)) | 462 | (delete-region start end)) |
| 446 | (when (and widget | 463 | (when (and widget |
| 447 | (not (eq (car widget) 'hidden))) | 464 | (not (eq (car widget) 'hidden))) |
| 448 | (apply 'widget-create widget))) | 465 | (apply 'widget-create widget) |
| 466 | (put-text-property start (point) 'help-echo | ||
| 467 | (if (memq (car widget) '(text editable-field)) | ||
| 468 | "Input field" | ||
| 469 | "Button")) | ||
| 470 | (when (eq (car widget) 'push-button) | ||
| 471 | (add-face-text-property start (point) 'eww-button t)))) | ||
| 449 | (widget-setup) | 472 | (widget-setup) |
| 450 | (eww-fix-widget-keymap))) | 473 | (eww-fix-widget-keymap))) |
| 451 | 474 | ||
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index d3b9a362a0b..2d0c9107fd6 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el | |||
| @@ -125,6 +125,7 @@ cid: URL as the argument.") | |||
| 125 | (defvar shr-ignore-cache nil) | 125 | (defvar shr-ignore-cache nil) |
| 126 | (defvar shr-external-rendering-functions nil) | 126 | (defvar shr-external-rendering-functions nil) |
| 127 | (defvar shr-target-id nil) | 127 | (defvar shr-target-id nil) |
| 128 | (defvar shr-inhibit-decoration nil) | ||
| 128 | 129 | ||
| 129 | (defvar shr-map | 130 | (defvar shr-map |
| 130 | (let ((map (make-sparse-keymap))) | 131 | (let ((map (make-sparse-keymap))) |
| @@ -222,9 +223,9 @@ redirects somewhere else." | |||
| 222 | (defun shr-next-link () | 223 | (defun shr-next-link () |
| 223 | "Skip to the next link." | 224 | "Skip to the next link." |
| 224 | (interactive) | 225 | (interactive) |
| 225 | (let ((skip (text-property-any (point) (point-max) 'shr-url nil))) | 226 | (let ((skip (text-property-any (point) (point-max) 'help-echo nil))) |
| 226 | (if (not (setq skip (text-property-not-all skip (point-max) | 227 | (if (not (setq skip (text-property-not-all skip (point-max) |
| 227 | 'shr-url nil))) | 228 | 'help-echo nil))) |
| 228 | (message "No next link") | 229 | (message "No next link") |
| 229 | (goto-char skip) | 230 | (goto-char skip) |
| 230 | (message "%s" (get-text-property (point) 'help-echo))))) | 231 | (message "%s" (get-text-property (point) 'help-echo))))) |
| @@ -236,11 +237,11 @@ redirects somewhere else." | |||
| 236 | (found nil)) | 237 | (found nil)) |
| 237 | ;; Skip past the current link. | 238 | ;; Skip past the current link. |
| 238 | (while (and (not (bobp)) | 239 | (while (and (not (bobp)) |
| 239 | (get-text-property (point) 'shr-url)) | 240 | (get-text-property (point) 'help-echo)) |
| 240 | (forward-char -1)) | 241 | (forward-char -1)) |
| 241 | ;; Find the previous link. | 242 | ;; Find the previous link. |
| 242 | (while (and (not (bobp)) | 243 | (while (and (not (bobp)) |
| 243 | (not (setq found (get-text-property (point) 'shr-url)))) | 244 | (not (setq found (get-text-property (point) 'help-echo)))) |
| 244 | (forward-char -1)) | 245 | (forward-char -1)) |
| 245 | (if (not found) | 246 | (if (not found) |
| 246 | (progn | 247 | (progn |
| @@ -248,7 +249,7 @@ redirects somewhere else." | |||
| 248 | (goto-char start)) | 249 | (goto-char start)) |
| 249 | ;; Put point at the start of the link. | 250 | ;; Put point at the start of the link. |
| 250 | (while (and (not (bobp)) | 251 | (while (and (not (bobp)) |
| 251 | (get-text-property (point) 'shr-url)) | 252 | (get-text-property (point) 'help-echo)) |
| 252 | (forward-char -1)) | 253 | (forward-char -1)) |
| 253 | (forward-char 1) | 254 | (forward-char 1) |
| 254 | (message "%s" (get-text-property (point) 'help-echo))))) | 255 | (message "%s" (get-text-property (point) 'help-echo))))) |
| @@ -349,7 +350,7 @@ size, and full-buffer size." | |||
| 349 | (shr-stylesheet shr-stylesheet) | 350 | (shr-stylesheet shr-stylesheet) |
| 350 | (start (point))) | 351 | (start (point))) |
| 351 | (when style | 352 | (when style |
| 352 | (if (string-match "color\\|display" style) | 353 | (if (string-match "color\\|display\\|border-collapse" style) |
| 353 | (setq shr-stylesheet (nconc (shr-parse-style style) | 354 | (setq shr-stylesheet (nconc (shr-parse-style style) |
| 354 | shr-stylesheet)) | 355 | shr-stylesheet)) |
| 355 | (setq style nil))) | 356 | (setq style nil))) |
| @@ -595,7 +596,14 @@ size, and full-buffer size." | |||
| 595 | (insert "\n")) | 596 | (insert "\n")) |
| 596 | (if (save-excursion | 597 | (if (save-excursion |
| 597 | (beginning-of-line) | 598 | (beginning-of-line) |
| 598 | (looking-at " *$")) | 599 | ;; If the current line is totally blank, and doesn't even |
| 600 | ;; have any face properties set, then delete the blank | ||
| 601 | ;; space. | ||
| 602 | (and (looking-at " *$") | ||
| 603 | (not (get-text-property (point) 'face)) | ||
| 604 | (not (= (next-single-property-change (point) 'face nil | ||
| 605 | (line-end-position)) | ||
| 606 | (line-end-position))))) | ||
| 599 | (delete-region (match-beginning 0) (match-end 0)) | 607 | (delete-region (match-beginning 0) (match-end 0)) |
| 600 | (insert "\n\n"))))) | 608 | (insert "\n\n"))))) |
| 601 | 609 | ||
| @@ -613,15 +621,16 @@ size, and full-buffer size." | |||
| 613 | ;; blank text at the start of the line, and the newline at the end, to | 621 | ;; blank text at the start of the line, and the newline at the end, to |
| 614 | ;; avoid ugliness. | 622 | ;; avoid ugliness. |
| 615 | (defun shr-add-font (start end type) | 623 | (defun shr-add-font (start end type) |
| 616 | (save-excursion | 624 | (unless shr-inhibit-decoration |
| 617 | (goto-char start) | 625 | (save-excursion |
| 618 | (while (< (point) end) | 626 | (goto-char start) |
| 619 | (when (bolp) | 627 | (while (< (point) end) |
| 620 | (skip-chars-forward " ")) | 628 | (when (bolp) |
| 621 | (add-face-text-property (point) (min (line-end-position) end) type t) | 629 | (skip-chars-forward " ")) |
| 622 | (if (< (line-end-position) end) | 630 | (add-face-text-property (point) (min (line-end-position) end) type t) |
| 623 | (forward-line 1) | 631 | (if (< (line-end-position) end) |
| 624 | (goto-char end))))) | 632 | (forward-line 1) |
| 633 | (goto-char end)))))) | ||
| 625 | 634 | ||
| 626 | (defun shr-browse-url () | 635 | (defun shr-browse-url () |
| 627 | "Browse the URL under point." | 636 | "Browse the URL under point." |
| @@ -797,12 +806,13 @@ START, and END. Note that START and END should be markers." | |||
| 797 | (shr-ensure-paragraph)) | 806 | (shr-ensure-paragraph)) |
| 798 | 807 | ||
| 799 | (defun shr-urlify (start url &optional title) | 808 | (defun shr-urlify (start url &optional title) |
| 809 | (when (and title (string-match "ctx" title)) (debug)) | ||
| 800 | (shr-add-font start (point) 'shr-link) | 810 | (shr-add-font start (point) 'shr-link) |
| 801 | (add-text-properties | 811 | (add-text-properties |
| 802 | start (point) | 812 | start (point) |
| 803 | (list 'shr-url url | 813 | (list 'shr-url url |
| 804 | 'local-map shr-map | 814 | 'help-echo (if title (format "%s (%s)" url title) url) |
| 805 | 'help-echo (if title (format "%s (%s)" url title) url)))) | 815 | 'local-map shr-map))) |
| 806 | 816 | ||
| 807 | (defun shr-encode-url (url) | 817 | (defun shr-encode-url (url) |
| 808 | "Encode URL." | 818 | "Encode URL." |
| @@ -834,13 +844,18 @@ ones, in case fg and bg are nil." | |||
| 834 | (shr-color-visible bg fg))))))) | 844 | (shr-color-visible bg fg))))))) |
| 835 | 845 | ||
| 836 | (defun shr-colorize-region (start end fg &optional bg) | 846 | (defun shr-colorize-region (start end fg &optional bg) |
| 837 | (when (or fg bg) | 847 | (when (and (not shr-inhibit-decoration) |
| 848 | (or fg bg)) | ||
| 838 | (let ((new-colors (shr-color-check fg bg))) | 849 | (let ((new-colors (shr-color-check fg bg))) |
| 839 | (when new-colors | 850 | (when new-colors |
| 840 | (when fg | 851 | (when fg |
| 841 | (shr-add-font start end (list :foreground (cadr new-colors)))) | 852 | (add-face-text-property start end |
| 853 | (list :foreground (cadr new-colors)) | ||
| 854 | t)) | ||
| 842 | (when bg | 855 | (when bg |
| 843 | (shr-add-font start end (list :background (car new-colors))))) | 856 | (add-face-text-property start end |
| 857 | (list :background (car new-colors)) | ||
| 858 | t))) | ||
| 844 | new-colors))) | 859 | new-colors))) |
| 845 | 860 | ||
| 846 | (defun shr-expand-newlines (start end color) | 861 | (defun shr-expand-newlines (start end color) |
| @@ -1008,7 +1023,9 @@ ones, in case fg and bg are nil." | |||
| 1008 | plist))) | 1023 | plist))) |
| 1009 | 1024 | ||
| 1010 | (defun shr-tag-base (cont) | 1025 | (defun shr-tag-base (cont) |
| 1011 | (setq shr-base (shr-parse-base (cdr (assq :href cont)))) | 1026 | (let ((base (cdr (assq :href cont)))) |
| 1027 | (when base | ||
| 1028 | (setq shr-base (shr-parse-base base)))) | ||
| 1012 | (shr-generic cont)) | 1029 | (shr-generic cont)) |
| 1013 | 1030 | ||
| 1014 | (defun shr-tag-a (cont) | 1031 | (defun shr-tag-a (cont) |
| @@ -1017,7 +1034,8 @@ ones, in case fg and bg are nil." | |||
| 1017 | (start (point)) | 1034 | (start (point)) |
| 1018 | shr-start) | 1035 | shr-start) |
| 1019 | (shr-generic cont) | 1036 | (shr-generic cont) |
| 1020 | (when url | 1037 | (when (and url |
| 1038 | (not shr-inhibit-decoration)) | ||
| 1021 | (shr-urlify (or shr-start start) (shr-expand-url url) title)))) | 1039 | (shr-urlify (or shr-start start) (shr-expand-url url) title)))) |
| 1022 | 1040 | ||
| 1023 | (defun shr-tag-object (cont) | 1041 | (defun shr-tag-object (cont) |
| @@ -1154,11 +1172,7 @@ ones, in case fg and bg are nil." | |||
| 1154 | (shr-generic cont)) | 1172 | (shr-generic cont)) |
| 1155 | 1173 | ||
| 1156 | (defun shr-tag-span (cont) | 1174 | (defun shr-tag-span (cont) |
| 1157 | (let ((title (cdr (assq :title cont)))) | 1175 | (shr-generic cont)) |
| 1158 | (shr-generic cont) | ||
| 1159 | (when (and title | ||
| 1160 | shr-start) | ||
| 1161 | (put-text-property shr-start (point) 'help-echo title)))) | ||
| 1162 | 1176 | ||
| 1163 | (defun shr-tag-h1 (cont) | 1177 | (defun shr-tag-h1 (cont) |
| 1164 | (shr-heading cont 'bold 'underline)) | 1178 | (shr-heading cont 'bold 'underline)) |
| @@ -1312,35 +1326,40 @@ ones, in case fg and bg are nil." | |||
| 1312 | (nreverse result))) | 1326 | (nreverse result))) |
| 1313 | 1327 | ||
| 1314 | (defun shr-insert-table (table widths) | 1328 | (defun shr-insert-table (table widths) |
| 1315 | (shr-insert-table-ruler widths) | 1329 | (let* ((collapse (equal (cdr (assq 'border-collapse shr-stylesheet)) |
| 1316 | (dolist (row table) | 1330 | "collapse")) |
| 1317 | (let ((start (point)) | 1331 | (shr-table-vertical-line (if collapse "" shr-table-vertical-line))) |
| 1318 | (height (let ((max 0)) | 1332 | (unless collapse |
| 1319 | (dolist (column row) | 1333 | (shr-insert-table-ruler widths)) |
| 1320 | (setq max (max max (cadr column)))) | 1334 | (dolist (row table) |
| 1321 | max))) | 1335 | (let ((start (point)) |
| 1322 | (dotimes (i height) | 1336 | (height (let ((max 0)) |
| 1323 | (shr-indent) | 1337 | (dolist (column row) |
| 1324 | (insert shr-table-vertical-line "\n")) | 1338 | (setq max (max max (cadr column)))) |
| 1325 | (dolist (column row) | 1339 | max))) |
| 1326 | (goto-char start) | 1340 | (dotimes (i height) |
| 1327 | (let ((lines (nth 2 column))) | 1341 | (shr-indent) |
| 1328 | (dolist (line lines) | 1342 | (insert shr-table-vertical-line "\n")) |
| 1329 | (end-of-line) | 1343 | (dolist (column row) |
| 1330 | (insert line shr-table-vertical-line) | 1344 | (goto-char start) |
| 1331 | (forward-line 1)) | 1345 | (let ((lines (nth 2 column))) |
| 1332 | ;; Add blank lines at padding at the bottom of the TD, | 1346 | (dolist (line lines) |
| 1333 | ;; possibly. | 1347 | (end-of-line) |
| 1334 | (dotimes (i (- height (length lines))) | 1348 | (insert line shr-table-vertical-line) |
| 1335 | (end-of-line) | 1349 | (forward-line 1)) |
| 1336 | (let ((start (point))) | 1350 | ;; Add blank lines at padding at the bottom of the TD, |
| 1337 | (insert (make-string (string-width (car lines)) ? ) | 1351 | ;; possibly. |
| 1338 | shr-table-vertical-line) | 1352 | (dotimes (i (- height (length lines))) |
| 1339 | (when (nth 4 column) | 1353 | (end-of-line) |
| 1340 | (shr-add-font start (1- (point)) | 1354 | (let ((start (point))) |
| 1341 | (list :background (nth 4 column))))) | 1355 | (insert (make-string (string-width (car lines)) ? ) |
| 1342 | (forward-line 1))))) | 1356 | shr-table-vertical-line) |
| 1343 | (shr-insert-table-ruler widths))) | 1357 | (when (nth 4 column) |
| 1358 | (shr-add-font start (1- (point)) | ||
| 1359 | (list :background (nth 4 column))))) | ||
| 1360 | (forward-line 1))))) | ||
| 1361 | (unless collapse | ||
| 1362 | (shr-insert-table-ruler widths))))) | ||
| 1344 | 1363 | ||
| 1345 | (defun shr-insert-table-ruler (widths) | 1364 | (defun shr-insert-table-ruler (widths) |
| 1346 | (when (and (bolp) | 1365 | (when (and (bolp) |
| @@ -1393,7 +1412,8 @@ ones, in case fg and bg are nil." | |||
| 1393 | data))) | 1412 | data))) |
| 1394 | 1413 | ||
| 1395 | (defun shr-make-table-1 (cont widths &optional fill) | 1414 | (defun shr-make-table-1 (cont widths &optional fill) |
| 1396 | (let ((trs nil)) | 1415 | (let ((trs nil) |
| 1416 | (shr-inhibit-decoration (not fill))) | ||
| 1397 | (dolist (row cont) | 1417 | (dolist (row cont) |
| 1398 | (when (eq (car row) 'tr) | 1418 | (when (eq (car row) 'tr) |
| 1399 | (let ((tds nil) | 1419 | (let ((tds nil) |