emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] orphaned captions and labels
@ 2010-06-19 18:19 Nicolas Goaziou
  2010-06-24 14:26 ` David Maus
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2010-06-19 18:19 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

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


[-- Attachment #2: 0001-captions-labels-are-now-properly-cleaned-before-expo.patch --]
[-- Type: application/octet-stream, 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 #3: 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] orphaned captions and labels
  2010-06-19 18:19 [PATCH] orphaned captions and labels Nicolas Goaziou
@ 2010-06-24 14:26 ` David Maus
  2010-06-24 19:18   ` Sebastian Rose
  2010-06-30 10:55   ` [PATCH] orphaned captions and labels Nicolas Goaziou
  0 siblings, 2 replies; 10+ messages in thread
From: David Maus @ 2010-06-24 14:26 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List


[-- 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] orphaned captions and labels
  2010-06-24 14:26 ` David Maus
@ 2010-06-24 19:18   ` Sebastian Rose
  2010-06-29 12:55     ` Sebastian Rose
  2010-06-30 10:55   ` [PATCH] orphaned captions and labels Nicolas Goaziou
  1 sibling, 1 reply; 10+ messages in thread
From: Sebastian Rose @ 2010-06-24 19:18 UTC (permalink / raw)
  To: David Maus; +Cc: Org Mode List, Nicolas Goaziou

Hi David and Nicolas,


I didn't follow this thread closely, so forgive me if this is another
bug then the one you tried to fix.


David Maus <dmaus@ictsoc.de> writes:
> 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.


Some still are.

I applied the patch, but my "#+ATTR_HTML:" lines are not removed from
ASCII export if they occur on a line with leading spaces.

This might be true for other backends, too.


Try to export this as ASCII:

=> --->8-------------------------->8-------------------------->8---

* Example

#+ATTR_HTML: I am removed from ASCII export
  | THead 1 | THead 2 |

  #+ATTR_HTML: I am _NOT_ removed from ASCII export
  | THead 1 | THead 2 |

#+CAPTION: removed
  #+ATTR_HTML: NOT removed
  | THead 1 | THead 2 |

  #+CAPTION: removed
#+ATTR_HTML: removed
  | THead 1 | THead 2 |

<= ---8<--------------------------8<--------------------------8<---


Leading space make the difference. Somtimes.

Here is the result:


=> --->8----------------------------->8----------------------------->8---
1 Example 
~~~~~~~~~~

    THead 1   THead 2  

  #+ATTR_HTML: I am NOT removed from ASCII export
    THead 1   THead 2  


  #+ATTR_HTML: NOT removed
    THead 1   THead 2  


    THead 1   THead 2  

<= ---8<-----------------------------8<-----------------------------8<---




  Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] orphaned captions and labels
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Rose @ 2010-06-29 12:55 UTC (permalink / raw)
  To: David Maus; +Cc: Nicolas Goaziou, Org Mode List

Sebastian Rose <sebastian_rose@gmx.de> writes:
> Hi David and Nicolas,
>
>
> I didn't follow this thread closely, so forgive me if this is another
> bug then the one you tried to fix.
>
>
> David Maus <dmaus@ictsoc.de> writes:
>> 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.
>
>
> Some still are.
>
> I applied the patch, but my "#+ATTR_HTML:" lines are not removed from
> ASCII export if they occur on a line with leading spaces.
>
> This might be true for other backends, too.
>
>
> Try to export this as ASCII:
>
> => --->8-------------------------->8-------------------------->8---
>
> * Example
>
> #+ATTR_HTML: I am removed from ASCII export
>   | THead 1 | THead 2 |
>
>   #+ATTR_HTML: I am _NOT_ removed from ASCII export
>   | THead 1 | THead 2 |
>
> #+CAPTION: removed
>   #+ATTR_HTML: NOT removed
>   | THead 1 | THead 2 |
>
>   #+CAPTION: removed
> #+ATTR_HTML: removed
>   | THead 1 | THead 2 |
>
> <= ---8<--------------------------8<--------------------------8<---
>
>
> Leading space make the difference. Somtimes.
>
> Here is the result:
>
>
> => --->8----------------------------->8----------------------------->8---
> 1 Example 
> ~~~~~~~~~~
>
>     THead 1   THead 2  
>
>   #+ATTR_HTML: I am NOT removed from ASCII export
>     THead 1   THead 2  
>
>
>   #+ATTR_HTML: NOT removed
>     THead 1   THead 2  
>
>
>     THead 1   THead 2  
>
> <= ---8<-----------------------------8<-----------------------------8<---
>
>
>
>
>   Sebastian




