0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 08:32:53 +00:00

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.
This commit is contained in:
Carsten Dominik 2009-05-02 08:02:17 +02:00
parent d3689276ec
commit abc874cefc
4 changed files with 30 additions and 0 deletions

View file

@ -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> 2009-04-30 Carsten Dominik <carsten.dominik@gmail.com>
* org-macs.el (org-check-external-command): New defsubst. * org-macs.el (org-check-external-command): New defsubst.

View file

@ -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 This selection includes tags-based selection, as well as removal
of commented and archived trees.") 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 (defvar org-export-preprocess-before-backend-specifics-hook nil
"Hook run before backend-specific functions are called during preprocessing.") "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 ;; Blockquotes, verse, and center
(org-export-mark-blockquote-verse-center) (org-export-mark-blockquote-verse-center)
(run-hooks 'org-export-preprocess-after-blockquote-hook)
;; Remove timestamps, if the user has requested so ;; Remove timestamps, if the user has requested so
(unless (plist-get parameters :timestamps) (unless (plist-get parameters :timestamps)

View file

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

View file

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