Function: org-export--remove-uninterpreted-data

org-export--remove-uninterpreted-data is a byte-compiled function defined in ox.el.gz.

Signature

(org-export--remove-uninterpreted-data DATA INFO)

Documentation

Change uninterpreted elements back into Org syntax.

DATA is a parse tree or a secondary string. INFO is a plist containing export options. It is modified by side effect and returned by the function.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export--remove-uninterpreted-data (data info)
  "Change uninterpreted elements back into Org syntax.
DATA is a parse tree or a secondary string.  INFO is a plist
containing export options.  It is modified by side effect and
returned by the function."
  (org-element-map data
      '(entity bold italic latex-environment latex-fragment strike-through
	       subscript superscript underline)
    (lambda (datum)
      (let* ((type (org-element-type datum))
	     (post-blank
	      (pcase (org-element-property :post-blank datum)
		(`nil nil)
		(n (make-string n (if (eq type 'latex-environment) ?\n ?\s)))))
	     (new
	      (cl-case type
		;; ... entities...
		(entity
		 (and (not (plist-get info :with-entities))
		      (list (concat (org-export-expand datum nil)
				    post-blank))))
		;; ... emphasis...
		((bold italic strike-through underline)
		 (and (not (plist-get info :with-emphasize))
		      (let ((marker (cl-case type
				      (bold "*")
				      (italic "/")
				      (strike-through "+")
				      (underline "_"))))
			(append
			 (list marker)
			 (org-element-contents datum)
			 (list (concat marker post-blank))))))
		;; ... LaTeX environments and fragments...
		((latex-environment latex-fragment)
		 (and (eq (plist-get info :with-latex) 'verbatim)
		      (list (concat (org-export-expand datum nil)
				    post-blank))))
		;; ... sub/superscripts...
		((subscript superscript)
		 (let ((sub/super-p (plist-get info :with-sub-superscript))
		       (bracketp (org-element-property :use-brackets-p datum)))
		   (and (or (not sub/super-p)
			    (and (eq sub/super-p '{}) (not bracketp)))
			(append
			 (list (concat (if (eq type 'subscript) "_" "^")
				       (and bracketp "{")))
			 (org-element-contents datum)
			 (list (concat (and bracketp "}")
				       post-blank)))))))))
	(when new
	  ;; Splice NEW at DATUM location in parse tree.
	  (dolist (e new (org-element-extract-element datum))
	    (unless (equal e "") (org-element-insert-before e datum))))))
    info nil nil t)
  ;; Return modified parse tree.
  data)