Function: org-export--annotate-info

org-export--annotate-info is a byte-compiled function defined in ox.el.gz.

Signature

(org-export--annotate-info BACKEND INFO &optional SUBTREEP VISIBLE-ONLY EXT-PLIST)

Documentation

Annotate the INFO plist according to the BACKEND.

This is run in the context of the current buffer.

When optional argument SUBTREEP is non-nil, transcode the sub-tree at point, extracting information from the headline properties first.

When optional argument VISIBLE-ONLY is non-nil, don't process the contents of hidden elements.

Optional argument EXT-PLIST, when provided, is a property list with external parameters overriding Org default settings, but still inferior to file-local settings.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export--annotate-info (backend info &optional subtreep visible-only ext-plist)
  "Annotate the INFO plist according to the BACKEND.

This is run in the context of the current buffer.

When optional argument SUBTREEP is non-nil, transcode the
sub-tree at point, extracting information from the headline
properties first.

When optional argument VISIBLE-ONLY is non-nil, don't process the
contents of hidden elements.

Optional argument EXT-PLIST, when provided, is a property list
with external parameters overriding Org default settings, but
still inferior to file-local settings."
  (let ((parsed-keywords
         (delq nil
               (mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
                       (append (org-export-get-all-options backend)
                               org-export-options-alist))))
        tree modified-tick)
    ;; Run first hook with current backend's name as argument.
    (run-hook-with-args 'org-export-before-processing-hook
                        (org-export-backend-name backend))
    (org-export-expand-include-keyword nil nil nil nil (plist-get info :expand-links))
    (org-export--delete-comment-trees)
    (org-macro-initialize-templates org-export-global-macros)
    (org-macro-replace-all org-macro-templates parsed-keywords)
    ;; Refresh buffer properties and radio targets after previous
    ;; potentially invasive changes.
    (org-set-regexps-and-options)
    (org-update-radio-target-regexp)
    (setq modified-tick (buffer-chars-modified-tick))
    ;;  Possibly execute Babel code.  Re-run a macro expansion
    ;;  specifically for {{{results}}} since inline source blocks
    ;;  may have generated some more.  Refresh buffer properties
    ;;  and radio targets another time.
    (when org-export-use-babel
      (org-babel-exp-process-buffer)
      (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
      (unless (eq modified-tick (buffer-chars-modified-tick))
        (org-set-regexps-and-options)
        (org-update-radio-target-regexp))
      (setq modified-tick (buffer-chars-modified-tick)))
    ;; Run last hook with current backend's name as argument.
    ;; Update buffer properties and radio targets one last time
    ;; before parsing.
    (goto-char (point-min))
    (save-excursion
      (run-hook-with-args 'org-export-before-parsing-hook
                          (org-export-backend-name backend)))
    (unless (eq modified-tick (buffer-chars-modified-tick))
      (org-set-regexps-and-options)
      (org-update-radio-target-regexp))
    (setq modified-tick (buffer-chars-modified-tick))
    ;; Update communication channel with environment.
    (setq info
          (org-combine-plists
           info (org-export-get-environment backend subtreep ext-plist)))
    ;; Pre-process citations environment, i.e. install
    ;; bibliography list, and citation processor in INFO.
    (when (plist-get info :with-cite-processors)
      (org-cite-store-bibliography info)
      (org-cite-store-export-processor info))
    ;; De-activate uninterpreted data from parsed keywords.
    (dolist (entry (append (org-export-get-all-options backend)
                           org-export-options-alist))
      (pcase entry
        (`(,p ,_ ,_ ,_ parse)
         (let ((value (plist-get info p)))
           (plist-put info
                      p
                      (org-export--remove-uninterpreted-data value info))))
        (_ nil)))
    ;; Install user's and developer's filters.
    (setq info (org-export-install-filters info))
    ;; Call options filters and update export options.  We do not
    ;; use `org-export-filter-apply-functions' here since the
    ;; arity of such filters is different.
    (let ((backend-name (org-export-backend-name backend)))
      (dolist (filter (plist-get info :filter-options))
        (let ((result (funcall filter info backend-name)))
          (when result (setq info result)))))
    ;; Parse buffer.
    (setq tree (org-element-parse-buffer nil visible-only 'defer))
    ;; Prune tree from non-exported elements and transform
    ;; uninterpreted elements or objects in both parse tree and
    ;; communication channel.
    (org-export--prune-tree tree info)
    (org-export--remove-uninterpreted-data tree info)
    ;; Expand environment variables in link paths.
    (org-export--expand-links tree info)
    ;; Call parse tree filters.
    (setq tree
          (org-export-filter-apply-functions
           (plist-get info :filter-parse-tree) tree info))
    ;; Now tree is complete, compute its properties and add them
    ;; to communication channel.  This is responsible for setting
    ;; :parse-tree to TREE.
    (setq info (org-export--collect-tree-properties tree info))
    ;; Process citations and bibliography.  Replace each citation
    ;; and "print_bibliography" keyword in the parse tree with
    ;; the output of the selected citation export processor.
    (when (plist-get info :with-cite-processors)
      (org-cite-process-citations info)
      (org-cite-process-bibliography info))
    info))