فهرست منبع

Allow to exclude some blocks in org-special-blocks.el

Patch by Chris Gray.
Carsten Dominik 15 سال پیش
والد
کامیت
7445456796
2فایلهای تغییر یافته به همراه18 افزوده شده و 5 حذف شده
  1. 7 0
      contrib/ChangeLog
  2. 11 5
      contrib/lisp/org-special-blocks.el

+ 7 - 0
contrib/ChangeLog

@@ -1,3 +1,10 @@
+2009-10-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
+	New variable.
+	(org-special-blocks-make-special-cookies): Use
+	`org-special-blocks-ignore-regexp'.
+
 2009-09-16  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* lisp/org-invoice.el: New file.

+ 11 - 5
contrib/lisp/org-special-blocks.el

@@ -40,17 +40,23 @@
 ;; user to add this class to his or her stylesheet if this div is to
 ;; mean anything.
 
+(defvar org-special-blocks-ignore-regexp "^\\(LaTeX\\|HTML\\)$"
+  "A regexp indicating the names of blocks that should be ignored
+by org-special-blocks.  These blocks will presumably be
+interpreted by other mechanisms.")
+
 (defun org-special-blocks-make-special-cookies ()
   "Adds special cookies when #+begin_foo and #+end_foo tokens are
 seen.  This is run after a few special cases are taken care of."
   (when (or htmlp latexp)
     (goto-char (point-min))
     (while (re-search-forward "^#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
-      (replace-match
-       (if (equal (downcase (match-string 1)) "begin")
-	   (concat "ORG-" (match-string 2) "-START")
-	 (concat "ORG-" (match-string 2) "-END"))
-       t t))))
+      (unless (string-match-p org-special-blocks-ignore-regexp (match-string 2))
+	(replace-match
+	 (if (equal (downcase (match-string 1)) "begin")
+	     (concat "ORG-" (match-string 2) "-START")
+	   (concat "ORG-" (match-string 2) "-END"))
+	 t t)))))
 
 (add-hook 'org-export-preprocess-after-blockquote-hook
 	  'org-special-blocks-make-special-cookies)