From f25baf9e1ea22e7c088941ecead10d53dbe4d897 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 18 Aug 2012 17:49:01 +0200 Subject: [PATCH] org-exp.el: Merge functions for removing tables and source blocks metalines * org-exp.el (org-export-handle-metalines): Rename from `org-export-handle-table-metalines'. Now also handle source block metalines. (org-export-res/src-name-cleanup): Delete. (org-export-preprocess-string): Use `org-export-handle-metalines'. Don't use `org-export-res/src-name-cleanup' anymore. This fixes a but reported by Feiming Chen, thanks to him. --- lisp/org-exp.el | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index bce73bd6b..db0febfd3 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1,4 +1,4 @@ -;;; org-exp.el --- ASCII, HTML, XOXO and iCalendar export for Org-mode +;;; org-exp.el --- Export internals for Org-mode ;; Copyright (C) 2004-2012 Free Software Foundation, Inc. @@ -1318,11 +1318,8 @@ on this string to produce the exported version." ;; Remove or replace comments (org-export-handle-comments (plist-get parameters :comments)) - ;; Remove #+TBLFM and #+TBLNAME lines - (org-export-handle-table-metalines) - - ;; Remove #+results and #+name lines - (org-export-res/src-name-cleanup) + ;; Remove #+TBLFM #+TBLNAME #+NAME #+RESULTS lines + (org-export-handle-metalines) ;; Run the final hook (run-hooks 'org-export-preprocess-final-hook) @@ -2009,9 +2006,11 @@ When it is nil, all comments will be removed." (replace-match "") (goto-char (max (point-min) (1- pos)))))))) -(defun org-export-handle-table-metalines () - "Remove table specific metalines #+TBLNAME: and #+TBLFM:." - (let ((re "^[ \t]*#\\+tbl\\(name\\|fm\\):\\(.*\n?\\)") +(defun org-export-handle-metalines () + "Remove tables and source blocks metalines. +This function should only be called after all block processing +has taken place." + (let ((re "^[ \t]*#\\+\\(tbl\\(?:name\\|fm\\)\\|results\\(?:\\[[a-z0-9]+\\]\\)?\\|name\\):\\(.*\n?\\)") (case-fold-search t) pos) (goto-char (point-min)) @@ -2024,18 +2023,6 @@ 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