From: David Maus <dmaus@ictsoc.de>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] orphaned captions and labels
Date: Thu, 24 Jun 2010 16:26:28 +0200 [thread overview]
Message-ID: <87tyosqzfv.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <87ljaa997e.wl%n.goaziou@gmail.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 732 bytes --]
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.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.1.2: 0001-captions-labels-are-now-properly-cleaned-before-expo.patch --]
[-- Type: text/plain, Size: 2868 bytes --]
From 47bd77def15189e0a87af2b4fa66e9e8bd0d70c8 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@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 #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
next prev parent reply other threads:[~2010-06-24 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-19 18:19 [PATCH] orphaned captions and labels Nicolas Goaziou
2010-06-24 14:26 ` David Maus [this message]
2010-06-24 19:18 ` Sebastian Rose
2010-06-29 12:55 ` Sebastian Rose
2010-06-30 10:32 ` [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff Nicolas Goaziou
2010-06-30 12:16 ` Sebastian Rose
2010-06-30 13:18 ` [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff (v.2) Nicolas Goaziou
2010-06-30 13:53 ` Sebastian Rose
2010-06-30 10:55 ` [PATCH] orphaned captions and labels Nicolas Goaziou
2010-07-02 15:12 ` David Maus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tyosqzfv.wl%dmaus@ictsoc.de \
--to=dmaus@ictsoc.de \
--cc=emacs-orgmode@gnu.org \
--cc=n.goaziou@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).