Function: org-publish-org-to

org-publish-org-to is a byte-compiled function defined in ox-publish.el.gz.

Signature

(org-publish-org-to BACKEND FILENAME EXTENSION PLIST &optional PUB-DIR)

Documentation

Publish an Org file to a specified backend.

BACKEND is a symbol representing the backend used for transcoding. FILENAME is the filename of the Org file to be published. EXTENSION is the extension used for the output string, with the leading dot. PLIST is the property list for the given project.

Optional argument PUB-DIR, when non-nil is the publishing directory.

Return output file name.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-publish.el.gz
;;; Tools for publishing functions in backends

(defun org-publish-org-to (backend filename extension plist &optional pub-dir)
  "Publish an Org file to a specified backend.

BACKEND is a symbol representing the backend used for
transcoding.  FILENAME is the filename of the Org file to be
published.  EXTENSION is the extension used for the output
string, with the leading dot.  PLIST is the property list for the
given project.

Optional argument PUB-DIR, when non-nil is the publishing
directory.

Return output file name."
  (unless (or (not pub-dir) (file-exists-p pub-dir)) (make-directory pub-dir t))
  ;; Check if a buffer visiting FILENAME is already open.
  (let* ((org-inhibit-startup t))
    (org-with-file-buffer filename
      (let ((output (org-export-output-file-name extension nil pub-dir)))
	(org-export-to-file backend output
	  nil nil nil (plist-get plist :body-only)
	  ;; Add `org-publish--store-crossrefs' and
	  ;; `org-publish-collect-index' to final output filters.
	  ;; The latter isn't dependent on `:makeindex', since we
	  ;; want to keep it up-to-date in cache anyway.
	  (org-combine-plists
	   plist
	   `(:crossrefs
	     ,(org-publish-cache-get-file-property
	       ;; Normalize file names in cache.
	       (file-truename filename) :crossrefs nil t)
	     :filter-final-output
	     (org-publish--store-crossrefs
	      org-publish-collect-index
	      ,@(plist-get plist :filter-final-output)))))))))