mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-25 07:27:57 +00:00
org-e-ascii: Allow to use ascii-art for table.el tables
* contrib/lisp/org-e-ascii.el (org-e-ascii-table-use-ascii-art): New variable. (org-e-ascii-table): Allow to use ascii-art for table.el tables.
This commit is contained in:
parent
d0665bb322
commit
db004a0ad6
@ -243,6 +243,15 @@ Org mode, i.e. with \"=>\" as ellipsis."
|
||||
:group 'org-export-e-ascii
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-e-ascii-table-use-ascii-art nil
|
||||
"Non-nil means table.el tables are turned into ascii-art.
|
||||
|
||||
It only makes sense when export charset is `utf-8'. It is nil by
|
||||
default since it requires ascii-art-to-unicode.el package. You
|
||||
can download it here:
|
||||
|
||||
http://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el.")
|
||||
|
||||
(defcustom org-e-ascii-caption-above nil
|
||||
"When non-nil, place caption string before the element.
|
||||
Otherwise, place it right after it."
|
||||
@ -1523,8 +1532,19 @@ contextual information."
|
||||
;; Possibly add a caption string above.
|
||||
(when (and caption org-e-ascii-caption-above) (concat caption "\n"))
|
||||
;; Insert table. Note: "table.el" tables are left unmodified.
|
||||
(if (eq (org-element-property :type table) 'org) contents
|
||||
(org-remove-indentation (org-element-property :value table)))
|
||||
(cond ((eq (org-element-property :type table) 'org) contents)
|
||||
((and org-e-ascii-table-use-ascii-art
|
||||
(eq (plist-get info :ascii-charset) 'utf-8)
|
||||
(require 'ascii-art-to-unicode nil t))
|
||||
(with-temp-buffer
|
||||
(insert (org-remove-indentation
|
||||
(org-element-property :value table)))
|
||||
(goto-char (point-min))
|
||||
(aa2u)
|
||||
(goto-char (point-max))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(buffer-string)))
|
||||
(t (org-remove-indentation (org-element-property :value table))))
|
||||
;; Possible add a caption string below.
|
||||
(when (and caption (not org-e-ascii-caption-above))
|
||||
(concat "\n" caption)))))
|
||||
|
Loading…
Reference in New Issue
Block a user