Backends now register with org-lparse during load time

* contrib/lisp/org-lparse.el (org-lparse-native-backends): Set
default value to nil. Also update docstring.
(org-lparse-register-backend): New
* contrib/lisp/org-xhtml.el (org-xhtml-get): Add self -
"xhtml" - as one of the other backends. Call
org-lparse-register-backend on load.
* contrib/lisp/org-odt.el: Call org-lparse-register-backend on
load.
This commit is contained in:
Jambunathan K 2011-07-09 01:32:34 +05:30
parent cb95d39695
commit 7aee4082c1
3 changed files with 22 additions and 4 deletions

View File

@ -337,9 +337,11 @@ OPT-PLIST is the export options list."
(when org-lparse-do-open-par
(org-lparse-begin-paragraph))))
(defvar org-lparse-native-backends
'("xhtml" "odt")
(defvar org-lparse-native-backends nil
"List of native backends registered with `org-lparse'.
A backend can use `org-lparse-register-backend' to add itself to
this list.
All native backends must implement a get routine and a mandatory
set of callback routines.
@ -354,6 +356,16 @@ For the sake of illustration, the html backend implements
`org-xhtml-entity-format-callbacks-alist' as the values of
ENTITY-CONTROL and ENTITY-FORMAT settings.")
(defun org-lparse-register-backend (backend)
"Make BACKEND known to org-lparse library.
Add BACKEND to `org-lparse-native-backends'."
(when backend
(setq backend (cond
((symbolp backend) (symbol-name backend))
((stringp backend) backend)
(t (error "Error while registering backend: %S" backend))))
(add-to-list 'org-lparse-native-backends backend)))
(defun org-lparse-get-other-backends (native-backend)
(org-lparse-backend-get native-backend 'OTHER-BACKENDS))

View File

@ -128,9 +128,12 @@
(cons (concat "\\." (car desc) "\\'") 'system)))
org-odt-ms-file-extensions)
;; register the odt exporter
;; register the odt exporter with the pre-processor
(add-to-list 'org-export-backends 'odt)
;; register the odt exporter with org-lparse library
(org-lparse-register-backend 'odt)
(defcustom org-export-odt-automatic-styles-file nil
"Default style file for use with ODT exporter."
:type 'file

View File

@ -1194,6 +1194,9 @@ make any modifications to the exporter file. For example,
`org-xhtml-format-table-row' encloses incoming entity in <tr>
</tr> tags and returns it. See also `org-lparse-format'.")
;; register the xhtml exporter with org-lparse library
(org-lparse-register-backend 'xhtml)
(defun org-xhtml-begin-document-body (opt-plist)
(let ((link-up (and (plist-get opt-plist :link-up)
(string-match "\\S-" (plist-get opt-plist :link-up))
@ -1652,7 +1655,7 @@ lang=\"%s\" xml:lang=\"%s\">
(SAVE-METHOD nil)
(CLEANUP-METHOD nil)
(OTHER-BACKENDS
'("etext" "html" "html10" "mediawiki" "pdf" "sdw" "sdw3" "sdw4"
'("xhtml" "etext" "html" "html10" "mediawiki" "pdf" "sdw" "sdw3" "sdw4"
"text" "text10" "odt" "vor" "vor4"))
(CONVERT-METHOD org-lparse-convert-process)
(EXPORT-DIR (org-export-directory :html opt-plist))