summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2010-06-30 12:28:32 +0200
committerEric Schulte <schulte.eric@gmail.com>2010-06-30 14:23:01 -0700
commit011553652e2be62714886885233b9a2a7bac3ff9 (patch)
treef442fa9752eda3224574d63bd7a8a19336107660
parent37b5faec0f7bed7ad6ecfaa469ac4581b74b98bc (diff)
downloadorg-mode-011553652e2be62714886885233b9a2a7bac3ff9.tar.gz
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.
-rw-r--r--lisp/org-exp.el32
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)))