From c0a779bd9d6488d50cd9fa5271baebca8aa4ff9f Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 26 Nov 2008 07:32:10 +0100 Subject: [PATCH] Fix bug with handling of targets in ASCII export. Target text used to disappear, now it is kept as it should be. --- lisp/ChangeLog | 7 +++++++ lisp/org-exp.el | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 570824372..99ef7433b 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-11-26 Carsten Dominik + + * org-exp.el (org-export-as-ascii): Remove the handling of + targets. + (org-export-ascii-preprocess): Handle targets already in this + function. + 2008-11-25 Carsten Dominik * org-timer.el (org-timer-start-time): Define this variable. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index ceeca8402..9ca094899 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2397,10 +2397,7 @@ underlined headlines. The default is 3." (while (setq line (pop lines)) ;; Remove the quoted HTML tags. (setq line (org-html-expand-for-ascii line)) - ;; Remove targets - (while (string-match "<<]*>>>?[ \t]*\n?" line) - (setq line (replace-match "" t t line))) - ;; Replace internal links + ;; Replace links with the description when possible (while (string-match org-bracket-link-regexp line) (setq line (replace-match (if (match-end 3) "[\\3]" "[\\1]") @@ -2483,13 +2480,18 @@ underlined headlines. The default is 3." (defun org-export-ascii-preprocess () "Do extra work for ASCII export" + ;; Put quotes around verbatim text (goto-char (point-min)) (while (re-search-forward org-verbatim-re nil t) (goto-char (match-end 2)) (backward-delete-char 1) (insert "'") (goto-char (match-beginning 2)) (delete-char 1) (insert "`") - (goto-char (match-end 2)))) + (goto-char (match-end 2))) + (goto-char (point-min)) + ;; Remove target markers + (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) + (replace-match "\\1\\2"))) (defun org-search-todo-below (line lines level) "Search the subtree below LINE for any TODO entries."