summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-06-26 12:17:28 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-06-26 12:17:28 +0200
commita5beff869fa198450ac68b8d3cad1e79089ff75c (patch)
treeb75d74d0072bda41031370a8bd48fd0499fdfaf3
parentbe9a1638afabae716131393a7c0b25a06fc5a9bd (diff)
downloadorg-mode-a5beff869fa198450ac68b8d3cad1e79089ff75c.tar.gz
ox-ascii: Fix tables with a width cookie
* lisp/ox-ascii.el (org-ascii--table-cell-width): Correctly export tables with width cookies.
-rw-r--r--lisp/ox-ascii.el33
1 files changed, 19 insertions, 14 deletions
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index b4efa53..4a6696e 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -1665,20 +1665,25 @@ are ignored."
(or (gethash key cache)
(puthash
key
- (or (and (not org-ascii-table-widen-columns)
- (org-export-table-cell-width table-cell info))
- (let* ((max-width 0))
- (org-element-map table 'table-row
- (lambda (row)
- (setq max-width
- (max (string-width
- (org-export-data
- (org-element-contents
- (elt (org-element-contents row) col))
- info))
- max-width)))
- info)
- max-width))
+ (let ((cookie-width (org-export-table-cell-width table-cell info)))
+ (or (and (not org-ascii-table-widen-columns) cookie-width)
+ (let ((contents-width
+ (let ((max-width 0))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (setq max-width
+ (max (string-width
+ (org-export-data
+ (org-element-contents
+ (elt (org-element-contents row) col))
+ info))
+ max-width)))
+ info)
+ max-width)))
+ (cond ((not cookie-width) contents-width)
+ (org-ascii-table-widen-columns
+ (max cookie-width contents-width))
+ (t cookie-width)))))
cache))))
(defun org-ascii-table-cell (table-cell contents info)