Nicolas Goaziou wrote:
>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.

Thanks for the patch.  Merely it wasn't catched by Org modes patch
tracker[1] so I include it in the reply.  Problem was, that you've
sent it as attachment of MIME media type application/binary, not
text/plain.

[1] http://patchwork.newartisans.com/project/org-mode/list/
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmj...@jabber.org
Email..... dm...@ictsoc.de
From 47bd77def15189e0a87af2b4fa66e9e8bd0d70c8 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaz...@gmail.com>
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

Attachment: pgpb1DywfBftt.pgp
Description: PGP signature

_______________________________________________
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

Reply via email to