浏览代码

Export: New hooks for Chris Gray's LaTeX/HTML blocks

Chris Gray had the idea to have arbitrary blocks turned in LaTeX
environments and HTML divs.  These three new hooks allow
implementation has an add-on rather than a patch.
Carsten Dominik 16 年之前
父节点
当前提交
abc874cefc
共有 4 个文件被更改,包括 30 次插入0 次删除
  1. 11 0
      lisp/ChangeLog
  2. 6 0
      lisp/org-exp.el
  3. 6 0
      lisp/org-html.el
  4. 7 0
      lisp/org-latex.el

+ 11 - 0
lisp/ChangeLog

@@ -1,3 +1,14 @@
+2009-05-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-html.el (org-export-html-after-blockquotes-hook): New hook.
+	(org-export-as-html): Run the new hook.
+
+	* org-latex.el (org-export-latex-after-blockquotes-hook): New hook.
+	(org-export-latex-preprocess): Run the new hook.
+
+	* org-exp.el (org-export-preprocess-after-blockquote-hook): New hook.
+	(org-export-preprocess-string): Run the new hook.
+
 2009-04-30  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-macs.el (org-check-external-command): New defsubst.

+ 6 - 0
lisp/org-exp.el

@@ -344,6 +344,11 @@ This is run after selection of trees to be exported has happened.
 This selection includes tags-based selection, as well as removal
 of commented and archived trees.")
 
+(defvar org-export-preprocess-after-blockquote-hook nil
+  "Hook for preprocessing an export buffer.
+This is run after blockquote/quote/verse/center have been marked
+with cookies.")
+
 (defvar org-export-preprocess-before-backend-specifics-hook nil
   "Hook run before backend-specific functions are called during preprocessing.")
 
@@ -1250,6 +1255,7 @@ on this string to produce the exported version."
 
       ;; Blockquotes, verse, and center
       (org-export-mark-blockquote-verse-center)
+      (run-hooks 'org-export-preprocess-after-blockquote-hook)
 
       ;; Remove timestamps, if the user has requested so
       (unless (plist-get parameters :timestamps)

+ 6 - 0
lisp/org-html.el

@@ -327,6 +327,11 @@ in all modes you want.  Then, use the command
 (defvar org-export-html-auto-postamble t
   "Should default postamble be inserted?  Set by publishing functions.")
 
+;;; Hooks
+
+(defvar org-export-html-after-blockquotes-hook nil
+  "Hook run during HTML export, after blockquote, verse, center are done.")
+
 ;;; HTML export
 
 (defun org-export-html-preprocess (parameters)
@@ -840,6 +845,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	    (insert "\n</div>")
 	    (org-open-par)
 	    (throw 'nextline nil))
+	  (run-hooks 'org-export-html-after-blockquotes-hook)
 	  (when inverse
 	    (let ((i (org-get-string-indentation line)))
 	      (if (> i 0)

+ 7 - 0
lisp/org-latex.el

@@ -314,6 +314,11 @@ These are the .aux, .log, .out, and .toc files."
   :group 'org-export-pdf
   :type 'boolean)
 
+;;; Hooks
+
+(defvar org-export-latex-after-blockquotes-hook nil
+  "Hook run during LaTeX export, after blockquote, verse, center are done.")
+
 ;;; Autoload functions:
 
 ;;;###autoload
@@ -1468,6 +1473,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   (while (search-forward "ORG-CENTER-END" nil t)
     (replace-match "\\end{center}" t t))
 
+  (run-hooks 'org-export-latex-after-blockquotes-hook)
+
   ;; Convert horizontal rules
   (goto-char (point-min))
   (while (re-search-forward "^----+.$" nil t)