Function: org-ascii-table-cell

org-ascii-table-cell is a byte-compiled function defined in ox-ascii.el.gz.

Signature

(org-ascii-table-cell TABLE-CELL CONTENTS INFO)

Documentation

Transcode a TABLE-CELL object from Org to ASCII.

CONTENTS is the cell contents. INFO is a plist used as a communication channel.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
(defun org-ascii-table-cell (table-cell contents info)
  "Transcode a TABLE-CELL object from Org to ASCII.
CONTENTS is the cell contents.  INFO is a plist used as
a communication channel."
  ;; Determine column width.  When `org-ascii-table-widen-columns'
  ;; is nil and some width cookie has set it, use that value.
  ;; Otherwise, compute the maximum width among transcoded data of
  ;; each cell in the column.
  (let ((width (org-ascii--table-cell-width table-cell info)))
    ;; When contents are too large, truncate them.
    (unless (or (plist-get info :ascii-table-widen-columns)
		(<= (string-width (or contents "")) width))
      (setq contents (concat (substring contents 0 (- width 2)) "=>")))
    ;; Align contents correctly within the cell.
    (let* ((indent-tabs-mode nil)
	   (data
	    (when contents
	      (org-ascii--justify-lines
	       contents width
	       (org-export-table-cell-alignment table-cell info)))))
      (setq contents
	    (concat data
                    ;; FIXME: If CONTENTS was transformed by filters,
                    ;; the whole width calculation can be wrong.
                    ;; At least, make sure that we do not throw error
                    ;; when CONTENTS is larger than width.
		    (make-string (max 0 (- width (string-width (or data "")))) ?\s))))
    ;; Return cell.
    (concat (format " %s " contents)
	    (when (memq 'right (org-export-table-cell-borders table-cell info))
	      (if (eq (plist-get info :ascii-charset) 'utf-8) "│" "|")))))