初稿: 2018-08-02 Thu 09:03
最終更新日: 2018-12-14 Fri 20:44
ホーム | 文書トップ | 目次

org-publish-org-to
どんなファイルにエクスポートするか

 1: (defun org-publish-org-to (backend filename extension plist &optional pub-dir)
 2:   "Publish an Org file to a specified back-end.
 3: 
 4: BACKEND is a symbol representing the back-end used for
 5: transcoding.  FILENAME is the filename of the Org file to be
 6: published.  EXTENSION is the extension used for the output
 7: string, with the leading dot.  PLIST is the property list for the
 8: given project.
 9: 
10: Optional argument PUB-DIR, when non-nil is the publishing
11: directory.
12: 
13: Return output file name."
14:   (unless (or (not pub-dir) (file-exists-p pub-dir)) (make-directory pub-dir t))
15:   ;; Check if a buffer visiting FILENAME is already open.
16:   (let* ((org-inhibit-startup t)
17:          (visiting (find-buffer-visiting filename))
18:          (work-buffer (or visiting (find-file-noselect filename))))
19:     (unwind-protect
20:         (with-current-buffer work-buffer
21:           (let ((output (org-export-output-file-name extension nil pub-dir)))
22:             (org-export-to-file backend output
23:               nil nil nil (plist-get plist :body-only)
24:               ;; Add `org-publish--store-crossrefs' and
25:               ;; `org-publish-collect-index' to final output filters.
26:               ;; The latter isn't dependent on `:makeindex', since we
27:               ;; want to keep it up-to-date in cache anyway.
28:               (org-combine-plists
29:                plist
30:                `(:crossrefs
31:                  ,(org-publish-cache-get-file-property
32:                    ;; Normalize file names in cache.
33:                    (file-truename filename) :crossrefs nil t)
34:                  :filter-final-output
35:                  (org-publish--store-crossrefs
36:                   org-publish-collect-index
37:                   ,@(plist-get plist :filter-final-output)))))))
38:       ;; Remove opened buffer in the process.
39:       (unless visiting (kill-buffer work-buffer)))))

日付: 2018-08-02 Thu 09:03

著者: conao

Created: 2018-12-14 Fri 21:04

Validate