What's the status of this?



  Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff
  2010-06-29 12:55     ` Sebastian Rose
@ 2010-06-30 10:32       ` Nicolas Goaziou
  2010-06-30 12:16         ` Sebastian Rose
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2010-06-30 10:32 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 138 bytes --]

Hello,
>>>>> Sebastian Rose writes:
> What's the status of this?

What about the following patch ? I think it should fix it.

-- Nicolas


[-- Attachment #2: 0001-Remove-unwanted-ATTR_Backend-and-Backend-during-expo.patch --]
[-- Type: text/plain, Size: 1995 bytes --]

From 115a7e9d04fd5463913e1086ad3ff807ae579e16 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Wed, 30 Jun 2010 12:28:32 +0200
Subject: [PATCH] Remove unwanted #+ATTR_Backend and #+Backend during export.

* lisp/org-exp.el: (org-export-select-backend-specific-text) Properly
  get rid of #+Backend and #+ATTR_Backend specifics to backends not
  matching the one we're exporting to.
---
 lisp/org-exp.el |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 54afdac..578e0cf 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1526,15 +1526,27 @@ from the buffer."
 
     (while formatters
       (setq fmt (pop formatters))
-      (when (eq (car fmt) backend)
-	;; This is selected code, put it into the file for real
-	(goto-char (point-min))
-	(while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
-					  ":[ \t]*\\(.*\\)") nil t)
+      ;; Handle #+Backend: stuff
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
+					":[ \t]*\\(.*\\)") nil t)
+	(if (not (eq (car fmt) backend))
+	    (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
+	  (replace-match "\\1\\2" t)
+	  (add-text-properties
+	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
+	   '(org-protected t))))
+      ;; Handle #+attr_Backend: stuff
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt)
+					":[ \t]*\\(.*\\)") nil t)
+	(if (not (eq (car fmt) backend))
+	    (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
 	  (replace-match "\\1\\2" t)
 	  (add-text-properties
 	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
 	   '(org-protected t))))
+      ;; Handle #+begin_Backend and #+end_Backend stuff
       (goto-char (point-min))
       (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
 				nil t)
-- 
1.7.1


[-- Attachment #3: 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] orphaned captions and labels
  2010-06-24 14:26 ` David Maus
  2010-06-24 19:18   ` Sebastian Rose
@ 2010-06-30 10:55   ` Nicolas Goaziou
  2010-07-02 15:12     ` David Maus
  1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2010-06-30 10:55 UTC (permalink / raw)
  To: David Maus; +Cc: Org Mode List

Hello,

>>>>> David Maus writes:
> 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.

Speaking of this, what is the status of this patch ? It isn't applied
on master branch and I don't see it in the patch tracker.

Regards,

-- Nicolas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Rose @ 2010-06-30 12:16 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Hello,
>>>>>> Sebastian Rose writes:
>> What's the status of this?
>
> What about the following patch ? I think it should fix it.
>
> -- Nicolas
>
>
>From 115a7e9d04fd5463913e1086ad3ff807ae579e16 Mon Sep 17 00:00:00 2001
> From: Nicolas Goaziou <n.goaziou@gmail.com>
> Date: Wed, 30 Jun 2010 12:28:32 +0200
> Subject: [PATCH] Remove unwanted #+ATTR_Backend and #+Backend during export.
>
> * lisp/org-exp.el: (org-export-select-backend-specific-text) Properly
>   get rid of #+Backend and #+ATTR_Backend specifics to backends not
>   matching the one we're exporting to.
> ---
>  lisp/org-exp.el |   22 +++++++++++++++++-----
>  1 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/org-exp.el b/lisp/org-exp.el
> index 54afdac..578e0cf 100644
> --- a/lisp/org-exp.el
> +++ b/lisp/org-exp.el
> @@ -1526,15 +1526,27 @@ from the buffer."
>  
>      (while formatters
>        (setq fmt (pop formatters))
> -      (when (eq (car fmt) backend)
> -	;; This is selected code, put it into the file for real
> -	(goto-char (point-min))
> -	(while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
> -					  ":[ \t]*\\(.*\\)") nil t)
> +      ;; Handle #+Backend: stuff
> +      (goto-char (point-min))
> +      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
> +					":[ \t]*\\(.*\\)") nil t)
> +	(if (not (eq (car fmt) backend))
> +	    (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
> +	  (replace-match "\\1\\2" t)
> +	  (add-text-properties
> +	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
> +	   '(org-protected t))))
> +      ;; Handle #+attr_Backend: stuff
> +      (goto-char (point-min))
> +      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt)
> +					":[ \t]*\\(.*\\)") nil t)
> +	(if (not (eq (car fmt) backend))
> +	    (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
>  	  (replace-match "\\1\\2" t)
>  	  (add-text-properties
>  	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
>  	   '(org-protected t))))
> +      ;; Handle #+begin_Backend and #+end_Backend stuff
>        (goto-char (point-min))
>        (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
>  				nil t)


Ahhh - it nearly does!

But look at this:

 --8<---------------cut here---------------start------------->8--
         *Tempolauf*
        #+ATTR_HTML: style="margin-left:auto;margin-right:auto;text-align:center;"
 |  Z | Station          | Meter | Etappe |  Zeit |  Rnd. | Pace Rnd. | Pace |
 |----+------------------+-------+--------+-------+-------+-----------+------|
 --8<---------------cut here---------------end--------------->8--

Becomes:

 --8<---------------cut here---------------start------------->8--
<b>Tempolauf</b>
        style="margin-left:auto;margin-right:auto;text-align:center;"
</p><table border="0" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
 --8<---------------cut here---------------end--------------->8--
 

The `style...' part must be trimmed and go inside the `<table>' tag.






