Function: shr-render-td-1
shr-render-td-1 is a byte-compiled function defined in shr.el.gz.
Signature
(shr-render-td-1 DOM WIDTH FILL)
Source Code
;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr-render-td-1 (dom width fill)
(with-temp-buffer
(let ((bgcolor (dom-attr dom 'bgcolor))
(fgcolor (dom-attr dom 'fgcolor))
(style (dom-attr dom 'style))
(shr-stylesheet shr-stylesheet)
(max-width 0)
(shr--link-targets nil)
natural-width)
(when style
(setq style (and (string-search "color" style)
(shr-parse-style style))))
(when bgcolor
(setq style (nconc (list (cons 'background-color bgcolor))
style)))
(when fgcolor
(setq style (nconc (list (cons 'color fgcolor)) style)))
(when style
(setq shr-stylesheet (append style shr-stylesheet)))
(let ((shr-internal-width width)
(shr-indentation 0))
(shr-descend dom))
(save-window-excursion
;; Avoid errors if the selected window is a dedicated one,
;; and they just want to insert a document into it.
(set-window-dedicated-p nil nil)
(set-window-buffer nil (current-buffer))
(unless fill
(setq natural-width
(or (dom-attr dom 'shr-td-cache-natural)
(let ((natural (max (shr-pixel-buffer-width)
(shr-dom-max-natural-width dom))))
(dom-set-attribute dom 'shr-td-cache-natural natural)
natural))))
(if (and natural-width
(<= natural-width width))
(setq max-width natural-width)
(let ((shr-internal-width width))
(shr-fill-lines (point-min) (point-max))
(setq max-width (shr-pixel-buffer-width)))))
(goto-char (point-max))
;; Delete padding at the bottom of the TDs.
(delete-region
(point)
(progn
(skip-chars-backward " \t\n")
(end-of-line)
(point)))
(goto-char (point-min))
(shr--set-target-ids shr--link-targets)
(list max-width
natural-width
(count-lines (point-min) (point-max))
(split-string (buffer-string) "\n")
(if (dom-attr dom 'colspan)
(string-to-number (dom-attr dom 'colspan))
1)
(cdr (assq 'color shr-stylesheet))
(cdr (assq 'background-color shr-stylesheet))))))