Function: org-export--get-subtree-options

org-export--get-subtree-options is a byte-compiled function defined in ox.el.gz.

Signature

(org-export--get-subtree-options &optional BACKEND)

Documentation

Get export options in subtree at point.

Optional argument BACKEND is an export backend, as returned by, e.g., org-export-create-backend. It specifies backend used for export. Return options as a plist.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export--get-subtree-options (&optional backend)
  "Get export options in subtree at point.
Optional argument BACKEND is an export backend, as returned by,
e.g., `org-export-create-backend'.  It specifies backend used
for export.  Return options as a plist."
  ;; For each buffer keyword, create a headline property setting the
  ;; same property in communication channel.  The name for the
  ;; property is the keyword with "EXPORT_" appended to it.
  (org-with-wide-buffer
   ;; Make sure point is at a heading.
   (org-back-to-heading t)
   (let ((plist
	  ;; EXPORT_OPTIONS are parsed in a non-standard way.  Take
	  ;; care of them right from the start.
	  (let ((o (org-entry-get (point) "EXPORT_OPTIONS" 'selective)))
	    (and o (org-export--parse-option-keyword o backend))))
	 ;; Take care of EXPORT_TITLE.  If it isn't defined, use
	 ;; headline's title (with no todo keyword, priority cookie or
	 ;; tag) as its fallback value.
	 (cache (list
		 (cons "TITLE"
		       (or (org-entry-get (point) "EXPORT_TITLE" 'selective)
			   (let ((case-fold-search nil))
			     (looking-at org-complex-heading-regexp)
			     (match-string-no-properties 4))))))
	 ;; Look for both general keywords and backend specific
	 ;; options, with priority given to the latter.
	 (options (append (org-export-get-all-options backend)
			  org-export-options-alist)))
     ;; Handle other keywords.  Then return PLIST.
     (dolist (option options plist)
       (let ((property (car option))
	     (keyword (nth 1 option)))
	 (when keyword
	   (let ((value
		  (or (cdr (assoc keyword cache))
		      (let ((v (org-entry-get (point)
					      (concat "EXPORT_" keyword)
					      'selective)))
			(push (cons keyword v) cache) v))))
	     (when value
	       (setq plist
		     (plist-put plist
				property
				(cl-case (nth 4 option)
				  (parse
				   (org-element-parse-secondary-string
				    value (org-element-restriction 'keyword)))
				  (split (split-string value))
				  (t value))))))))))))