ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org backend when exporting table data to plain text table. ascii backend incorrectly handles quote transcoders that change the column width and sometimes throws an error. (ascii backend simply ignores transcoded table cells and calculates width based on the initial cell text).
This commit is contained in:
parent
8908fba113
commit
23d8d59df8
|
@ -287,11 +287,21 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
|
||||||
(with-temp-file data-file
|
(with-temp-file data-file
|
||||||
(insert (let ((org-babel-gnuplot-timestamp-fmt
|
(insert (let ((org-babel-gnuplot-timestamp-fmt
|
||||||
(or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")))
|
(or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")))
|
||||||
(orgtbl-to-generic
|
(replace-regexp-in-string
|
||||||
table
|
;; org export backend adds "|" at the beginning/end of
|
||||||
(org-combine-plists
|
;; the table lines. Strip those.
|
||||||
'(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii)
|
"^|\\(.+\\)|$"
|
||||||
params)))))
|
"\\1"
|
||||||
|
(orgtbl-to-generic
|
||||||
|
table
|
||||||
|
(org-combine-plists
|
||||||
|
'( :sep "\t" :fmt org-babel-gnuplot-quote-tsv-field
|
||||||
|
;; Two setting below are needed to make :fmt work.
|
||||||
|
:raw t
|
||||||
|
;; Use `org', not `ascii' because `ascii' may
|
||||||
|
;; sometimes mishandle quoted strings.
|
||||||
|
:backend org)
|
||||||
|
params))))))
|
||||||
data-file)
|
data-file)
|
||||||
|
|
||||||
(provide 'ob-gnuplot)
|
(provide 'ob-gnuplot)
|
||||||
|
|
Loading…
Reference in New Issue