Browse Source

org-export: Cleanup #+name and #+results

* lisp/org-exp.el (org-export-res/src-name-cleanup): Remove #+name and
  #+results lines during preprocess.

Now Babel doesn't handle anymore those keywords cleanup (as #+name may
be used for other thing than code evaluation), that task is moved to
org-export.el.  See commit 25a0a0212193ecc5e910696301b3a64a51f837e0.
Nicolas Goaziou 13 years ago
parent
commit
7e49b85c56
1 changed files with 15 additions and 0 deletions
  1. 15 0
      lisp/org-exp.el

+ 15 - 0
lisp/org-exp.el

@@ -1283,6 +1283,9 @@ on this string to produce the exported version."
       ;; Remove #+TBLFM and #+TBLNAME lines
       (org-export-handle-table-metalines)
 
+      ;; Remove #+results and #+name lines
+      (org-export-res/src-name-cleanup)
+
       ;; Run the final hook
       (run-hooks 'org-export-preprocess-final-hook)
 
@@ -1992,6 +1995,18 @@ When it is nil, all comments will be removed."
 	(replace-match "")
 	(goto-char (max (point-min) (1- pos)))))))
 
+(defun org-export-res/src-name-cleanup ()
+  "Clean up #+results and #+name lines for export.
+This function should only be called after all block processing
+has taken place."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((case-fold-search t))
+      (while (org-re-search-forward-unprotected
+	      "#\\+\\(name\\|results\\(\\[[a-z0-9]+\\]\\)?\\):" nil t)
+	(delete-region (match-beginning 0) (progn (forward-line) (point)))))))
+
 (defun org-export-mark-radio-links ()
   "Find all matches for radio targets and turn them into internal links."
   (let ((re-radio (and org-target-link-regexp