Function: org-babel-gnuplot-table-to-data

org-babel-gnuplot-table-to-data is a byte-compiled function defined in ob-gnuplot.el.gz.

Signature

(org-babel-gnuplot-table-to-data TABLE DATA-FILE PARAMS)

Documentation

Export TABLE to DATA-FILE in a format readable by gnuplot.

Pass PARAMS through to orgtbl-to-generic when exporting TABLE.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-gnuplot.el.gz
(defun org-babel-gnuplot-table-to-data (table data-file params)
  "Export TABLE to DATA-FILE in a format readable by gnuplot.
Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
  (require 'ox-org)
  (require 'ox-ascii)
  (declare-function org-export-create-backend "ox")
  (with-temp-file data-file
    (insert (let ((org-babel-gnuplot-timestamp-fmt
		   (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S"))
                  ;; Create custom limited backend that will disable
                  ;; advanced ASCII export features that may alter the
                  ;; original data.
                  (ob-gnuplot-data
                   (org-export-create-backend
                    :parent 'ascii
                    :transcoders
                    `(;; Do not try to resolve links.  Export them verbatim.
                      (link . (lambda (link _ _) (org-element-interpret-data link)))
                      ;; Drop emphasis markers from verbatim and code.
                      ;; This way, data can use verbatim when escaping
                      ;; is necessary and yet be readable by Gnuplot,
                      ;; which is not aware about Org's markup.
                      (verbatim . (lambda (verbatim _ _) (org-element-property :value verbatim)))
                      (code . (lambda (code _ _) (org-element-property :value code)))))))
	      (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
                   :backend ,ob-gnuplot-data)
		params)))))
  data-file)