Function: org-ascii-table-row

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

Signature

(org-ascii-table-row TABLE-ROW CONTENTS INFO)

Documentation

Transcode a TABLE-ROW element from Org to ASCII.

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

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
;;;; Table Row

(defun org-ascii-table-row (table-row contents info)
  "Transcode a TABLE-ROW element from Org to ASCII.
CONTENTS is the row contents.  INFO is a plist used as
a communication channel."
  (when (eq (org-element-property :type table-row) 'standard)
    (let ((build-hline
	   (lambda (lcorner horiz vert rcorner)
	     (concat
	      (apply
	       'concat
	       (org-element-map table-row 'table-cell
		 (lambda (cell)
		   (let ((width (org-ascii--table-cell-width cell info))
			 (borders (org-export-table-cell-borders cell info)))
		     (concat
		      ;; In order to know if CELL starts the row, do
		      ;; not compare it with the first cell in the
		      ;; row as there might be a special column.
		      ;; Instead, compare it with first exportable
		      ;; cell, obtained with `org-element-map'.
		      (when (and (memq 'left borders)
				 (eq (org-element-map table-row 'table-cell
				       'identity info t)
				     cell))
			lcorner)
		      (make-string (+ 2 width) (string-to-char horiz))
		      (cond
		       ((not (memq 'right borders)) nil)
		       ((eq (car (last (org-element-contents table-row))) cell)
			rcorner)
		       (t vert)))))
		 info)) "\n")))
	  (utf8p (eq (plist-get info :ascii-charset) 'utf-8))
	  (borders (org-export-table-cell-borders
		    (org-element-map table-row 'table-cell 'identity info t)
		    info)))
      (concat (cond
	       ((and (memq 'top borders) (or utf8p (memq 'above borders)))
		(if utf8p (funcall build-hline "┍" "━" "┯" "┑")
		  (funcall build-hline "+" "-" "+" "+")))
	       ((memq 'above borders)
		(if utf8p (funcall build-hline "├" "─" "┼" "┤")
		  (funcall build-hline "+" "-" "+" "+"))))
	      (when (memq 'left borders) (if utf8p "│" "|"))
	      contents "\n"
	      (when (and (memq 'bottom borders) (or utf8p (memq 'below borders)))
		(if utf8p (funcall build-hline "┕" "━" "┷" "┙")
		  (funcall build-hline "+" "-" "+" "+")))))))