From abc874cefc5bccdfc322b231e06ef530546778ee Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 2 May 2009 08:02:17 +0200 Subject: [PATCH] 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. --- lisp/ChangeLog | 11 +++++++++++ lisp/org-exp.el | 6 ++++++ lisp/org-html.el | 6 ++++++ lisp/org-latex.el | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1c8da8c30..a9fb9714d 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2009-05-02 Carsten Dominik + + * 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 * org-macs.el (org-check-external-command): New defsubst. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index da016c3af..112464401 100644 --- a/lisp/org-exp.el +++ b/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) diff --git a/lisp/org-html.el b/lisp/org-html.el index 892ec0533..5608b509d 100644 --- a/lisp/org-html.el +++ b/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") (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) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 8f8eb9dc5..718fc56f6 100644 --- a/lisp/org-latex.el +++ b/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)