ox.el (org-export-define-backend, org-export-define-derived-backend): Use defuns

* ox.el (org-export-define-backend)
(org-export-define-derived-backend): Make defuns and update
docstrings.

* ox-texinfo.el (texinfo):
* ox-org.el (org):
* ox-odt.el (odt):
* ox-md.el (md):
* ox-man.el (man):
* ox-latex.el (latex):
* ox-icalendar.el (icalendar):
* ox-html.el (html):
* ox-beamer.el (beamer):
* ox-ascii.el (ascii): Use the defuns.
This commit is contained in:
Bastien Guerry 2013-03-19 16:24:40 +01:00
parent d8969931a9
commit a13b19e384
11 changed files with 589 additions and 597 deletions

View File

@ -54,8 +54,8 @@
;; We also install a filter for headlines and sections, in order to ;; We also install a filter for headlines and sections, in order to
;; control blank lines separating them in output string. ;; control blank lines separating them in output string.
(org-export-define-backend ascii (org-export-define-backend 'ascii
((bold . org-ascii-bold) '((bold . org-ascii-bold)
(center-block . org-ascii-center-block) (center-block . org-ascii-center-block)
(clock . org-ascii-clock) (clock . org-ascii-clock)
(code . org-ascii-code) (code . org-ascii-code)
@ -107,7 +107,7 @@
(verse-block . org-ascii-verse-block)) (verse-block . org-ascii-verse-block))
:export-block "ASCII" :export-block "ASCII"
:menu-entry :menu-entry
(?t "Export to Plain Text" '(?t "Export to Plain Text"
((?A "As ASCII buffer" ((?A "As ASCII buffer"
(lambda (a s v b) (lambda (a s v b)
(org-ascii-export-as-ascii a s v b '(:ascii-charset ascii)))) (org-ascii-export-as-ascii a s v b '(:ascii-charset ascii))))
@ -126,11 +126,11 @@
(?u "As UTF-8 file" (?u "As UTF-8 file"
(lambda (a s v b) (lambda (a s v b)
(org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8)))))) (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8))))))
:filters-alist ((:filter-headline . org-ascii-filter-headline-blank-lines) :filters-alist '((:filter-headline . org-ascii-filter-headline-blank-lines)
(:filter-parse-tree org-ascii-filter-paragraph-spacing (:filter-parse-tree org-ascii-filter-paragraph-spacing
org-ascii-filter-comment-spacing) org-ascii-filter-comment-spacing)
(:filter-section . org-ascii-filter-headline-blank-lines)) (:filter-section . org-ascii-filter-headline-blank-lines))
:options-alist ((:ascii-charset nil nil org-ascii-charset))) :options-alist '((:ascii-charset nil nil org-ascii-charset)))

View File

