From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: [PATCH] orphaned captions and labels Date: Sat, 19 Jun 2010 20:19:17 +0200 Message-ID: <87ljaa997e.wl%n.goaziou@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sat_Jun_19_20:19:17_2010-1" Return-path: Received: from [140.186.70.92] (port=35196 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQ2dZ-0003L9-NA for emacs-orgmode@gnu.org; Sat, 19 Jun 2010 14:19:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQ2dY-0000mg-LZ for emacs-orgmode@gnu.org; Sat, 19 Jun 2010 14:19:25 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:37481) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQ2dY-0000mL-HZ for emacs-orgmode@gnu.org; Sat, 19 Jun 2010 14:19:24 -0400 Received: by wyf28 with SMTP id 28so1763660wyf.0 for ; Sat, 19 Jun 2010 11:19:22 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --Multipart_Sat_Jun_19_20:19:17_2010-1 Content-Type: text/plain; charset=US-ASCII Hello, This patch corrects the following problem : ----------------------------------------- #+caption: I'm not removed from export #+label: also-not-removed | A | B | | 1 | 2 | ----------------------------------------- Since org-handle-comments is only removing comments, #+caption, #+label and friends were left in the export file. Regards, -- Nicolas --Multipart_Sat_Jun_19_20:19:17_2010-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="0001-captions-labels-are-now-properly-cleaned-before-expo.patch" Content-Transfer-Encoding: 7bit >From 47bd77def15189e0a87af2b4fa66e9e8bd0d70c8 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 19 Jun 2010 20:07:50 +0200 Subject: [PATCH] captions, labels are now properly cleaned before export. * lisp/org-exp.el: captions, labels and others attributes are deleted at the right time, and no more as a side-effect during comments removal. --- lisp/org-exp.el | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 029e4d7..6a80cf0 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1108,8 +1108,8 @@ on this string to produce the exported version." (unless (plist-get parameters :timestamps) (org-export-remove-timestamps)) - ;; Attach captions to the correct object - (setq target-alist (org-export-attach-captions-and-attributes + ;; Attach captions to the correct object and removes them + (setq target-alist (org-export-handle-captions-and-attributes backend target-alist)) ;; Find matches for radio targets and turn them into internal links @@ -1576,10 +1576,12 @@ These special cookies will later be interpreted by the backend." (delete-region beg end) (insert (org-add-props content nil 'original-indentation ind)))))) -(defun org-export-attach-captions-and-attributes (backend target-alist) +(defun org-export-handle-captions-and-attributes (backend target-alist) "Move #+CAPTION, #+ATTR_BACKEND, and #+LABEL text into text properties. -If the next thing following is a table, add the text properties to the first -table line. If it is a link, add it to the line containing the link." +If the next thing following is a table, add the text properties +to the first table line. If it is a link, add it to the line +containing the link. #+CAPTION, #+ATTR_BACKEND and #+LABEL +lines are removed in the process." (goto-char (point-min)) (remove-text-properties (point-min) (point-max) '(org-caption nil org-attributes nil)) @@ -1597,11 +1599,17 @@ table line. If it is a link, add it to the line containing the link." (while (re-search-forward re nil t) (cond ((match-end 1) - (setq cap (concat cap (if cap " " "") (org-trim (match-string 1))))) + (progn + (setq cap (concat cap (if cap " " "") (org-trim (match-string 1)))) + (delete-region (point-at-bol) (point)))) ((match-end 2) - (setq attr (concat attr (if attr " " "") (org-trim (match-string 2))))) + (progn + (setq attr (concat attr (if attr " " "") (org-trim (match-string 2)))) + (delete-region (point-at-bol) (point)))) ((match-end 3) - (setq label (org-trim (match-string 3)))) + (progn + (setq label (org-trim (match-string 3))) + (delete-region (point-at-bol) (point)))) (t (setq end (if (match-end 4) (let ((ee (org-table-end))) -- 1.7.1 --Multipart_Sat_Jun_19_20:19:17_2010-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Multipart_Sat_Jun_19_20:19:17_2010-1--