瀏覽代碼

Export: Allow backend-specific code to be indented

Things like #+latex: and #+begin_html...#+end_html
can now be indented.
Carsten Dominik 16 年之前
父節點
當前提交
2be3df3fd8
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 2 0
      lisp/ChangeLog
  2. 5 5
      lisp/org-exp.el

+ 2 - 0
lisp/ChangeLog

@@ -5,6 +5,8 @@
 	(org-export-format-source-code-or-example): Fix indentation of
 	blocks.
 	(org-export-remove-indentation): New function.
+	(org-export-select-backend-specific-text): Allow backend-specific
+	code to be indented.
 
 	* org.el (org-fontify-meta-lines): New function.
 	(org-set-font-lock-defaults): Call the new fontification

+ 5 - 5
lisp/org-exp.el

@@ -1659,17 +1659,17 @@ from the buffer."
       (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 "^#\\+" (cadr fmt)
+	(while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
 					  ":[ \t]*\\(.*\\)") nil t)
-	  (replace-match "\\1" t)
+	  (replace-match "\\1\\2" t)
 	  (add-text-properties
 	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
 	   '(org-protected t))))
       (goto-char (point-min))
       (while (re-search-forward
-	      (concat "^#\\+"
-		      (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+"
-		      (cadddr fmt) "\\>.*\n?") nil t)
+	      (concat "^[ \t]*#\\+" (caddr fmt)
+		      "\\>.*\\(\\(\n.*\\)*?\n\\)[ \t]*#\\+" (cadddr fmt)
+		      "\\>.*\n?") nil t)
 	(if (eq (car fmt) backend)
 	    ;; yes, keep this
 	    (add-text-properties (match-beginning 1) (1+ (match-end 1))