Function: org-org-template

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

Signature

(org-org-template CONTENTS INFO)

Documentation

Return Org document template with document keywords.

CONTENTS is the transcoded contents string. INFO is a plist used as a communication channel.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-org.el.gz
(defun org-org-template (contents info)
  "Return Org document template with document keywords.
CONTENTS is the transcoded contents string.  INFO is a plist used
as a communication channel."
  (concat
   (and (plist-get info :time-stamp-file)
	(format-time-string "# Created %Y-%m-%d %a %H:%M\n"))
   (org-element-normalize-string
    (mapconcat #'identity
	       (org-element-map (plist-get info :parse-tree) 'keyword
		 (lambda (k)
		   (and (string-equal (org-element-property :key k) "OPTIONS")
			(concat "#+options: "
				(org-element-property :value k)))))
	       "\n"))
   (and (plist-get info :with-title)
	(format "#+title: %s\n" (org-export-data (plist-get info :title) info)))
   (and (plist-get info :with-date)
	(let ((date (org-export-data (org-export-get-date info) info)))
	  (and (org-string-nw-p date)
	       (format "#+date: %s\n" date))))
   (and (plist-get info :with-author)
	(let ((author (org-export-data (plist-get info :author) info)))
	  (and (org-string-nw-p author)
	       (format "#+author: %s\n" author))))
   (and (plist-get info :with-email)
	(let ((email (org-export-data (plist-get info :email) info)))
	  (and (org-string-nw-p email)
	       (format "#+email: %s\n" email))))
   (and (plist-get info :with-creator)
	(org-string-nw-p (plist-get info :creator))
	(format "#+creator: %s\n" (plist-get info :creator)))
   contents))