@ -293,10 +293,10 @@ Return overlay specification, as a string, or nil."
;;; Define Back-End ;;; Define Back-End
(org-export-define-derived-backend beamer latex (org-export-define-derived-backend 'beamer 'latex
:export-block "BEAMER" :export-block "BEAMER"
:menu-entry :menu-entry
(?l 1 '(?l 1
((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex) ((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex)
(?b "As LaTeX file (Beamer)" org-beamer-export-to-latex) (?b "As LaTeX file (Beamer)" org-beamer-export-to-latex)
(?P "As PDF file (Beamer)" org-beamer-export-to-pdf) (?P "As PDF file (Beamer)" org-beamer-export-to-pdf)
@ -305,14 +305,14 @@ Return overlay specification, as a string, or nil."
(if a (org-beamer-export-to-pdf t s v b) (if a (org-beamer-export-to-pdf t s v b)
(org-open-file (org-beamer-export-to-pdf nil s v b))))))) (org-open-file (org-beamer-export-to-pdf nil s v b)))))))
:options-alist :options-alist
((:beamer-theme "BEAMER_THEME" nil org-beamer-theme) '((:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
(:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t) (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
(:beamer-font-theme "BEAMER_FONT_THEME" nil nil t) (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
(:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t) (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
(:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t) (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
(:beamer-header-extra "BEAMER_HEADER" nil nil newline) (:beamer-header-extra "BEAMER_HEADER" nil nil newline)
(:headline-levels nil "H" org-beamer-frame-level)) (:headline-levels nil "H" org-beamer-frame-level))
:translate-alist ((bold . org-beamer-bold) :translate-alist '((bold . org-beamer-bold)
(export-block . org-beamer-export-block) (export-block . org-beamer-export-block)
(export-snippet . org-beamer-export-snippet) (export-snippet . org-beamer-export-snippet)
(headline . org-beamer-headline) (headline . org-beamer-headline)

View File

@ -49,8 +49,8 @@
;;; Define Back-End ;;; Define Back-End
(org-export-define-backend html (org-export-define-backend 'html
((bold . org-html-bold) '((bold . org-html-bold)
(center-block . org-html-center-block) (center-block . org-html-center-block)
(clock . org-html-clock) (clock . org-html-clock)
(code . org-html-code) (code . org-html-code)
@ -100,10 +100,10 @@
(verbatim . org-html-verbatim) (verbatim . org-html-verbatim)
(verse-block . org-html-verse-block)) (verse-block . org-html-verse-block))
:export-block "HTML" :export-block "HTML"
:filters-alist ((:filter-options . org-html-infojs-install-script) :filters-alist '((:filter-options . org-html-infojs-install-script)
(:filter-final-output . org-html-final-function)) (:filter-final-output . org-html-final-function))
:menu-entry :menu-entry
(?h "Export to HTML" '(?h "Export to HTML"
((?H "As HTML buffer" org-html-export-as-html) ((?H "As HTML buffer" org-html-export-as-html)
(?h "As HTML file" org-html-export-to-html) (?h "As HTML file" org-html-export-to-html)
(?o "As HTML file and open" (?o "As HTML file and open"
@ -111,7 +111,7 @@
(if a (org-html-export-to-html t s v b) (if a (org-html-export-to-html t s v b)
(org-open-file (org-html-export-to-html nil s v b))))))) (org-open-file (org-html-export-to-html nil s v b)))))))
:options-alist :options-alist
((:html-extension nil nil org-html-extension) '((:html-extension nil nil org-html-extension)
(:html-doctype "HTML_DOCTYPE" nil org-html-doctype) (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
(:html-container "HTML_CONTAINER" nil org-html-container-element) (:html-container "HTML_CONTAINER" nil org-html-container-element)
(:html-link-home "HTML_LINK_HOME" nil org-html-link-home) (:html-link-home "HTML_LINK_HOME" nil org-html-link-home)

View File

@ -255,15 +255,15 @@ re-read the iCalendar file.")
;;; Define Back-End ;;; Define Back-End
(org-export-define-derived-backend icalendar ascii (org-export-define-derived-backend 'icalendar 'ascii
:translate-alist ((clock . ignore) :translate-alist '((clock . ignore)
(headline . org-icalendar-entry) (headline . org-icalendar-entry)
(inlinetask . ignore) (inlinetask . ignore)
(planning . ignore) (planning . ignore)
(section . ignore) (section . ignore)
(template . org-icalendar-template)) (template . org-icalendar-template))
:options-alist :options-alist
((:exclude-tags '((:exclude-tags
"ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split) "ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split)
(:with-timestamps nil "<" org-icalendar-with-timestamps) (:with-timestamps nil "<" org-icalendar-with-timestamps)
(:with-vtodo nil nil org-icalendar-include-todo) (:with-vtodo nil nil org-icalendar-include-todo)
@ -272,9 +272,9 @@ re-read the iCalendar file.")
;; a non-nil "ICALENDAR_MARK" property will be ignored. ;; a non-nil "ICALENDAR_MARK" property will be ignored.
(:icalendar-agenda-view nil nil nil)) (:icalendar-agenda-view nil nil nil))
:filters-alist :filters-alist
((:filter-headline . org-icalendar-clear-blank-lines)) '((:filter-headline . org-icalendar-clear-blank-lines))
:menu-entry :menu-entry
(?c "Export to iCalendar" '(?c "Export to iCalendar"
((?f "Current file" org-icalendar-export-to-ics) ((?f "Current file" org-icalendar-export-to-ics)
(?a "All agenda files" (?a "All agenda files"
(lambda (a s v b) (org-icalendar-export-agenda-files a))) (lambda (a s v b) (org-icalendar-export-agenda-files a)))

View File

@ -115,8 +115,8 @@
;;; Define Back-End ;;; Define Back-End
(org-export-define-backend latex (org-export-define-backend 'latex
((bold . org-latex-bold) '((bold . org-latex-bold)
(center-block . org-latex-center-block) (center-block . org-latex-center-block)
(clock . org-latex-clock) (clock . org-latex-clock)
(code . org-latex-code) (code . org-latex-code)
@ -166,9 +166,9 @@
(underline . org-latex-underline) (underline . org-latex-underline)
(verbatim . org-latex-verbatim) (verbatim . org-latex-verbatim)
(verse-block . org-latex-verse-block)) (verse-block . org-latex-verse-block))
:export-block ("LATEX" "TEX") :export-block '("LATEX" "TEX")
:menu-entry :menu-entry
(?l "Export to LaTeX" '(?l "Export to LaTeX"
((?L "As LaTeX buffer" org-latex-export-as-latex) ((?L "As LaTeX buffer" org-latex-export-as-latex)
(?l "As LaTeX file" org-latex-export-to-latex) (?l "As LaTeX file" org-latex-export-to-latex)
(?p "As PDF file" org-latex-export-to-pdf) (?p "As PDF file" org-latex-export-to-pdf)
@ -176,7 +176,7 @@
(lambda (a s v b) (lambda (a s v b)
(if a (org-latex-export-to-pdf t s v b) (if a (org-latex-export-to-pdf t s v b)
(org-open-file (org-latex-export-to-pdf nil s v b))))))) (org-open-file (org-latex-export-to-pdf nil s v b)))))))
:options-alist ((:date-format nil nil org-latex-date-timestamp-format) :options-alist '((:date-format nil nil org-latex-date-timestamp-format)
(:latex-class "LATEX_CLASS" nil org-latex-default-class t) (:latex-class "LATEX_CLASS" nil org-latex-default-class t)
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t) (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline) (:latex-header "LATEX_HEADER" nil nil newline)

View File

@ -49,8 +49,8 @@
;;; Define Back-End ;;; Define Back-End
(org-export-define-backend man (org-export-define-backend 'man
((babel-call . org-man-babel-call) '((babel-call . org-man-babel-call)
(bold . org-man-bold) (bold . org-man-bold)
(center-block . org-man-center-block) (center-block . org-man-center-block)
(clock . org-man-clock) (clock . org-man-clock)
@ -102,7 +102,7 @@
(verse-block . org-man-verse-block)) (verse-block . org-man-verse-block))
:export-block "MAN" :export-block "MAN"
:menu-entry :menu-entry
(?m "Export to MAN" '(?m "Export to MAN"
((?m "As MAN file" org-man-export-to-man) ((?m "As MAN file" org-man-export-to-man)
(?p "As PDF file" org-man-export-to-pdf) (?p "As PDF file" org-man-export-to-pdf)
(?o "As PDF file and open" (?o "As PDF file and open"
@ -110,7 +110,7 @@
(if a (org-man-export-to-pdf t s v b) (if a (org-man-export-to-pdf t s v b)
(org-open-file (org-man-export-to-pdf nil s v b))))))) (org-open-file (org-man-export-to-pdf nil s v b)))))))
:options-alist :options-alist
((:man-class "MAN_CLASS" nil nil t) '((:man-class "MAN_CLASS" nil nil t)
(:man-class-options "MAN_CLASS_OPTIONS" nil nil t) (:man-class-options "MAN_CLASS_OPTIONS" nil nil t)
(:man-header-extra "MAN_HEADER" nil nil newline))) (:man-header-extra "MAN_HEADER" nil nil newline)))

