Function: org-export--blindly-expand-include
org-export--blindly-expand-include is a byte-compiled function defined
in ox.el.gz.
Signature
(org-export--blindly-expand-include PARAMETERS &key INCLUDER-FILE FILE-PREFIX FOOTNOTES ALREADY-INCLUDED EXPAND-ENV)
Documentation
Unconditionally include reference defined by PARAMETERS in the buffer.
PARAMETERS is a plist of the form returned by org-export-parse-include-value.
INCLUDER-FILE is a path to the file where the include keyword is being expanded. FILE-PREFIX is a hash-table of file and prefixes, which can be provided to ensure consistent prefixing. FOOTNOTES is a hash-table for storing and resolving footnotes, which when provided allows footnotes to be handled appropriately. ALREADY-INCLUDED is a list of included names along with their line restriction which prevents recursion. EXPAND-ENV is a flag to expand environment variables for #+INCLUDE keywords in the included file.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(cl-defun org-export--blindly-expand-include
(parameters
&key includer-file file-prefix footnotes already-included expand-env)
"Unconditionally include reference defined by PARAMETERS in the buffer.
PARAMETERS is a plist of the form returned by `org-export-parse-include-value'.
INCLUDER-FILE is a path to the file where the include keyword is
being expanded. FILE-PREFIX is a hash-table of file and
prefixes, which can be provided to ensure consistent prefixing.
FOOTNOTES is a hash-table for storing and resolving footnotes,
which when provided allows footnotes to be handled appropriately.
ALREADY-INCLUDED is a list of included names along with their
line restriction which prevents recursion. EXPAND-ENV is a flag to
expand environment variables for #+INCLUDE keywords in the included
file."
(let* ((coding-system-for-read
(or (plist-get parameters :coding-system)
coding-system-for-read))
(file (plist-get parameters :file))
(lines (plist-get parameters :lines))
(args (plist-get parameters :args))
(block (plist-get parameters :block))
(ind (org-current-text-indentation)))
(cond
((eq (plist-get parameters :env) 'literal)
(insert
(let ((ind-str (make-string ind ?\s))
(arg-str (if (stringp args) (format " %s" args) ""))
(contents
(org-escape-code-in-string
(org-export--prepare-file-contents file lines))))
(format "%s#+BEGIN_%s%s\n%s%s#+END_%s\n"
ind-str block arg-str contents ind-str block))))
((stringp block)
(insert
(let ((ind-str (make-string ind ?\s))
(contents
(org-export--prepare-file-contents file lines)))
(format "%s#+BEGIN_%s\n%s%s#+END_%s\n"
ind-str block contents ind-str block))))
(t
(insert
(with-temp-buffer
(let ((org-inhibit-startup t)
(lines
(if-let ((location (plist-get parameters :location)))
(org-export--inclusion-absolute-lines
file location
(plist-get parameters :only-contents)
lines)
lines)))
(org-mode)
(insert
(org-export--prepare-file-contents
file lines ind (plist-get parameters :minlevel)
(and file-prefix
(or (gethash file file-prefix)
(puthash file
(hash-table-count file-prefix)
file-prefix)))
footnotes includer-file)))
(org-export-expand-include-keyword
(cons (list file lines) already-included)
(unless (org-url-p file)
(file-name-directory file))
footnotes includer-file expand-env)
(buffer-string)))))))