Function: org-texinfo-table-column-widths

org-texinfo-table-column-widths is a byte-compiled function defined in ox-texinfo.el.gz.

Signature

(org-texinfo-table-column-widths TABLE INFO)

Documentation

Determine the largest table cell in each column to process alignment.

TABLE is the table element to transcode. INFO is a plist used as a communication channel.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-texinfo.el.gz
(defun org-texinfo-table-column-widths (table info)
  "Determine the largest table cell in each column to process alignment.
TABLE is the table element to transcode.  INFO is a plist used as
a communication channel."
  (let ((widths (make-vector (cdr (org-export-table-dimensions table info)) 0)))
    (org-element-map table 'table-row
      (lambda (row)
	(let ((idx 0))
	  (org-element-map row 'table-cell
	    (lambda (cell)
	      ;; Length of the cell in the original buffer is only an
	      ;; approximation of the length of the cell in the
	      ;; output.  It can sometimes fail (e.g. it considers
	      ;; "/a/" being larger than "ab").
	      (let ((w (- (org-element-contents-end cell)
			  (org-element-contents-begin cell))))
		(aset widths idx (max w (aref widths idx))))
	      (cl-incf idx))
	    info)))
      info)
    (format "{%s}" (mapconcat (lambda (w) (make-string w ?a)) widths "} {"))))