Function: org-export--collect-tree-properties

org-export--collect-tree-properties is a byte-compiled function defined in ox.el.gz.

Signature

(org-export--collect-tree-properties DATA INFO)

Documentation

Extract tree properties from parse tree.

DATA is the parse tree from which information is retrieved. INFO is a list holding export options.

Following tree properties are set or updated:

:parse-tree Is simply set to DATA.
:headline-offset Offset between true level of headlines and
local level. An offset of -1 means a headline
of level 2 should be considered as a level
1 headline in the context.

:headline-numbering Alist of all headlines as key and the
associated numbering as value.

:id-alist Alist of all ID references as key and associated file
            as value.

Return updated plist.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
;;;; Tree Properties
;;
;; Tree properties are information extracted from parse tree.  They
;; are initialized at the beginning of the transcoding process by
;; `org-export--collect-tree-properties'.
;;
;; Dedicated functions focus on computing the value of specific tree
;; properties during initialization.  Thus, `org-export--prune-tree'
;; lists elements and objects that should be skipped during export,
;; `org-export--get-min-level' gets the minimal exportable level, used
;; as a basis to compute relative level for headlines.  Eventually
;; `org-export--collect-headline-numbering' builds an alist between
;; headlines and their numbering.

(defun org-export--collect-tree-properties (data info)
  "Extract tree properties from parse tree.

DATA is the parse tree from which information is retrieved.  INFO
is a list holding export options.

Following tree properties are set or updated:

`:parse-tree' Is simply set to DATA.
`:headline-offset' Offset between true level of headlines and
		   local level.  An offset of -1 means a headline
		   of level 2 should be considered as a level
		   1 headline in the context.

`:headline-numbering' Alist of all headlines as key and the
		      associated numbering as value.

`:id-alist' Alist of all ID references as key and associated file
            as value.

Return updated plist."
  ;; Install the parse tree in the communication channel.
  (setq info (plist-put info :parse-tree data))
  ;; Compute `:headline-offset' in order to be able to use
  ;; `org-export-get-relative-level'.
  (setq info
	(plist-put info
		   :headline-offset
		   (- 1 (org-export--get-min-level data info))))
  ;; From now on, properties order doesn't matter: get the rest of the
  ;; tree properties.
  (org-combine-plists
   info
   (list :headline-numbering (org-export--collect-headline-numbering data info)
	 :id-alist
	 (org-element-map data 'link
	   (lambda (l)
	     (and (string= (org-element-property :type l) "id")
		  (let* ((id (org-element-property :path l))
			 (file (car (org-id-find id))))
		    (and file (cons id (file-relative-name file))))))))))