View File

@ -55,11 +55,11 @@ This variable can be set to either `atx' or `setext'."
;;; Define Back-End ;;; Define Back-End
(org-export-define-derived-backend md html (org-export-define-derived-backend 'md 'html
:export-block ("MD" "MARKDOWN") :export-block '("MD" "MARKDOWN")
:filters-alist ((:filter-parse-tree . org-md-separate-elements)) :filters-alist '((:filter-parse-tree . org-md-separate-elements))
:menu-entry :menu-entry
(?m "Export to Markdown" '(?m "Export to Markdown"
((?M "To temporary buffer" ((?M "To temporary buffer"
(lambda (a s v b) (org-md-export-as-markdown a s v))) (lambda (a s v b) (org-md-export-as-markdown a s v)))
(?m "To file" (lambda (a s v b) (org-md-export-to-markdown a s v))) (?m "To file" (lambda (a s v b) (org-md-export-to-markdown a s v)))
@ -67,7 +67,7 @@ This variable can be set to either `atx' or `setext'."
(lambda (a s v b) (lambda (a s v b)
(if a (org-md-export-to-markdown t s v) (if a (org-md-export-to-markdown t s v)
(org-open-file (org-md-export-to-markdown nil s v))))))) (org-open-file (org-md-export-to-markdown nil s v)))))))
:translate-alist ((bold . org-md-bold) :translate-alist '((bold . org-md-bold)
(code . org-md-verbatim) (code . org-md-verbatim)
(underline . org-md-verbatim) (underline . org-md-verbatim)
(comment . (lambda (&rest args) "")) (comment . (lambda (&rest args) ""))

View File

@ -34,8 +34,8 @@
;;; Define Back-End ;;; Define Back-End
(org-export-define-backend odt (org-export-define-backend 'odt
((bold . org-odt-bold) '((bold . org-odt-bold)
(center-block . org-odt-center-block) (center-block . org-odt-center-block)
(clock . org-odt-clock) (clock . org-odt-clock)
(code . org-odt-code) (code . org-odt-code)
@ -84,19 +84,19 @@
(verbatim . org-odt-verbatim) (verbatim . org-odt-verbatim)
(verse-block . org-odt-verse-block)) (verse-block . org-odt-verse-block))
:export-block "ODT" :export-block "ODT"
:filters-alist ((:filter-parse-tree :filters-alist '((:filter-parse-tree
. (org-odt--translate-latex-fragments . (org-odt--translate-latex-fragments
org-odt--translate-description-lists org-odt--translate-description-lists
org-odt--translate-list-tables))) org-odt--translate-list-tables)))
:menu-entry :menu-entry
(?o "Export to ODT" '(?o "Export to ODT"
((?o "As ODT file" org-odt-export-to-odt) ((?o "As ODT file" org-odt-export-to-odt)
(?O "As ODT file and open" (?O "As ODT file and open"
(lambda (a s v b) (lambda (a s v b)
(if a (org-odt-export-to-odt t s v) (if a (org-odt-export-to-odt t s v)
(org-open-file (org-odt-export-to-odt nil s v) 'system)))))) (org-open-file (org-odt-export-to-odt nil s v) 'system))))))
:options-alist :options-alist
((:odt-styles-file "ODT_STYLES_FILE" nil nil t) '((:odt-styles-file "ODT_STYLES_FILE" nil nil t)
;; Redefine regular option. ;; Redefine regular option.
(:with-latex nil "tex" org-odt-with-latex))) (:with-latex nil "tex" org-odt-with-latex)))

View File

@ -52,8 +52,8 @@ setting of `org-html-htmlize-output-type' is 'css."
(const :tag "Don't include external stylesheet link" nil) (const :tag "Don't include external stylesheet link" nil)
(string :tag "URL or local href"))) (string :tag "URL or local href")))
(org-export-define-backend org (org-export-define-backend 'org
((babel-call . org-org-identity) '((babel-call . org-org-identity)
(bold . org-org-identity) (bold . org-org-identity)
(center-block . org-org-identity) (center-block . org-org-identity)
(clock . org-org-identity) (clock . org-org-identity)

View File

@ -65,8 +65,8 @@
;;; Define Back-End ;;; Define Back-End
(org-export-define-backend texinfo (org-export-define-backend 'texinfo
((bold . org-texinfo-bold) '((bold . org-texinfo-bold)
(center-block . org-texinfo-center-block) (center-block . org-texinfo-center-block)
(clock . org-texinfo-clock) (clock . org-texinfo-clock)
(code . org-texinfo-code) (code . org-texinfo-code)
@ -113,14 +113,14 @@
(verse-block . org-texinfo-verse-block)) (verse-block . org-texinfo-verse-block))
:export-block "TEXINFO" :export-block "TEXINFO"
:filters-alist :filters-alist
((:filter-headline . org-texinfo-filter-section-blank-lines) '((:filter-headline . org-texinfo-filter-section-blank-lines)
(:filter-section . org-texinfo-filter-section-blank-lines)) (:filter-section . org-texinfo-filter-section-blank-lines))
:menu-entry :menu-entry
(?i "Export to Texinfo" '(?i "Export to Texinfo"
((?t "As TEXI file" org-texinfo-export-to-texinfo) ((?t "As TEXI file" org-texinfo-export-to-texinfo)
(?i "As INFO file" org-texinfo-export-to-info))) (?i "As INFO file" org-texinfo-export-to-info)))
:options-alist :options-alist
((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t) '((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t)
(:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t)
(:texinfo-header "TEXINFO_HEADER" nil nil newline) (:texinfo-header "TEXINFO_HEADER" nil nil newline)
(:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline)

View File

@ -842,7 +842,7 @@ mode."
;; Eventually `org-export-barf-if-invalid-backend' returns an error ;; Eventually `org-export-barf-if-invalid-backend' returns an error
;; when a given back-end hasn't been registered yet. ;; when a given back-end hasn't been registered yet.
(defmacro org-export-define-backend (backend translators &rest body) (defun org-export-define-backend (backend translators &rest body)
"Define a new back-end BACKEND. "Define a new back-end BACKEND.
TRANSLATORS is an alist between object or element types and TRANSLATORS is an alist between object or element types and
@ -905,7 +905,7 @@ keywords are understood:
Menu entry for the export dispatcher. It should be a list Menu entry for the export dispatcher. It should be a list
like: like:
\(KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU) '(KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU)
where : where :
@ -929,17 +929,17 @@ keywords are understood:
If it is an alist, associations should follow the If it is an alist, associations should follow the
pattern: pattern:
\(KEY DESCRIPTION ACTION) '(KEY DESCRIPTION ACTION)
where KEY, DESCRIPTION and ACTION are described above. where KEY, DESCRIPTION and ACTION are described above.
Valid values include: Valid values include:
\(?m \"My Special Back-end\" my-special-export-function) '(?m \"My Special Back-end\" my-special-export-function)
or or
\(?l \"Export to LaTeX\" '(?l \"Export to LaTeX\"
\(?p \"As PDF file\" org-latex-export-to-pdf) \(?p \"As PDF file\" org-latex-export-to-pdf)
\(?o \"As PDF file and open\" \(?o \"As PDF file and open\"
\(lambda (a s v b) \(lambda (a s v b)
@ -950,7 +950,7 @@ keywords are understood:
or the following, which will be added to the previous or the following, which will be added to the previous
sub-menu, sub-menu,
\(?l 1 '(?l 1
\((?B \"As TEX buffer (Beamer)\" org-beamer-export-as-latex) \((?B \"As TEX buffer (Beamer)\" org-beamer-export-as-latex)
\(?P \"As PDF file (Beamer)\" org-beamer-export-to-pdf))) \(?P \"As PDF file (Beamer)\" org-beamer-export-to-pdf)))
@ -960,8 +960,7 @@ keywords are understood:
communication channel and how their value are acquired. See communication channel and how their value are acquired. See
`org-export-options-alist' for more information about `org-export-options-alist' for more information about
structure of the values." structure of the values."
(declare (debug (&define name sexp [&rest [keywordp sexp]] defbody)) (declare (indent 1))
(indent 1))
(let (export-block filters menu-entry options contents) (let (export-block filters menu-entry options contents)
(while (keywordp (car body)) (while (keywordp (car body))
(case (pop body) (case (pop body)
@ -977,22 +976,19 @@ keywords are understood:
(and filters (list :filters-alist filters)) (and filters (list :filters-alist filters))
(and options (list :options-alist options)) (and options (list :options-alist options))
(and menu-entry (list :menu-entry menu-entry)))) (and menu-entry (list :menu-entry menu-entry))))
`(progn
;; Register back-end. ;; Register back-end.
(let ((registeredp (assq ',backend org-export-registered-backends))) (let ((registeredp (assq backend org-export-registered-backends)))
(if registeredp (setcdr registeredp ',contents) (if registeredp (setcdr registeredp contents)
(push (cons ',backend ',contents) org-export-registered-backends))) (push (cons backend contents) org-export-registered-backends)))
;; Tell parser to not parse EXPORT-BLOCK blocks. ;; Tell parser to not parse EXPORT-BLOCK blocks.
,(when export-block (when export-block
`(mapc (mapc
(lambda (name) (lambda (name)
(add-to-list 'org-element-block-name-alist (add-to-list 'org-element-block-name-alist
`(,name . org-element-export-block-parser))) `(,name . org-element-export-block-parser)))
',export-block)) export-block))))
;; Splice in the body, if any.
,@body)))
(defmacro org-export-define-derived-backend (child parent &rest body) (defun org-export-define-derived-backend (child parent &rest body)
"Create a new back-end as a variant of an existing one. "Create a new back-end as a variant of an existing one.
CHILD is the name of the derived back-end. PARENT is the name of CHILD is the name of the derived back-end. PARENT is the name of
@ -1038,14 +1034,13 @@ keywords are understood:
As an example, here is how one could define \"my-latex\" back-end As an example, here is how one could define \"my-latex\" back-end
as a variant of `latex' back-end with a custom template function: as a variant of `latex' back-end with a custom template function:
\(org-export-define-derived-backend my-latex latex \(org-export-define-derived-backend 'my-latex 'latex
:translate-alist ((template . my-latex-template-fun))) :translate-alist '((template . my-latex-template-fun)))
The back-end could then be called with, for example: The back-end could then be called with, for example:
\(org-export-to-buffer 'my-latex \"*Test my-latex*\")" \(org-export-to-buffer 'my-latex \"*Test my-latex*\")"
(declare (debug (&define name sexp [&rest [keywordp sexp]] def-body)) (declare (indent 2))
(indent 2))
(let (export-block filters menu-entry options translators contents) (let (export-block filters menu-entry options translators contents)
(while (keywordp (car body)) (while (keywordp (car body))
(case (pop body) (case (pop body)
@ -1067,21 +1062,18 @@ The back-end could then be called with, for example:
(let ((p-options (org-export-backend-options parent))) (let ((p-options (org-export-backend-options parent)))
(list :options-alist (append options p-options))) (list :options-alist (append options p-options)))
(and menu-entry (list :menu-entry menu-entry)))) (and menu-entry (list :menu-entry menu-entry))))
`(progn (org-export-barf-if-invalid-backend parent)
(org-export-barf-if-invalid-backend ',parent)
;; Register back-end. ;; Register back-end.
(let ((registeredp (assq ',child org-export-registered-backends))) (let ((registeredp (assq child org-export-registered-backends)))
(if registeredp (setcdr registeredp ',contents) (if registeredp (setcdr registeredp contents)
(push (cons ',child ',contents) org-export-registered-backends))) (push (cons child contents) org-export-registered-backends)))
;; Tell parser to not parse EXPORT-BLOCK blocks. ;; Tell parser to not parse EXPORT-BLOCK blocks.
,(when export-block (when export-block
`(mapc (mapc
(lambda (name) (lambda (name)
(add-to-list 'org-element-block-name-alist (add-to-list org-element-block-name-alist
`(,name . org-element-export-block-parser))) `(,name . org-element-export-block-parser)))
',export-block)) export-block))))
;; Splice in the body, if any.
,@body)))
(defun org-export-backend-parent (backend) (defun org-export-backend-parent (backend)
"Return back-end from which BACKEND is derived, or nil." "Return back-end from which BACKEND is derived, or nil."