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:
parent
cb95d39695
commit
7aee4082c1
|
@ -337,9 +337,11 @@ OPT-PLIST is the export options list."
|
||||||
(when org-lparse-do-open-par
|
(when org-lparse-do-open-par
|
||||||
(org-lparse-begin-paragraph))))
|
(org-lparse-begin-paragraph))))
|
||||||
|
|
||||||
(defvar org-lparse-native-backends
|
(defvar org-lparse-native-backends nil
|
||||||
'("xhtml" "odt")
|
|
||||||
"List of native backends registered with `org-lparse'.
|
"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
|
All native backends must implement a get routine and a mandatory
|
||||||
set of callback routines.
|
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
|
`org-xhtml-entity-format-callbacks-alist' as the values of
|
||||||
ENTITY-CONTROL and ENTITY-FORMAT settings.")
|
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)
|
(defun org-lparse-get-other-backends (native-backend)
|
||||||
(org-lparse-backend-get native-backend 'OTHER-BACKENDS))
|
(org-lparse-backend-get native-backend 'OTHER-BACKENDS))
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,12 @@
|
||||||
(cons (concat "\\." (car desc) "\\'") 'system)))
|
(cons (concat "\\." (car desc) "\\'") 'system)))
|
||||||
org-odt-ms-file-extensions)
|
org-odt-ms-file-extensions)
|
||||||
|
|
||||||
;; register the odt exporter
|
;; register the odt exporter with the pre-processor
|
||||||
(add-to-list 'org-export-backends 'odt)
|
(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
|
(defcustom org-export-odt-automatic-styles-file nil
|
||||||
"Default style file for use with ODT exporter."
|
"Default style file for use with ODT exporter."
|
||||||
:type 'file
|
:type 'file
|
||||||
|
|
|
@ -1194,6 +1194,9 @@ make any modifications to the exporter file. For example,
|
||||||
`org-xhtml-format-table-row' encloses incoming entity in <tr>
|
`org-xhtml-format-table-row' encloses incoming entity in <tr>
|
||||||
</tr> tags and returns it. See also `org-lparse-format'.")
|
</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)
|
(defun org-xhtml-begin-document-body (opt-plist)
|
||||||
(let ((link-up (and (plist-get opt-plist :link-up)
|
(let ((link-up (and (plist-get opt-plist :link-up)
|
||||||
(string-match "\\S-" (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)
|
(SAVE-METHOD nil)
|
||||||
(CLEANUP-METHOD nil)
|
(CLEANUP-METHOD nil)
|
||||||
(OTHER-BACKENDS
|
(OTHER-BACKENDS
|
||||||
'("etext" "html" "html10" "mediawiki" "pdf" "sdw" "sdw3" "sdw4"
|
'("xhtml" "etext" "html" "html10" "mediawiki" "pdf" "sdw" "sdw3" "sdw4"
|
||||||
"text" "text10" "odt" "vor" "vor4"))
|
"text" "text10" "odt" "vor" "vor4"))
|
||||||
(CONVERT-METHOD org-lparse-convert-process)
|
(CONVERT-METHOD org-lparse-convert-process)
|
||||||
(EXPORT-DIR (org-export-directory :html opt-plist))
|
(EXPORT-DIR (org-export-directory :html opt-plist))
|
||||||
|
|
Loading…
Reference in New Issue