Also, in this test:

 --8<---------------cut here---------------start------------->8--
 
* Example

#+ATTR_HTML: I am removed from ASCII export
  | THead 1 | THead 2 |

  #+ATTR_HTML: I am _NOT_ removed from ASCII export
  | THead 1 | THead 2 |

#+CAPTION: removed
  #+ATTR_HTML: NOT removed
  | THead 1 | THead 2 |

  #+CAPTION: removed
#+ATTR_HTML: removed
  | THead 1 | THead 2 |
 --8<---------------cut here---------------end--------------->8--
 

the second last `#+CAPTION: removed' is NOT removed.



  Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff (v.2)
  2010-06-30 12:16         ` Sebastian Rose
@ 2010-06-30 13:18           ` Nicolas Goaziou
  2010-06-30 13:53             ` Sebastian Rose
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2010-06-30 13:18 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

>>>>> Sebastian Rose writes:
> Ahhh - it nearly does!

> But look at this:

>  --8<---------------cut here---------------start------------->8--
>          *Tempolauf*
>         #+ATTR_HTML: style="margin-left:auto;margin-right:auto;text-align:center;"
>  |  Z | Station          | Meter | Etappe |  Zeit |  Rnd. | Pace Rnd. | Pace |
>  |----+------------------+-------+--------+-------+-------+-----------+------|
>  --8<---------------cut here---------------end--------------->8--

> Becomes:

>  --8<---------------cut here---------------start------------->8--
> <b>Tempolauf</b>
>         style="margin-left:auto;margin-right:auto;text-align:center;"
> </p><table border="0" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
>  --8<---------------cut here---------------end--------------->8--

> The `style...' part must be trimmed and go inside the `<table>' tag.

Yes, my patch was a bit aggressive. See my next try.


