From d8a3b84c9346b379fe1f7ab7d55fcd08367d2622 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 3 Nov 2012 17:43:04 +0100 Subject: [PATCH] org-export: New function to locally use another back-end * contrib/lisp/org-export.el (org-export-with-backend): New function. * contrib/lisp/org-e-beamer.el (org-e-beamer-link): Use new function. --- contrib/lisp/org-e-beamer.el | 3 +-- contrib/lisp/org-export.el | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/contrib/lisp/org-e-beamer.el b/contrib/lisp/org-e-beamer.el index 94336d736..8743cc2f3 100644 --- a/contrib/lisp/org-e-beamer.el +++ b/contrib/lisp/org-e-beamer.el @@ -725,8 +725,7 @@ used as a communication channel." path contents)))))))) ;; Otherwise, use `e-latex' back-end. - (t (funcall (cdr (assq 'link org-e-latex-translate-alist)) - link contents info))))) + (t (org-export-with-backend 'e-latex link contents info))))) ;;;; Plain List diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 7afcd8def..0d7dbf7c7 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -2545,8 +2545,6 @@ Return the updated communication channel." ;; was within an item, the item should contain the headline. That's ;; why file inclusion should be done before any structure can be ;; associated to the file, that is before parsing. -;; -;; Macro are expanded with `org-export-expand-macro'. (defun org-export-as (backend &optional subtreep visible-only body-only ext-plist noexpand) @@ -2986,6 +2984,28 @@ Caption lines are separated by a white space." (setq caption (nconc (list " ") (copy-sequence cap) caption))))))) +;;;; For Derived Back-ends +;; +;; `org-export-with-backend' is a function allowing to locally use +;; another back-end to transcode some object or element. In a derived +;; back-end, it may be used as a fall-back function once all specific +;; cases have been treated. + +(defun org-export-with-backend (back-end data &rest args) + "Call a transcoder from BACK-END on DATA." + (org-export-barf-if-invalid-backend back-end) + (let ((type (org-element-type data))) + (if (or (memq type '(nil org-data))) + (error "No foreign transcoder available") + (let ((transcoder (cdr (assq type + (symbol-value + (intern (format "org-%s-translate-alist" + back-end))))))) + (if (not (functionp transcoder)) + (error "No foreign transcoder available") + (apply transcoder data args)))))) + + ;;;; For Export Snippets ;; ;; Every export snippet is transmitted to the back-end. Though, the @@ -3153,6 +3173,10 @@ INFO is the plist used as a communication channel." ;; `org-export-low-level-p', `org-export-first-sibling-p' and ;; `org-export-last-sibling-p' are three useful predicates when it ;; comes to fulfill the `:headline-levels' property. +;; +;; `org-export-get-tags', `org-export-get-category' and +;; `org-export-get-node-property' extract useful information from an +;; headline or a parent headline. They all handle inheritance. (defun org-export-get-relative-level (headline info) "Return HEADLINE relative level within current parsed tree. -- 2.11.4.GIT