> Also, in this test:
> [...]
> the second last `#+CAPTION: removed' is NOT removed.

That, my first patch about captions should have taken care of it.

Here is another try on this one. Please tell me if it is working. It
contains both fixes (captions and attr) so there shouldn't be the need
of a previous patch.

Regards,

-- Nicolas


[-- Attachment #2: 0001-Remove-unwanted-ATTR_Backend-and-Backend-during-expo.patch --]
[-- Type: text/plain, Size: 2941 bytes --]

From 76840002404838757a6a31bbfb1e2bdc2564045a Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Wed, 30 Jun 2010 12:28:32 +0200
Subject: [PATCH] Remove unwanted #+ATTR_Backend and #+Backend during export.

* lisp/org-exp.el: (org-export-select-backend-specific-text) Properly
  get rid of #+Backend and #+ATTR_Backend specifics to backends not
  matching the one we're exporting to.
---
 lisp/org-exp.el |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 54afdac..d7a9e19 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1526,15 +1526,25 @@ from the buffer."
 
     (while formatters
       (setq fmt (pop formatters))
-      (when (eq (car fmt) backend)
-	;; This is selected code, put it into the file for real
-	(goto-char (point-min))
-	(while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
-					  ":[ \t]*\\(.*\\)") nil t)
+      ;; Handle #+Backend: stuff
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
+					":[ \t]*\\(.*\\)") nil t)
+	(if (not (eq (car fmt) backend))
+	    (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
 	  (replace-match "\\1\\2" t)
 	  (add-text-properties
 	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
 	   '(org-protected t))))
+      ;; Delete #+attr_Backend: stuff of another backend. Those
+      ;; matching the current backend will be taken care of by
+      ;; `org-export-attach-captions-and-attributes'
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt)
+					":[ \t]*\\(.*\\)") nil t)
+	(when (not (eq (car fmt) backend))
+	  (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
+      ;; Handle #+begin_Backend and #+end_Backend stuff
       (goto-char (point-min))
       (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
 				nil t)
@@ -1598,11 +1608,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) (min (1+ (point-at-eol)) (point-max)))))
        ((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) (min (1+ (point-at-eol)) (point-max)))))
        ((match-end 3)
-	(setq label (org-trim (match-string 3))))
+	(progn
+	  (setq label (org-trim (match-string 3)))
+	  (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
        (t
 	(setq end (if (match-end 4)
 		      (let ((ee (org-table-end)))
-- 
1.7.1.1


[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



[-- Attachment #4: 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff (v.2)
  2010-06-30 13:18           ` [PATCH] Unwanted #+ATTR_Backend and #+Backend stuff (v.2) Nicolas Goaziou
@ 2010-06-30 13:53             ` Sebastian Rose
  0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Rose @ 2010-06-30 13:53 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>>>>> Sebastian Rose writes:
>> Ahhh - it nearly does!
>
>> But look at this:
>
>>  --8<---------------cut here---------------start------------->8--
>>          *Tempolauf*
>>         #+ATTR_HTML: style="margin-left:auto;margin-right:auto;text-align:center;"
>>  |  Z | Station          | Meter | Etappe |  Zeit |  Rnd. | Pace Rnd. | Pace |
>>  |----+------------------+-------+--------+-------+-------+-----------+------|
>>  --8<---------------cut here---------------end--------------->8--
>
>> Becomes:
>
>>  --8<---------------cut here---------------start------------->8--
>> <b>Tempolauf</b>
>>         style="margin-left:auto;margin-right:auto;text-align:center;"
>> </p><table border="0" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
>>  --8<---------------cut here---------------end--------------->8--
>
>> The `style...' part must be trimmed and go inside the `<table>' tag.
>
> Yes, my patch was a bit aggressive. See my next try.
>
>
>> Also, in this test:
>> [...]
>> the second last `#+CAPTION: removed' is NOT removed.
>
> That, my first patch about captions should have taken care of it.
>
> Here is another try on this one. Please tell me if it is working. It
> contains both fixes (captions and attr) so there shouldn't be the need
> of a previous patch.
>
> Regards,
>
> -- Nicolas


Yeeeess!! :)

That patch seems to do the trick.

Thanks Nicolas!


Regards

   Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] orphaned captions and labels
  2010-06-30 10:55   ` [PATCH] orphaned captions and labels Nicolas Goaziou
@ 2010-07-02 15:12     ` David Maus
  0 siblings, 0 replies; 10+ messages in thread
From: David Maus @ 2010-07-02 15:12 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List


[-- Attachment #1.1: Type: text/plain, Size: 576 bytes --]

Nicolas Goaziou wrote:
>Hello,

>>>>>> David Maus writes:
>> 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.

>Speaking of this, what is the status of this patch ? It isn't applied
>on master branch and I don't see it in the patch tracker.

http://patchwork.newartisans.com/patch/97/ -- accepted.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-07-02 15:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-19 18:19 [PATCH] orphaned captions and labels Nicolas Goaziou
2010-06-24 14:26 ` David Maus
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

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).