From f0dc2d48b5d20ac991852b6ef1f71dcb692c4c3f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 14 Mar 2013 03:16:12 +0100 Subject: [PATCH] Use defuns for `org-export-define-backend' and `org-export-define-derived-backend' --- lisp/ox-ascii.el | 180 ++++++++--------- lisp/ox-beamer.el | 54 ++--- lisp/ox-html.el | 154 +++++++------- lisp/ox-icalendar.el | 44 ++-- lisp/ox-latex.el | 138 ++++++------- lisp/ox-man.el | 122 ++++++------ lisp/ox-md.el | 94 ++++----- lisp/ox-odt.el | 124 ++++++------ lisp/ox-org.el | 102 +++++----- lisp/ox-texinfo.el | 120 +++++------ lisp/ox.el | 60 +++--- testing/lisp/test-ox.el | 520 ++++++++++++++++++++++-------------------------- 12 files changed, 832 insertions(+), 880 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 6eb96b3..37e1b03 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -54,83 +54,83 @@ ;; We also install a filter for headlines and sections, in order to ;; control blank lines separating them in output string. -(org-export-define-backend ascii - ((bold . org-ascii-bold) - (center-block . org-ascii-center-block) - (clock . org-ascii-clock) - (code . org-ascii-code) - (comment . (lambda (&rest args) "")) - (comment-block . (lambda (&rest args) "")) - (drawer . org-ascii-drawer) - (dynamic-block . org-ascii-dynamic-block) - (entity . org-ascii-entity) - (example-block . org-ascii-example-block) - (export-block . org-ascii-export-block) - (export-snippet . org-ascii-export-snippet) - (fixed-width . org-ascii-fixed-width) - (footnote-definition . org-ascii-footnote-definition) - (footnote-reference . org-ascii-footnote-reference) - (headline . org-ascii-headline) - (horizontal-rule . org-ascii-horizontal-rule) - (inline-src-block . org-ascii-inline-src-block) - (inlinetask . org-ascii-inlinetask) - (inner-template . org-ascii-inner-template) - (italic . org-ascii-italic) - (item . org-ascii-item) - (keyword . org-ascii-keyword) - (latex-environment . org-ascii-latex-environment) - (latex-fragment . org-ascii-latex-fragment) - (line-break . org-ascii-line-break) - (link . org-ascii-link) - (paragraph . org-ascii-paragraph) - (plain-list . org-ascii-plain-list) - (plain-text . org-ascii-plain-text) - (planning . org-ascii-planning) - (quote-block . org-ascii-quote-block) - (quote-section . org-ascii-quote-section) - (radio-target . org-ascii-radio-target) - (section . org-ascii-section) - (special-block . org-ascii-special-block) - (src-block . org-ascii-src-block) - (statistics-cookie . org-ascii-statistics-cookie) - (strike-through . org-ascii-strike-through) - (subscript . org-ascii-subscript) - (superscript . org-ascii-superscript) - (table . org-ascii-table) - (table-cell . org-ascii-table-cell) - (table-row . org-ascii-table-row) - (target . org-ascii-target) - (template . org-ascii-template) - (timestamp . org-ascii-timestamp) - (underline . org-ascii-underline) - (verbatim . org-ascii-verbatim) - (verse-block . org-ascii-verse-block)) +(org-export-define-backend 'ascii + '((bold . org-ascii-bold) + (center-block . org-ascii-center-block) + (clock . org-ascii-clock) + (code . org-ascii-code) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) + (drawer . org-ascii-drawer) + (dynamic-block . org-ascii-dynamic-block) + (entity . org-ascii-entity) + (example-block . org-ascii-example-block) + (export-block . org-ascii-export-block) + (export-snippet . org-ascii-export-snippet) + (fixed-width . org-ascii-fixed-width) + (footnote-definition . org-ascii-footnote-definition) + (footnote-reference . org-ascii-footnote-reference) + (headline . org-ascii-headline) + (horizontal-rule . org-ascii-horizontal-rule) + (inline-src-block . org-ascii-inline-src-block) + (inlinetask . org-ascii-inlinetask) + (inner-template . org-ascii-inner-template) + (italic . org-ascii-italic) + (item . org-ascii-item) + (keyword . org-ascii-keyword) + (latex-environment . org-ascii-latex-environment) + (latex-fragment . org-ascii-latex-fragment) + (line-break . org-ascii-line-break) + (link . org-ascii-link) + (paragraph . org-ascii-paragraph) + (plain-list . org-ascii-plain-list) + (plain-text . org-ascii-plain-text) + (planning . org-ascii-planning) + (quote-block . org-ascii-quote-block) + (quote-section . org-ascii-quote-section) + (radio-target . org-ascii-radio-target) + (section . org-ascii-section) + (special-block . org-ascii-special-block) + (src-block . org-ascii-src-block) + (statistics-cookie . org-ascii-statistics-cookie) + (strike-through . org-ascii-strike-through) + (subscript . org-ascii-subscript) + (superscript . org-ascii-superscript) + (table . org-ascii-table) + (table-cell . org-ascii-table-cell) + (table-row . org-ascii-table-row) + (target . org-ascii-target) + (template . org-ascii-template) + (timestamp . org-ascii-timestamp) + (underline . org-ascii-underline) + (verbatim . org-ascii-verbatim) + (verse-block . org-ascii-verse-block)) :export-block "ASCII" :menu-entry - (?t "Export to Plain Text" - ((?A "As ASCII buffer" - (lambda (a s v b) - (org-ascii-export-as-ascii a s v b '(:ascii-charset ascii)))) - (?a "As ASCII file" - (lambda (a s v b) - (org-ascii-export-to-ascii a s v b '(:ascii-charset ascii)))) - (?L "As Latin1 buffer" - (lambda (a s v b) - (org-ascii-export-as-ascii a s v b '(:ascii-charset latin1)))) - (?l "As Latin1 file" - (lambda (a s v b) - (org-ascii-export-to-ascii a s v b '(:ascii-charset latin1)))) - (?U "As UTF-8 buffer" - (lambda (a s v b) - (org-ascii-export-as-ascii a s v b '(:ascii-charset utf-8)))) - (?u "As UTF-8 file" - (lambda (a s v b) - (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8)))))) - :filters-alist ((:filter-headline . org-ascii-filter-headline-blank-lines) - (:filter-parse-tree org-ascii-filter-paragraph-spacing - org-ascii-filter-comment-spacing) - (:filter-section . org-ascii-filter-headline-blank-lines)) - :options-alist ((:ascii-charset nil nil org-ascii-charset))) + '(?t "Export to Plain Text" + ((?A "As ASCII buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset ascii)))) + (?a "As ASCII file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset ascii)))) + (?L "As Latin1 buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset latin1)))) + (?l "As Latin1 file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset latin1)))) + (?U "As UTF-8 buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset utf-8)))) + (?u "As UTF-8 file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8)))))) + :filters-alist '((:filter-headline . org-ascii-filter-headline-blank-lines) + (:filter-parse-tree org-ascii-filter-paragraph-spacing + org-ascii-filter-comment-spacing) + (:filter-section . org-ascii-filter-headline-blank-lines)) + :options-alist '((:ascii-charset nil nil org-ascii-charset))) @@ -239,8 +239,8 @@ Possible values are: (const :tag "UTF-8" utf-8))) (defcustom org-ascii-underline '((ascii ?= ?~ ?-) - (latin1 ?= ?~ ?-) - (utf-8 ?═ ?─ ?╌ ?┄ ?┈)) + (latin1 ?= ?~ ?-) + (utf-8 ?═ ?─ ?╌ ?┄ ?┈)) "Characters for underlining headings in ASCII export. Alist whose key is a symbol among `ascii', `latin1' and `utf-8' @@ -1895,15 +1895,15 @@ is non-nil." (interactive) (if async (org-export-async-start - (lambda (output) - (with-current-buffer (get-buffer-create "*Org ASCII Export*") - (erase-buffer) - (insert output) - (goto-char (point-min)) - (text-mode) - (org-export-add-to-stack (current-buffer) 'ascii))) - `(org-export-as 'ascii ,subtreep ,visible-only ,body-only - ',ext-plist)) + (lambda (output) + (with-current-buffer (get-buffer-create "*Org ASCII Export*") + (erase-buffer) + (insert output) + (goto-char (point-min)) + (text-mode) + (org-export-add-to-stack (current-buffer) 'ascii))) + `(org-export-as 'ascii ,subtreep ,visible-only ,body-only + ',ext-plist)) (let ((outbuf (org-export-to-buffer 'ascii "*Org ASCII Export*" subtreep visible-only body-only ext-plist))) @@ -1944,10 +1944,10 @@ Return output file's name." (let ((outfile (org-export-output-file-name ".txt" subtreep))) (if async (org-export-async-start - (lambda (f) (org-export-add-to-stack f 'ascii)) - `(expand-file-name - (org-export-to-file - 'ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist))) + (lambda (f) (org-export-add-to-stack f 'ascii)) + `(expand-file-name + (org-export-to-file + 'ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist))) (org-export-to-file 'ascii outfile subtreep visible-only body-only ext-plist)))) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index f0f5ef0..dc427de 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -293,36 +293,36 @@ Return overlay specification, as a string, or nil." ;;; Define Back-End -(org-export-define-derived-backend beamer latex +(org-export-define-derived-backend 'beamer 'latex :export-block "BEAMER" :menu-entry - (?l 1 - ((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex) - (?b "As LaTeX file (Beamer)" org-beamer-export-to-latex) - (?P "As PDF file (Beamer)" org-beamer-export-to-pdf) - (?O "As PDF file and open (Beamer)" - (lambda (a 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))))))) + '(?l 1 + ((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex) + (?b "As LaTeX file (Beamer)" org-beamer-export-to-latex) + (?P "As PDF file (Beamer)" org-beamer-export-to-pdf) + (?O "As PDF file and open (Beamer)" + (lambda (a 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))))))) :options-alist - ((:beamer-theme "BEAMER_THEME" nil org-beamer-theme) - (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t) - (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t) - (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t) - (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t) - (:beamer-header-extra "BEAMER_HEADER" nil nil newline) - (:headline-levels nil "H" org-beamer-frame-level)) - :translate-alist ((bold . org-beamer-bold) - (export-block . org-beamer-export-block) - (export-snippet . org-beamer-export-snippet) - (headline . org-beamer-headline) - (item . org-beamer-item) - (keyword . org-beamer-keyword) - (link . org-beamer-link) - (plain-list . org-beamer-plain-list) - (radio-target . org-beamer-radio-target) - (target . org-beamer-target) - (template . org-beamer-template))) + '((:beamer-theme "BEAMER_THEME" nil org-beamer-theme) + (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t) + (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t) + (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t) + (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t) + (:beamer-header-extra "BEAMER_HEADER" nil nil newline) + (:headline-levels nil "H" org-beamer-frame-level)) + :translate-alist '((bold . org-beamer-bold) + (export-block . org-beamer-export-block) + (export-snippet . org-beamer-export-snippet) + (headline . org-beamer-headline) + (item . org-beamer-item) + (keyword . org-beamer-keyword) + (link . org-beamer-link) + (plain-list . org-beamer-plain-list) + (radio-target . org-beamer-radio-target) + (target . org-beamer-target) + (template . org-beamer-template))) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index a3c6852..8d17267 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -48,86 +48,86 @@ ;;; Define Back-End -(org-export-define-backend html - ((bold . org-html-bold) - (center-block . org-html-center-block) - (clock . org-html-clock) - (code . org-html-code) - (drawer . org-html-drawer) - (dynamic-block . org-html-dynamic-block) - (entity . org-html-entity) - (example-block . org-html-example-block) - (export-block . org-html-export-block) - (export-snippet . org-html-export-snippet) - (fixed-width . org-html-fixed-width) - (footnote-definition . org-html-footnote-definition) - (footnote-reference . org-html-footnote-reference) - (headline . org-html-headline) - (horizontal-rule . org-html-horizontal-rule) - (inline-src-block . org-html-inline-src-block) - (inlinetask . org-html-inlinetask) - (inner-template . org-html-inner-template) - (italic . org-html-italic) - (item . org-html-item) - (keyword . org-html-keyword) - (latex-environment . org-html-latex-environment) - (latex-fragment . org-html-latex-fragment) - (line-break . org-html-line-break) - (link . org-html-link) - (paragraph . org-html-paragraph) - (plain-list . org-html-plain-list) - (plain-text . org-html-plain-text) - (planning . org-html-planning) - (property-drawer . org-html-property-drawer) - (quote-block . org-html-quote-block) - (quote-section . org-html-quote-section) - (radio-target . org-html-radio-target) - (section . org-html-section) - (special-block . org-html-special-block) - (src-block . org-html-src-block) - (statistics-cookie . org-html-statistics-cookie) - (strike-through . org-html-strike-through) - (subscript . org-html-subscript) - (superscript . org-html-superscript) - (table . org-html-table) - (table-cell . org-html-table-cell) - (table-row . org-html-table-row) - (target . org-html-target) - (template . org-html-template) - (timestamp . org-html-timestamp) - (underline . org-html-underline) - (verbatim . org-html-verbatim) - (verse-block . org-html-verse-block)) +(org-export-define-backend 'html + '((bold . org-html-bold) + (center-block . org-html-center-block) + (clock . org-html-clock) + (code . org-html-code) + (drawer . org-html-drawer) + (dynamic-block . org-html-dynamic-block) + (entity . org-html-entity) + (example-block . org-html-example-block) + (export-block . org-html-export-block) + (export-snippet . org-html-export-snippet) + (fixed-width . org-html-fixed-width) + (footnote-definition . org-html-footnote-definition) + (footnote-reference . org-html-footnote-reference) + (headline . org-html-headline) + (horizontal-rule . org-html-horizontal-rule) + (inline-src-block . org-html-inline-src-block) + (inlinetask . org-html-inlinetask) + (inner-template . org-html-inner-template) + (italic . org-html-italic) + (item . org-html-item) + (keyword . org-html-keyword) + (latex-environment . org-html-latex-environment) + (latex-fragment . org-html-latex-fragment) + (line-break . org-html-line-break) + (link . org-html-link) + (paragraph . org-html-paragraph) + (plain-list . org-html-plain-list) + (plain-text . org-html-plain-text) + (planning . org-html-planning) + (property-drawer . org-html-property-drawer) + (quote-block . org-html-quote-block) + (quote-section . org-html-quote-section) + (radio-target . org-html-radio-target) + (section . org-html-section) + (special-block . org-html-special-block) + (src-block . org-html-src-block) + (statistics-cookie . org-html-statistics-cookie) + (strike-through . org-html-strike-through) + (subscript . org-html-subscript) + (superscript . org-html-superscript) + (table . org-html-table) + (table-cell . org-html-table-cell) + (table-row . org-html-table-row) + (target . org-html-target) + (template . org-html-template) + (timestamp . org-html-timestamp) + (underline . org-html-underline) + (verbatim . org-html-verbatim) + (verse-block . org-html-verse-block)) :export-block "HTML" - :filters-alist ((:filter-options . org-html-infojs-install-script) - (:filter-final-output . org-html-final-function)) + :filters-alist '((:filter-options . org-html-infojs-install-script) + (:filter-final-output . org-html-final-function)) :menu-entry - (?h "Export to HTML" - ((?H "As HTML buffer" org-html-export-as-html) - (?h "As HTML file" org-html-export-to-html) - (?o "As HTML file and open" - (lambda (a 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))))))) + '(?h "Export to HTML" + ((?H "As HTML buffer" org-html-export-as-html) + (?h "As HTML file" org-html-export-to-html) + (?o "As HTML file and open" + (lambda (a 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))))))) :options-alist - ((:html-extension nil nil org-html-extension) - (:html-doctype "HTML_DOCTYPE" nil org-html-doctype) - (:html-container "HTML_CONTAINER" nil org-html-container-element) - (:html-link-home "HTML_LINK_HOME" nil org-html-link-home) - (:html-link-up "HTML_LINK_UP" nil org-html-link-up) - (:html-mathjax "HTML_MATHJAX" nil "" space) - (:html-postamble nil "html-postamble" org-html-postamble) - (:html-preamble nil "html-preamble" org-html-preamble) - (:html-head "HTML_HEAD" nil org-html-head newline) - (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline) - (:html-head-include-default-style "HTML_INCLUDE_STYLE" nil org-html-head-include-default-style newline) - (:html-head-include-scripts "HTML_INCLUDE_SCRIPTS" nil org-html-head-include-scripts newline) - (:html-table-tag nil nil org-html-table-tag) - ;; Redefine regular options. - (:creator "CREATOR" nil org-html-creator-string) - (:with-latex nil "tex" org-html-with-latex) - ;; Leave room for "ox-infojs.el" extension. - (:infojs-opt "INFOJS_OPT" nil nil))) + '((:html-extension nil nil org-html-extension) + (:html-doctype "HTML_DOCTYPE" nil org-html-doctype) + (:html-container "HTML_CONTAINER" nil org-html-container-element) + (:html-link-home "HTML_LINK_HOME" nil org-html-link-home) + (:html-link-up "HTML_LINK_UP" nil org-html-link-up) + (:html-mathjax "HTML_MATHJAX" nil "" space) + (:html-postamble nil "html-postamble" org-html-postamble) + (:html-preamble nil "html-preamble" org-html-preamble) + (:html-head "HTML_HEAD" nil org-html-head newline) + (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline) + (:html-head-include-default-style "HTML_INCLUDE_STYLE" nil org-html-head-include-default-style newline) + (:html-head-include-scripts "HTML_INCLUDE_SCRIPTS" nil org-html-head-include-scripts newline) + (:html-table-tag nil nil org-html-table-tag) + ;; Redefine regular options. + (:creator "CREATOR" nil org-html-creator-string) + (:with-latex nil "tex" org-html-with-latex) + ;; Leave room for "ox-infojs.el" extension. + (:infojs-opt "INFOJS_OPT" nil nil))) ;;; Internal Variables diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 0f0e7b9..5626a01 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -255,31 +255,31 @@ re-read the iCalendar file.") ;;; Define Back-End -(org-export-define-derived-backend icalendar ascii - :translate-alist ((clock . ignore) - (headline . org-icalendar-entry) - (inlinetask . ignore) - (planning . ignore) - (section . ignore) - (template . org-icalendar-template)) +(org-export-define-derived-backend 'icalendar 'ascii + :translate-alist '((clock . ignore) + (headline . org-icalendar-entry) + (inlinetask . ignore) + (planning . ignore) + (section . ignore) + (template . org-icalendar-template)) :options-alist - ((:exclude-tags - "ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split) - (:with-timestamps nil "<" org-icalendar-with-timestamps) - (:with-vtodo nil nil org-icalendar-include-todo) - ;; The following property will be non-nil when export has been - ;; started from org-agenda-mode. In this case, any entry without - ;; a non-nil "ICALENDAR_MARK" property will be ignored. - (:icalendar-agenda-view nil nil nil)) + '((:exclude-tags + "ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split) + (:with-timestamps nil "<" org-icalendar-with-timestamps) + (:with-vtodo nil nil org-icalendar-include-todo) + ;; The following property will be non-nil when export has been + ;; started from org-agenda-mode. In this case, any entry without + ;; a non-nil "ICALENDAR_MARK" property will be ignored. + (:icalendar-agenda-view nil nil nil)) :filters-alist - ((:filter-headline . org-icalendar-clear-blank-lines)) + '((:filter-headline . org-icalendar-clear-blank-lines)) :menu-entry - (?c "Export to iCalendar" - ((?f "Current file" org-icalendar-export-to-ics) - (?a "All agenda files" - (lambda (a s v b) (org-icalendar-export-agenda-files a))) - (?c "Combine all agenda files" - (lambda (a s v b) (org-icalendar-combine-agenda-files a)))))) + '(?c "Export to iCalendar" + ((?f "Current file" org-icalendar-export-to-ics) + (?a "All agenda files" + (lambda (a s v b) (org-icalendar-export-agenda-files a))) + (?c "Combine all agenda files" + (lambda (a s v b) (org-icalendar-combine-agenda-files a)))))) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index fa66bb4..d8d5b64 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -115,76 +115,76 @@ ;;; Define Back-End -(org-export-define-backend latex - ((bold . org-latex-bold) - (center-block . org-latex-center-block) - (clock . org-latex-clock) - (code . org-latex-code) - (comment . (lambda (&rest args) "")) - (comment-block . (lambda (&rest args) "")) - (drawer . org-latex-drawer) - (dynamic-block . org-latex-dynamic-block) - (entity . org-latex-entity) - (example-block . org-latex-example-block) - (export-block . org-latex-export-block) - (export-snippet . org-latex-export-snippet) - (fixed-width . org-latex-fixed-width) - (footnote-definition . org-latex-footnote-definition) - (footnote-reference . org-latex-footnote-reference) - (headline . org-latex-headline) - (horizontal-rule . org-latex-horizontal-rule) - (inline-src-block . org-latex-inline-src-block) - (inlinetask . org-latex-inlinetask) - (italic . org-latex-italic) - (item . org-latex-item) - (keyword . org-latex-keyword) - (latex-environment . org-latex-latex-environment) - (latex-fragment . org-latex-latex-fragment) - (line-break . org-latex-line-break) - (link . org-latex-link) - (paragraph . org-latex-paragraph) - (plain-list . org-latex-plain-list) - (plain-text . org-latex-plain-text) - (planning . org-latex-planning) - (property-drawer . (lambda (&rest args) "")) - (quote-block . org-latex-quote-block) - (quote-section . org-latex-quote-section) - (radio-target . org-latex-radio-target) - (section . org-latex-section) - (special-block . org-latex-special-block) - (src-block . org-latex-src-block) - (statistics-cookie . org-latex-statistics-cookie) - (strike-through . org-latex-strike-through) - (subscript . org-latex-subscript) - (superscript . org-latex-superscript) - (table . org-latex-table) - (table-cell . org-latex-table-cell) - (table-row . org-latex-table-row) - (target . org-latex-target) - (template . org-latex-template) - (timestamp . org-latex-timestamp) - (underline . org-latex-underline) - (verbatim . org-latex-verbatim) - (verse-block . org-latex-verse-block)) - :export-block ("LATEX" "TEX") +(org-export-define-backend 'latex + '((bold . org-latex-bold) + (center-block . org-latex-center-block) + (clock . org-latex-clock) + (code . org-latex-code) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) + (drawer . org-latex-drawer) + (dynamic-block . org-latex-dynamic-block) + (entity . org-latex-entity) + (example-block . org-latex-example-block) + (export-block . org-latex-export-block) + (export-snippet . org-latex-export-snippet) + (fixed-width . org-latex-fixed-width) + (footnote-definition . org-latex-footnote-definition) + (footnote-reference . org-latex-footnote-reference) + (headline . org-latex-headline) + (horizontal-rule . org-latex-horizontal-rule) + (inline-src-block . org-latex-inline-src-block) + (inlinetask . org-latex-inlinetask) + (italic . org-latex-italic) + (item . org-latex-item) + (keyword . org-latex-keyword) + (latex-environment . org-latex-latex-environment) + (latex-fragment . org-latex-latex-fragment) + (line-break . org-latex-line-break) + (link . org-latex-link) + (paragraph . org-latex-paragraph) + (plain-list . org-latex-plain-list) + (plain-text . org-latex-plain-text) + (planning . org-latex-planning) + (property-drawer . (lambda (&rest args) "")) + (quote-block . org-latex-quote-block) + (quote-section . org-latex-quote-section) + (radio-target . org-latex-radio-target) + (section . org-latex-section) + (special-block . org-latex-special-block) + (src-block . org-latex-src-block) + (statistics-cookie . org-latex-statistics-cookie) + (strike-through . org-latex-strike-through) + (subscript . org-latex-subscript) + (superscript . org-latex-superscript) + (table . org-latex-table) + (table-cell . org-latex-table-cell) + (table-row . org-latex-table-row) + (target . org-latex-target) + (template . org-latex-template) + (timestamp . org-latex-timestamp) + (underline . org-latex-underline) + (verbatim . org-latex-verbatim) + (verse-block . org-latex-verse-block)) + :export-block '("LATEX" "TEX") :menu-entry - (?l "Export to LaTeX" - ((?L "As LaTeX buffer" org-latex-export-as-latex) - (?l "As LaTeX file" org-latex-export-to-latex) - (?p "As PDF file" org-latex-export-to-pdf) - (?o "As PDF file and open" - (lambda (a 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))))))) - :options-alist ((:date-format nil nil org-latex-date-timestamp-format) - (:latex-class "LATEX_CLASS" nil org-latex-default-class t) - (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t) - (:latex-header "LATEX_HEADER" nil nil newline) - (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline) - (:latex-hyperref-p nil "texht" org-latex-with-hyperref t) - ;; Redefine regular options. - (:date "DATE" nil "\\today" t) - (:with-smart-quotes nil "'" t))) + '(?l "Export to LaTeX" + ((?L "As LaTeX buffer" org-latex-export-as-latex) + (?l "As LaTeX file" org-latex-export-to-latex) + (?p "As PDF file" org-latex-export-to-pdf) + (?o "As PDF file and open" + (lambda (a 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))))))) + :options-alist '((:date-format nil nil org-latex-date-timestamp-format) + (:latex-class "LATEX_CLASS" nil org-latex-default-class t) + (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t) + (:latex-header "LATEX_HEADER" nil nil newline) + (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline) + (:latex-hyperref-p nil "texht" org-latex-with-hyperref t) + ;; Redefine regular options. + (:date "DATE" nil "\\today" t) + (:with-smart-quotes nil "'" t))) diff --git a/lisp/ox-man.el b/lisp/ox-man.el index 7fc7f02..a98182b 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -49,70 +49,70 @@ ;;; Define Back-End -(org-export-define-backend man - ((babel-call . org-man-babel-call) - (bold . org-man-bold) - (center-block . org-man-center-block) - (clock . org-man-clock) - (code . org-man-code) - (comment . (lambda (&rest args) "")) - (comment-block . (lambda (&rest args) "")) - (drawer . org-man-drawer) - (dynamic-block . org-man-dynamic-block) - (entity . org-man-entity) - (example-block . org-man-example-block) - (export-block . org-man-export-block) - (export-snippet . org-man-export-snippet) - (fixed-width . org-man-fixed-width) - (footnote-definition . org-man-footnote-definition) - (footnote-reference . org-man-footnote-reference) - (headline . org-man-headline) - (horizontal-rule . org-man-horizontal-rule) - (inline-babel-call . org-man-inline-babel-call) - (inline-src-block . org-man-inline-src-block) - (inlinetask . org-man-inlinetask) - (italic . org-man-italic) - (item . org-man-item) - (keyword . org-man-keyword) - (line-break . org-man-line-break) - (link . org-man-link) - (paragraph . org-man-paragraph) - (plain-list . org-man-plain-list) - (plain-text . org-man-plain-text) - (planning . org-man-planning) - (property-drawer . (lambda (&rest args) "")) - (quote-block . org-man-quote-block) - (quote-section . org-man-quote-section) - (radio-target . org-man-radio-target) - (section . org-man-section) - (special-block . org-man-special-block) - (src-block . org-man-src-block) - (statistics-cookie . org-man-statistics-cookie) - (strike-through . org-man-strike-through) - (subscript . org-man-subscript) - (superscript . org-man-superscript) - (table . org-man-table) - (table-cell . org-man-table-cell) - (table-row . org-man-table-row) - (target . org-man-target) - (template . org-man-template) - (timestamp . org-man-timestamp) - (underline . org-man-underline) - (verbatim . org-man-verbatim) - (verse-block . org-man-verse-block)) +(org-export-define-backend 'man + '((babel-call . org-man-babel-call) + (bold . org-man-bold) + (center-block . org-man-center-block) + (clock . org-man-clock) + (code . org-man-code) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) + (drawer . org-man-drawer) + (dynamic-block . org-man-dynamic-block) + (entity . org-man-entity) + (example-block . org-man-example-block) + (export-block . org-man-export-block) + (export-snippet . org-man-export-snippet) + (fixed-width . org-man-fixed-width) + (footnote-definition . org-man-footnote-definition) + (footnote-reference . org-man-footnote-reference) + (headline . org-man-headline) + (horizontal-rule . org-man-horizontal-rule) + (inline-babel-call . org-man-inline-babel-call) + (inline-src-block . org-man-inline-src-block) + (inlinetask . org-man-inlinetask) + (italic . org-man-italic) + (item . org-man-item) + (keyword . org-man-keyword) + (line-break . org-man-line-break) + (link . org-man-link) + (paragraph . org-man-paragraph) + (plain-list . org-man-plain-list) + (plain-text . org-man-plain-text) + (planning . org-man-planning) + (property-drawer . (lambda (&rest args) "")) + (quote-block . org-man-quote-block) + (quote-section . org-man-quote-section) + (radio-target . org-man-radio-target) + (section . org-man-section) + (special-block . org-man-special-block) + (src-block . org-man-src-block) + (statistics-cookie . org-man-statistics-cookie) + (strike-through . org-man-strike-through) + (subscript . org-man-subscript) + (superscript . org-man-superscript) + (table . org-man-table) + (table-cell . org-man-table-cell) + (table-row . org-man-table-row) + (target . org-man-target) + (template . org-man-template) + (timestamp . org-man-timestamp) + (underline . org-man-underline) + (verbatim . org-man-verbatim) + (verse-block . org-man-verse-block)) :export-block "MAN" :menu-entry - (?m "Export to MAN" - ((?m "As MAN file" org-man-export-to-man) - (?p "As PDF file" org-man-export-to-pdf) - (?o "As PDF file and open" - (lambda (a 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))))))) + '(?m "Export to MAN" + ((?m "As MAN file" org-man-export-to-man) + (?p "As PDF file" org-man-export-to-pdf) + (?o "As PDF file and open" + (lambda (a 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))))))) :options-alist - ((:man-class "MAN_CLASS" nil nil t) - (:man-class-options "MAN_CLASS_OPTIONS" nil nil t) - (:man-header-extra "MAN_HEADER" nil nil newline))) + '((:man-class "MAN_CLASS" nil nil t) + (:man-class-options "MAN_CLASS_OPTIONS" nil nil t) + (:man-header-extra "MAN_HEADER" nil nil newline))) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 959ecd1..fe97d0e 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -55,43 +55,43 @@ This variable can be set to either `atx' or `setext'." ;;; Define Back-End -(org-export-define-derived-backend md html - :export-block ("MD" "MARKDOWN") - :filters-alist ((:filter-parse-tree . org-md-separate-elements)) +(org-export-define-derived-backend 'md 'html + :export-block '("MD" "MARKDOWN") + :filters-alist '((:filter-parse-tree . org-md-separate-elements)) :menu-entry - (?m "Export to Markdown" - ((?M "To temporary buffer" - (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))) - (?o "To file and open" - (lambda (a s v b) - (if a (org-md-export-to-markdown t s v) - (org-open-file (org-md-export-to-markdown nil s v))))))) - :translate-alist ((bold . org-md-bold) - (code . org-md-verbatim) - (underline . org-md-verbatim) - (comment . (lambda (&rest args) "")) - (comment-block . (lambda (&rest args) "")) - (example-block . org-md-example-block) - (fixed-width . org-md-example-block) - (footnote-definition . ignore) - (footnote-reference . ignore) - (headline . org-md-headline) - (horizontal-rule . org-md-horizontal-rule) - (inline-src-block . org-md-verbatim) - (italic . org-md-italic) - (item . org-md-item) - (line-break . org-md-line-break) - (link . org-md-link) - (paragraph . org-md-paragraph) - (plain-list . org-md-plain-list) - (plain-text . org-md-plain-text) - (quote-block . org-md-quote-block) - (quote-section . org-md-example-block) - (section . org-md-section) - (src-block . org-md-example-block) - (template . org-md-template) - (verbatim . org-md-verbatim))) + '(?m "Export to Markdown" + ((?M "To temporary buffer" + (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))) + (?o "To file and open" + (lambda (a s v b) + (if a (org-md-export-to-markdown t s v) + (org-open-file (org-md-export-to-markdown nil s v))))))) + :translate-alist '((bold . org-md-bold) + (code . org-md-verbatim) + (underline . org-md-verbatim) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) + (example-block . org-md-example-block) + (fixed-width . org-md-example-block) + (footnote-definition . ignore) + (footnote-reference . ignore) + (headline . org-md-headline) + (horizontal-rule . org-md-horizontal-rule) + (inline-src-block . org-md-verbatim) + (italic . org-md-italic) + (item . org-md-item) + (line-break . org-md-line-break) + (link . org-md-link) + (paragraph . org-md-paragraph) + (plain-list . org-md-plain-list) + (plain-text . org-md-plain-text) + (quote-block . org-md-quote-block) + (quote-section . org-md-example-block) + (section . org-md-section) + (src-block . org-md-example-block) + (template . org-md-template) + (verbatim . org-md-verbatim))) @@ -443,14 +443,14 @@ non-nil." (interactive) (if async (org-export-async-start - (lambda (output) - (with-current-buffer (get-buffer-create "*Org MD Export*") - (erase-buffer) - (insert output) - (goto-char (point-min)) - (text-mode) - (org-export-add-to-stack (current-buffer) 'md))) - `(org-export-as 'md ,subtreep ,visible-only)) + (lambda (output) + (with-current-buffer (get-buffer-create "*Org MD Export*") + (erase-buffer) + (insert output) + (goto-char (point-min)) + (text-mode) + (org-export-add-to-stack (current-buffer) 'md))) + `(org-export-as 'md ,subtreep ,visible-only)) (let ((outbuf (org-export-to-buffer 'md "*Org MD Export*" subtreep visible-only))) (with-current-buffer outbuf (text-mode)) @@ -483,9 +483,9 @@ Return output file's name." (let ((outfile (org-export-output-file-name ".md" subtreep))) (if async (org-export-async-start - (lambda (f) (org-export-add-to-stack f 'md)) - `(expand-file-name - (org-export-to-file 'md ,outfile ,subtreep ,visible-only))) + (lambda (f) (org-export-add-to-stack f 'md)) + `(expand-file-name + (org-export-to-file 'md ,outfile ,subtreep ,visible-only))) (org-export-to-file 'md outfile subtreep visible-only)))) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index e700600..dd0f9d9 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -34,71 +34,71 @@ ;;; Define Back-End -(org-export-define-backend odt - ((bold . org-odt-bold) - (center-block . org-odt-center-block) - (clock . org-odt-clock) - (code . org-odt-code) - (drawer . org-odt-drawer) - (dynamic-block . org-odt-dynamic-block) - (entity . org-odt-entity) - (example-block . org-odt-example-block) - (export-block . org-odt-export-block) - (export-snippet . org-odt-export-snippet) - (fixed-width . org-odt-fixed-width) - (footnote-definition . org-odt-footnote-definition) - (footnote-reference . org-odt-footnote-reference) - (headline . org-odt-headline) - (horizontal-rule . org-odt-horizontal-rule) - (inline-src-block . org-odt-inline-src-block) - (inlinetask . org-odt-inlinetask) - (italic . org-odt-italic) - (item . org-odt-item) - (keyword . org-odt-keyword) - (latex-environment . org-odt-latex-environment) - (latex-fragment . org-odt-latex-fragment) - (line-break . org-odt-line-break) - (link . org-odt-link) - (paragraph . org-odt-paragraph) - (plain-list . org-odt-plain-list) - (plain-text . org-odt-plain-text) - (planning . org-odt-planning) - (property-drawer . org-odt-property-drawer) - (quote-block . org-odt-quote-block) - (quote-section . org-odt-quote-section) - (radio-target . org-odt-radio-target) - (section . org-odt-section) - (special-block . org-odt-special-block) - (src-block . org-odt-src-block) - (statistics-cookie . org-odt-statistics-cookie) - (strike-through . org-odt-strike-through) - (subscript . org-odt-subscript) - (superscript . org-odt-superscript) - (table . org-odt-table) - (table-cell . org-odt-table-cell) - (table-row . org-odt-table-row) - (target . org-odt-target) - (template . org-odt-template) - (timestamp . org-odt-timestamp) - (underline . org-odt-underline) - (verbatim . org-odt-verbatim) - (verse-block . org-odt-verse-block)) +(org-export-define-backend 'odt + '((bold . org-odt-bold) + (center-block . org-odt-center-block) + (clock . org-odt-clock) + (code . org-odt-code) + (drawer . org-odt-drawer) + (dynamic-block . org-odt-dynamic-block) + (entity . org-odt-entity) + (example-block . org-odt-example-block) + (export-block . org-odt-export-block) + (export-snippet . org-odt-export-snippet) + (fixed-width . org-odt-fixed-width) + (footnote-definition . org-odt-footnote-definition) + (footnote-reference . org-odt-footnote-reference) + (headline . org-odt-headline) + (horizontal-rule . org-odt-horizontal-rule) + (inline-src-block . org-odt-inline-src-block) + (inlinetask . org-odt-inlinetask) + (italic . org-odt-italic) + (item . org-odt-item) + (keyword . org-odt-keyword) + (latex-environment . org-odt-latex-environment) + (latex-fragment . org-odt-latex-fragment) + (line-break . org-odt-line-break) + (link . org-odt-link) + (paragraph . org-odt-paragraph) + (plain-list . org-odt-plain-list) + (plain-text . org-odt-plain-text) + (planning . org-odt-planning) + (property-drawer . org-odt-property-drawer) + (quote-block . org-odt-quote-block) + (quote-section . org-odt-quote-section) + (radio-target . org-odt-radio-target) + (section . org-odt-section) + (special-block . org-odt-special-block) + (src-block . org-odt-src-block) + (statistics-cookie . org-odt-statistics-cookie) + (strike-through . org-odt-strike-through) + (subscript . org-odt-subscript) + (superscript . org-odt-superscript) + (table . org-odt-table) + (table-cell . org-odt-table-cell) + (table-row . org-odt-table-row) + (target . org-odt-target) + (template . org-odt-template) + (timestamp . org-odt-timestamp) + (underline . org-odt-underline) + (verbatim . org-odt-verbatim) + (verse-block . org-odt-verse-block)) :export-block "ODT" - :filters-alist ((:filter-parse-tree - . (org-odt--translate-latex-fragments - org-odt--translate-description-lists - org-odt--translate-list-tables))) + :filters-alist '((:filter-parse-tree + . (org-odt--translate-latex-fragments + org-odt--translate-description-lists + org-odt--translate-list-tables))) :menu-entry - (?o "Export to ODT" - ((?o "As ODT file" org-odt-export-to-odt) - (?O "As ODT file and open" - (lambda (a s v b) - (if a (org-odt-export-to-odt t s v) - (org-open-file (org-odt-export-to-odt nil s v) 'system)))))) + '(?o "Export to ODT" + ((?o "As ODT file" org-odt-export-to-odt) + (?O "As ODT file and open" + (lambda (a s v b) + (if a (org-odt-export-to-odt t s v) + (org-open-file (org-odt-export-to-odt nil s v) 'system)))))) :options-alist - ((:odt-styles-file "ODT_STYLES_FILE" nil nil t) - ;; Redefine regular option. - (:with-latex nil "tex" org-odt-with-latex))) + '((:odt-styles-file "ODT_STYLES_FILE" nil nil t) + ;; Redefine regular option. + (:with-latex nil "tex" org-odt-with-latex))) ;;; Dependencies diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 373589f..d7b96b7 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -52,57 +52,57 @@ setting of `org-html-htmlize-output-type' is 'css." (const :tag "Don't include external stylesheet link" nil) (string :tag "URL or local href"))) -(org-export-define-backend org - ((babel-call . org-org-identity) - (bold . org-org-identity) - (center-block . org-org-identity) - (clock . org-org-identity) - (code . org-org-identity) - (comment . (lambda (&rest args) "")) - (comment-block . (lambda (&rest args) "")) - (diary-sexp . org-org-identity) - (drawer . org-org-identity) - (dynamic-block . org-org-identity) - (entity . org-org-identity) - (example-block . org-org-identity) - (fixed-width . org-org-identity) - (footnote-definition . org-org-identity) - (footnote-reference . org-org-identity) - (headline . org-org-headline) - (horizontal-rule . org-org-identity) - (inline-babel-call . org-org-identity) - (inline-src-block . org-org-identity) - (inlinetask . org-org-identity) - (italic . org-org-identity) - (item . org-org-identity) - (keyword . org-org-keyword) - (latex-environment . org-org-identity) - (latex-fragment . org-org-identity) - (line-break . org-org-identity) - (link . org-org-identity) - (node-property . org-org-identity) - (paragraph . org-org-identity) - (plain-list . org-org-identity) - (planning . org-org-identity) - (property-drawer . org-org-identity) - (quote-block . org-org-identity) - (quote-section . org-org-identity) - (radio-target . org-org-identity) - (section . org-org-identity) - (special-block . org-org-identity) - (src-block . org-org-identity) - (statistics-cookie . org-org-identity) - (strike-through . org-org-identity) - (subscript . org-org-identity) - (superscript . org-org-identity) - (table . org-org-identity) - (table-cell . org-org-identity) - (table-row . org-org-identity) - (target . org-org-identity) - (timestamp . org-org-identity) - (underline . org-org-identity) - (verbatim . org-org-identity) - (verse-block . org-org-identity))) +(org-export-define-backend 'org + '((babel-call . org-org-identity) + (bold . org-org-identity) + (center-block . org-org-identity) + (clock . org-org-identity) + (code . org-org-identity) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) + (diary-sexp . org-org-identity) + (drawer . org-org-identity) + (dynamic-block . org-org-identity) + (entity . org-org-identity) + (example-block . org-org-identity) + (fixed-width . org-org-identity) + (footnote-definition . org-org-identity) + (footnote-reference . org-org-identity) + (headline . org-org-headline) + (horizontal-rule . org-org-identity) + (inline-babel-call . org-org-identity) + (inline-src-block . org-org-identity) + (inlinetask . org-org-identity) + (italic . org-org-identity) + (item . org-org-identity) + (keyword . org-org-keyword) + (latex-environment . org-org-identity) + (latex-fragment . org-org-identity) + (line-break . org-org-identity) + (link . org-org-identity) + (node-property . org-org-identity) + (paragraph . org-org-identity) + (plain-list . org-org-identity) + (planning . org-org-identity) + (property-drawer . org-org-identity) + (quote-block . org-org-identity) + (quote-section . org-org-identity) + (radio-target . org-org-identity) + (section . org-org-identity) + (special-block . org-org-identity) + (src-block . org-org-identity) + (statistics-cookie . org-org-identity) + (strike-through . org-org-identity) + (subscript . org-org-identity) + (superscript . org-org-identity) + (table . org-org-identity) + (table-cell . org-org-identity) + (table-row . org-org-identity) + (target . org-org-identity) + (timestamp . org-org-identity) + (underline . org-org-identity) + (verbatim . org-org-identity) + (verse-block . org-org-identity))) (defun org-org-identity (blob contents info) "Transcode BLOB element or object back into Org syntax." diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 27bde3e..dfd0a91 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -65,70 +65,70 @@ ;;; Define Back-End -(org-export-define-backend texinfo - ((bold . org-texinfo-bold) - (center-block . org-texinfo-center-block) - (clock . org-texinfo-clock) - (code . org-texinfo-code) - (comment . org-texinfo-comment) - (comment-block . org-texinfo-comment-block) - (drawer . org-texinfo-drawer) - (dynamic-block . org-texinfo-dynamic-block) - (entity . org-texinfo-entity) - (example-block . org-texinfo-example-block) - (export-block . org-texinfo-export-block) - (export-snippet . org-texinfo-export-snippet) - (fixed-width . org-texinfo-fixed-width) - (footnote-definition . org-texinfo-footnote-definition) - (footnote-reference . org-texinfo-footnote-reference) - (headline . org-texinfo-headline) - (inline-src-block . org-texinfo-inline-src-block) - (inlinetask . org-texinfo-inlinetask) - (italic . org-texinfo-italic) - (item . org-texinfo-item) - (keyword . org-texinfo-keyword) - (line-break . org-texinfo-line-break) - (link . org-texinfo-link) - (paragraph . org-texinfo-paragraph) - (plain-list . org-texinfo-plain-list) - (plain-text . org-texinfo-plain-text) - (planning . org-texinfo-planning) - (property-drawer . org-texinfo-property-drawer) - (quote-block . org-texinfo-quote-block) - (quote-section . org-texinfo-quote-section) - (radio-target . org-texinfo-radio-target) - (section . org-texinfo-section) - (special-block . org-texinfo-special-block) - (src-block . org-texinfo-src-block) - (statistics-cookie . org-texinfo-statistics-cookie) - (subscript . org-texinfo-subscript) - (superscript . org-texinfo-superscript) - (table . org-texinfo-table) - (table-cell . org-texinfo-table-cell) - (table-row . org-texinfo-table-row) - (target . org-texinfo-target) - (template . org-texinfo-template) - (timestamp . org-texinfo-timestamp) - (verbatim . org-texinfo-verbatim) - (verse-block . org-texinfo-verse-block)) +(org-export-define-backend 'texinfo + '((bold . org-texinfo-bold) + (center-block . org-texinfo-center-block) + (clock . org-texinfo-clock) + (code . org-texinfo-code) + (comment . org-texinfo-comment) + (comment-block . org-texinfo-comment-block) + (drawer . org-texinfo-drawer) + (dynamic-block . org-texinfo-dynamic-block) + (entity . org-texinfo-entity) + (example-block . org-texinfo-example-block) + (export-block . org-texinfo-export-block) + (export-snippet . org-texinfo-export-snippet) + (fixed-width . org-texinfo-fixed-width) + (footnote-definition . org-texinfo-footnote-definition) + (footnote-reference . org-texinfo-footnote-reference) + (headline . org-texinfo-headline) + (inline-src-block . org-texinfo-inline-src-block) + (inlinetask . org-texinfo-inlinetask) + (italic . org-texinfo-italic) + (item . org-texinfo-item) + (keyword . org-texinfo-keyword) + (line-break . org-texinfo-line-break) + (link . org-texinfo-link) + (paragraph . org-texinfo-paragraph) + (plain-list . org-texinfo-plain-list) + (plain-text . org-texinfo-plain-text) + (planning . org-texinfo-planning) + (property-drawer . org-texinfo-property-drawer) + (quote-block . org-texinfo-quote-block) + (quote-section . org-texinfo-quote-section) + (radio-target . org-texinfo-radio-target) + (section . org-texinfo-section) + (special-block . org-texinfo-special-block) + (src-block . org-texinfo-src-block) + (statistics-cookie . org-texinfo-statistics-cookie) + (subscript . org-texinfo-subscript) + (superscript . org-texinfo-superscript) + (table . org-texinfo-table) + (table-cell . org-texinfo-table-cell) + (table-row . org-texinfo-table-row) + (target . org-texinfo-target) + (template . org-texinfo-template) + (timestamp . org-texinfo-timestamp) + (verbatim . org-texinfo-verbatim) + (verse-block . org-texinfo-verse-block)) :export-block "TEXINFO" :filters-alist - ((:filter-headline . org-texinfo-filter-section-blank-lines) - (:filter-section . org-texinfo-filter-section-blank-lines)) + '((:filter-headline . org-texinfo-filter-section-blank-lines) + (:filter-section . org-texinfo-filter-section-blank-lines)) :menu-entry - (?i "Export to Texinfo" - ((?t "As TEXI file" org-texinfo-export-to-texinfo) - (?i "As INFO file" org-texinfo-export-to-info))) + '(?i "Export to Texinfo" + ((?t "As TEXI file" org-texinfo-export-to-texinfo) + (?i "As INFO file" org-texinfo-export-to-info))) :options-alist - ((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t) - (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) - (:texinfo-header "TEXINFO_HEADER" nil nil newline) - (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) - (:subtitle "SUBTITLE" nil nil newline) - (:subauthor "SUBAUTHOR" nil nil newline) - (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) - (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) - (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t))) + '((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t) + (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) + (:texinfo-header "TEXINFO_HEADER" nil nil newline) + (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) + (:subtitle "SUBTITLE" nil nil newline) + (:subauthor "SUBAUTHOR" nil nil newline) + (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) + (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) + (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t))) diff --git a/lisp/ox.el b/lisp/ox.el index c5b6d7c..3c3bfd6 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -838,7 +838,7 @@ mode." ;; Eventually `org-export-barf-if-invalid-backend' returns an error ;; 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. TRANSLATORS is an alist between object or element types and @@ -956,8 +956,6 @@ keywords are understood: communication channel and how their value are acquired. See `org-export-options-alist' for more information about structure of the values." - (declare (debug (&define name sexp [&rest [keywordp sexp]] defbody)) - (indent 1)) (let (export-block filters menu-entry options contents) (while (keywordp (car body)) (case (pop body) @@ -973,22 +971,23 @@ keywords are understood: (and filters (list :filters-alist filters)) (and options (list :options-alist options)) (and menu-entry (list :menu-entry menu-entry)))) - `(progn - ;; Register back-end. - (let ((registeredp (assq ',backend org-export-registered-backends))) - (if registeredp (setcdr registeredp ',contents) - (push (cons ',backend ',contents) org-export-registered-backends))) - ;; Tell parser to not parse EXPORT-BLOCK blocks. - ,(when export-block - `(mapc - (lambda (name) - (add-to-list 'org-element-block-name-alist - `(,name . org-element-export-block-parser))) - ',export-block)) + (progn + ;; Register back-end. + (let ((registeredp (assq backend org-export-registered-backends))) + (if registeredp (setcdr registeredp contents) + (push (cons backend contents) org-export-registered-backends))) + ;; Tell parser to not parse EXPORT-BLOCK blocks. + (when export-block + (mapc + (lambda (name) + (add-to-list 'org-element-block-name-alist + `(,name . org-element-export-block-parser))) + export-block)) ;; Splice in the body, if any. - ,@body))) + body))) +(put 'org-element-map 'lisp-indent-function 1) -(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. CHILD is the name of the derived back-end. PARENT is the name of @@ -1040,8 +1039,6 @@ as a variant of `latex' back-end with a custom template function: The back-end could then be called with, for example: \(org-export-to-buffer 'my-latex \"*Test my-latex*\")" - (declare (debug (&define name sexp [&rest [keywordp sexp]] def-body)) - (indent 2)) (let (export-block filters menu-entry options translators contents) (while (keywordp (car body)) (case (pop body) @@ -1063,21 +1060,22 @@ The back-end could then be called with, for example: (let ((p-options (org-export-backend-options parent))) (list :options-alist (append options p-options))) (and menu-entry (list :menu-entry menu-entry)))) - `(progn - (org-export-barf-if-invalid-backend ',parent) + (progn + (org-export-barf-if-invalid-backend parent) ;; Register back-end. - (let ((registeredp (assq ',child org-export-registered-backends))) - (if registeredp (setcdr registeredp ',contents) - (push (cons ',child ',contents) org-export-registered-backends))) + (let ((registeredp (assq child org-export-registered-backends))) + (if registeredp (setcdr registeredp contents) + (push (cons child contents) org-export-registered-backends))) ;; Tell parser to not parse EXPORT-BLOCK blocks. - ,(when export-block - `(mapc - (lambda (name) - (add-to-list 'org-element-block-name-alist - `(,name . org-element-export-block-parser))) - ',export-block)) + (when export-block + (mapc + (lambda (name) + (add-to-list org-element-block-name-alist + `(,name . org-element-export-block-parser))) + export-block)) ;; Splice in the body, if any. - ,@body))) + body))) +(put 'org-element-map 'lisp-indent-function 2) (defun org-export-backend-parent (backend) "Return back-end from which BACKEND is derived, or nil." diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 9c2075d..766a771 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -588,13 +588,12 @@ body\n"))) (flet ((skip-note-head (data backend info) ;; Ignore headlines with the word "note" in their title. - (org-element-map - data 'headline - (lambda (headline) - (when (string-match "\\" - (org-element-property :raw-value headline)) - (org-export-ignore-element headline info))) - info) + (org-element-map data 'headline + (lambda (headline) + (when (string-match "\\" + (org-element-property :raw-value headline)) + (org-export-ignore-element headline info))) + info) data)) ;; Install function in parse tree filters. (let ((org-export-filter-parse-tree-functions '(skip-note-head))) @@ -623,14 +622,14 @@ body\n"))) (should (equal "Body 1\nBody 2\n" (org-test-with-backend test - (org-test-with-temp-text "* Headline 1\nBody 1\n* Headline 2\nBody 2" - (let ((org-export-before-parsing-hook - '((lambda (backend) - (goto-char (point-min)) - (while (re-search-forward org-outline-regexp-bol nil t) - (delete-region - (point-at-bol) (progn (forward-line) (point)))))))) - (org-export-as 'test))))))) + (org-test-with-temp-text "* Headline 1\nBody 1\n* Headline 2\nBody 2" + (let ((org-export-before-parsing-hook + '((lambda (backend) + (goto-char (point-min)) + (while (re-search-forward org-outline-regexp-bol nil t) + (delete-region + (point-at-bol) (progn (forward-line) (point)))))))) + (org-export-as 'test))))))) @@ -704,104 +703,104 @@ body\n"))) (should (equal '((headline . my-headline-test)) (let (org-export-registered-backends) - (org-export-define-backend test ((headline . my-headline-test))) + (org-export-define-backend 'test '((headline . my-headline-test))) (org-export-backend-translate-table 'test)))) ;; Filters. (should (equal '((:filter-headline . my-filter)) (let (org-export-registered-backends) - (org-export-define-backend test - ((headline . my-headline-test)) - :filters-alist ((:filter-headline . my-filter))) + (org-export-define-backend 'test + '((headline . my-headline-test)) + :filters-alist '((:filter-headline . my-filter))) (org-export-backend-filters 'test)))) ;; Options. (should (equal '((:prop value)) (let (org-export-registered-backends) - (org-export-define-backend test - ((headline . my-headline-test)) - :options-alist ((:prop value))) + (org-export-define-backend 'test + '((headline . my-headline-test)) + :options-alist '((:prop value))) (org-export-backend-options 'test)))) ;; Menu. (should (equal '(?k "Test Export" test) (let (org-export-registered-backends) - (org-export-define-backend test - ((headline . my-headline-test)) - :menu-entry (?k "Test Export" test)) + (org-export-define-backend 'test + '((headline . my-headline-test)) + :menu-entry '(?k "Test Export" test)) (org-export-backend-menu 'test)))) ;; Export Blocks. (should (equal '(("TEST" . org-element-export-block-parser)) (let (org-export-registered-backends org-element-block-name-alist) - (org-export-define-backend test - ((headline . my-headline-test)) - :export-block ("test")) + (org-export-define-backend 'test + '((headline . my-headline-test)) + :export-block '("test")) org-element-block-name-alist)))) -;; (ert-deftest test-org-export/define-derived-backend () -;; "Test `org-export-define-derived-backend' specifications." -;; ;; Error when parent back-end is not defined. -;; (should-error -;; (let (org-export-registered-backends) -;; (org-export-define-derived-backend test parent))) -;; ;; Append translation table to parent's. -;; (should -;; (equal '((:headline . test) (:headline . parent)) -;; (let (org-export-registered-backends) -;; (org-export-define-backend parent ((:headline . parent))) -;; (org-export-define-derived-backend test parent -;; :translate-alist ((:headline . test))) -;; (org-export-backend-translate-table 'test)))) -;; ;; Options defined in the new back have priority over those defined -;; ;; in parent. -;; (should -;; (eq 'test -;; (let (org-export-registered-backends) -;; (org-export-define-backend parent -;; ((:headline . parent)) -;; :options-alist ((:a nil nil 'parent))) -;; (org-export-define-derived-backend test parent -;; :options-alist ((:a nil nil 'test))) -;; (plist-get (org-export--get-global-options 'test) :a))))) - -;; (ert-deftest test-org-export/derived-backend-p () -;; "Test `org-export-derived-backend-p' specifications." -;; ;; Non-nil with direct match. -;; (should -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-derived-backend-p 'test 'test))) -;; (should -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-define-derived-backend test2 test) -;; (org-export-derived-backend-p 'test2 'test2))) -;; ;; Non-nil with a direct parent. -;; (should -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-define-derived-backend test2 test) -;; (org-export-derived-backend-p 'test2 'test))) -;; ;; Non-nil with an indirect parent. -;; (should -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-define-derived-backend test2 test) -;; (org-export-define-derived-backend test3 test2) -;; (org-export-derived-backend-p 'test3 'test))) -;; ;; Nil otherwise. -;; (should-not -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-define-backend test2 ((headline . test2))) -;; (org-export-derived-backend-p 'test2 'test))) -;; (should-not -;; (let (org-export-registered-backends) -;; (org-export-define-backend test ((headline . test))) -;; (org-export-define-backend test2 ((headline . test2))) -;; (org-export-define-derived-backend test3 test2) -;; (org-export-derived-backend-p 'test3 'test)))) +(ert-deftest test-org-export/define-derived-backend () + "Test `org-export-define-derived-backend' specifications." + ;; Error when parent back-end is not defined. + (should-error + (let (org-export-registered-backends) + (org-export-define-derived-backend 'test 'parent))) + ;; Append translation table to parent's. + (should + (equal '((:headline . test) (:headline . parent)) + (let (org-export-registered-backends) + (org-export-define-backend 'parent '((:headline . parent))) + (org-export-define-derived-backend 'test 'parent + :translate-alist '((:headline . test))) + (org-export-backend-translate-table 'test)))) + ;; Options defined in the new back have priority over those defined + ;; in parent. + (should + (eq 'test + (let (org-export-registered-backends) + (org-export-define-backend 'parent + '((:headline . parent)) + :options-alist '((:a nil nil 'parent))) + (org-export-define-derived-backend 'test 'parent + :options-alist '((:a nil nil 'test))) + (plist-get (org-export--get-global-options 'test) :a))))) + +(ert-deftest test-org-export/derived-backend-p () + "Test `org-export-derived-backend-p' specifications." + ;; Non-nil with direct match. + (should + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-derived-backend-p 'test 'test))) + (should + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-define-derived-backend 'test2 'test) + (org-export-derived-backend-p 'test2 'test2))) + ;; Non-nil with a direct parent. + (should + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-define-derived-backend 'test2 'test) + (org-export-derived-backend-p 'test2 'test))) + ;; Non-nil with an indirect parent. + (should + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-define-derived-backend 'test2 'test) + (org-export-define-derived-backend 'test3 'test2) + (org-export-derived-backend-p 'test3 'test))) + ;; Nil otherwise. + (should-not + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-define-backend 'test2 '((headline . test2))) + (org-export-derived-backend-p 'test2 'test))) + (should-not + (let (org-export-registered-backends) + (org-export-define-backend 'test '((headline . test))) + (org-export-define-backend 'test2 '((headline . test2))) + (org-export-define-derived-backend 'test3 'test2) + (org-export-derived-backend-p 'test3 'test)))) (ert-deftest test-org-export/with-backend () "Test `org-export-with-backend' definition." @@ -813,16 +812,16 @@ body\n"))) ;; transcoder. (should-error (let (org-export-registered-backends) - (org-export-define-backend test ((headline . ignore))) + (org-export-define-backend 'test ((headline . ignore))) (org-export-with-backend 'test "Test"))) ;; Otherwise, export using correct transcoder (should (equal "Success" (let (org-export-registered-backends) - (org-export-define-backend test - ((plain-text . (lambda (text contents info) "Failure")))) - (org-export-define-backend test2 - ((plain-text . (lambda (text contents info) "Success")))) + (org-export-define-backend 'test + '((plain-text . (lambda (text contents info) "Failure")))) + (org-export-define-backend 'test2 + '((plain-text . (lambda (text contents info) "Success")))) (org-export-with-backend 'test2 "Test"))))) (ert-deftest test-org-export/data-with-translations () @@ -847,9 +846,9 @@ body\n"))) (equal "Success!" (let (org-export-registered-backends) - (org-export-define-backend test - ((plain-text . (lambda (text info) "Success")) - (bold . (lambda (bold contents info) (concat contents "!"))))) + (org-export-define-backend 'test + '((plain-text . (lambda (text info) "Success")) + (bold . (lambda (bold contents info) (concat contents "!"))))) (org-export-data-with-backend '(bold nil "Test") 'test '(:with-emphasize t)))))) @@ -888,8 +887,7 @@ body\n"))) '((1 . "A\n") (2 . "B") (3 . "C") (4 . "D")) (org-test-with-parsed-data "Text[fn:1] [1] [fn:label:C] [fn::D]\n\n[fn:1] A\n\n[1] B" - (org-element-map - tree 'footnote-reference + (org-element-map tree 'footnote-reference (lambda (ref) (let ((def (org-export-get-footnote-definition ref info))) (cons (org-export-get-footnote-number ref info) @@ -903,8 +901,7 @@ body\n"))) (should (equal '((1 . "fn:1") (2 . "fn:2") (3 . "fn:3") (4)) - (org-element-map - tree 'footnote-reference + (org-element-map tree 'footnote-reference (lambda (ref) (when (org-export-footnote-first-reference-p ref info) (cons (org-export-get-footnote-number ref info) @@ -979,19 +976,17 @@ Paragraph[fn:1]" (equal '(1 2) (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (org-export-get-relative-level h info)) - info))))) + (org-element-map tree 'headline + (lambda (h) (org-export-get-relative-level h info)) + info))))) ;; Missing levels (should (equal '(1 3) (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "** Headline 1\n**** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (org-export-get-relative-level h info)) - info)))))) + (org-element-map tree 'headline + (lambda (h) (org-export-get-relative-level h info)) + info)))))) (ert-deftest test-org-export/low-level-p () "Test `org-export-low-level-p' specifications." @@ -1000,10 +995,9 @@ Paragraph[fn:1]" '(no yes) (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-low-level-p h info) 'yes 'no)) - (plist-put info :headline-levels 1))))))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-low-level-p h info) 'yes 'no)) + (plist-put info :headline-levels 1))))))) (ert-deftest test-org-export/get-headline-number () "Test `org-export-get-headline-number' specifications." @@ -1013,47 +1007,42 @@ Paragraph[fn:1]" '((1) (1 1)) (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (org-export-get-headline-number h info)) - info))))) + (org-element-map tree 'headline + (lambda (h) (org-export-get-headline-number h info)) + info))))) ;; Missing levels are replaced with 0. (should (equal '((1) (1 0 1)) (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n*** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (org-export-get-headline-number h info)) - info)))))) + (org-element-map tree 'headline + (lambda (h) (org-export-get-headline-number h info)) + info)))))) (ert-deftest test-org-export/numbered-headline-p () "Test `org-export-numbered-headline-p' specifications." ;; If `:section-numbers' is nil, never number headlines. (should-not (org-test-with-parsed-data "* Headline" - (org-element-map - tree 'headline - (lambda (h) (org-export-numbered-headline-p h info)) - (plist-put info :section-numbers nil)))) + (org-element-map tree 'headline + (lambda (h) (org-export-numbered-headline-p h info)) + (plist-put info :section-numbers nil)))) ;; If `:section-numbers' is a number, only number headlines with ;; a level greater that it. (should (equal '(yes no) (org-test-with-parsed-data "* Headline 1\n** Headline 2" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-numbered-headline-p h info) 'yes 'no)) - (plist-put info :section-numbers 1))))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-numbered-headline-p h info) 'yes 'no)) + (plist-put info :section-numbers 1))))) ;; Otherwise, headlines are always numbered. (should (org-test-with-parsed-data "* Headline" - (org-element-map - tree 'headline - (lambda (h) (org-export-numbered-headline-p h info)) - (plist-put info :section-numbers t))))) + (org-element-map tree 'headline + (lambda (h) (org-export-numbered-headline-p h info)) + (plist-put info :section-numbers t))))) (ert-deftest test-org-export/number-to-roman () "Test `org-export-number-to-roman' specifications." @@ -1116,17 +1105,15 @@ Paragraph[fn:1]" (equal '(("tag") ("tag")) (org-test-with-parsed-data "* Headline :tag:\n** Sub-heading" - (org-element-map - tree 'headline - (lambda (hl) (org-export-get-tags hl info nil t)) info)))) + (org-element-map tree 'headline + (lambda (hl) (org-export-get-tags hl info nil t)) info)))) ;; Tag inheritance checks FILETAGS keywords. (should (equal '(("a" "b" "tag")) (org-test-with-parsed-data "#+FILETAGS: :a:b:\n* Headline :tag:" - (org-element-map - tree 'headline - (lambda (hl) (org-export-get-tags hl info nil t)) info)))))) + (org-element-map tree 'headline + (lambda (hl) (org-export-get-tags hl info nil t)) info)))))) (ert-deftest test-org-export/get-node-property () "Test`org-export-get-node-property' specifications." @@ -1179,9 +1166,8 @@ Paragraph[fn:1]" :CATEGORY: value :END: ** Headline2" - (org-element-map - tree 'headline - (lambda (hl) (org-export-get-category hl info)) info)))) + (org-element-map tree 'headline + (lambda (hl) (org-export-get-category hl info)) info)))) ;; Test inheritance from #+CATEGORY keyword (should (equal "value" @@ -1210,20 +1196,18 @@ Paragraph[fn:1]" (equal '(yes yes no) (org-test-with-parsed-data "* Headline\n** Headline 2\n** Headline 3" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-first-sibling-p h info) 'yes 'no)) - info)))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-first-sibling-p h info) 'yes 'no)) + info)))) ;; Ignore headlines not exported. (should (equal '(yes) (let ((org-export-exclude-tags '("ignore"))) (org-test-with-parsed-data "* Headline :ignore:\n* Headline 2" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-first-sibling-p h info) 'yes 'no)) - info)))))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-first-sibling-p h info) 'yes 'no)) + info)))))) (ert-deftest test-org-export/last-sibling-p () "Test `org-export-last-sibling-p' specifications." @@ -1232,20 +1216,18 @@ Paragraph[fn:1]" (equal '(yes no yes) (org-test-with-parsed-data "* Headline\n** Headline 2\n** Headline 3" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)) - info)))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)) + info)))) ;; Ignore headlines not exported. (should (equal '(yes) (let ((org-export-exclude-tags '("ignore"))) (org-test-with-parsed-data "* Headline\n* Headline 2 :ignore:" - (org-element-map - tree 'headline - (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)) - info)))))) + (org-element-map tree 'headline + (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)) + info)))))) (ert-deftest test-org-export/handle-inlinetasks () "Test inlinetask export." @@ -1297,8 +1279,7 @@ Paragraph[fn:1]" (should (org-export-inline-image-p (org-test-with-temp-text "[[#id]]" - (org-element-map - (org-element-parse-buffer) 'link 'identity nil t)) + (org-element-map (org-element-parse-buffer) 'link 'identity nil t)) '(("custom-id" . "id"))))) (ert-deftest test-org-export/fuzzy-link () @@ -1307,8 +1288,7 @@ Paragraph[fn:1]" (org-test-with-parsed-data "Paragraph.\n#+TARGET: Test\n[[Test]]" (should-not - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info))) @@ -1318,8 +1298,7 @@ Paragraph[fn:1]" (should ;; Note: Headline's number is in fact a list of numbers. (equal '(2) - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info t)))) @@ -1329,8 +1308,7 @@ Paragraph[fn:1]" (should ;; Note: Item's number is in fact a list of numbers. (equal '(1 2) - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info t)))) @@ -1340,8 +1318,7 @@ Paragraph[fn:1]" Paragraph[1][2][fn:lbl3:C<>][[test]][[target]]\n[1] A\n\n[2] <>B" (should (equal '(2 3) - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info)))) @@ -1351,8 +1328,7 @@ Paragraph[1][2][fn:lbl3:C<>][[test]][[target]]\n[1] A\n\n[2] <>B" "#+NAME: tbl1\n|1|2|\n#+NAME: tbl2\n|3|4|\n#+NAME: tbl3\n|5|6|\n[[tbl2]]" (should (= 2 - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info t)))) @@ -1362,8 +1338,7 @@ Paragraph[1][2][fn:lbl3:C<>][[test]][[target]]\n[1] A\n\n[2] <>B" "* Head1\n* Head2\nParagraph<>\n* Head3\n[[target]]" (should (equal '(2) - (org-element-map - tree 'link + (org-element-map tree 'link (lambda (link) (org-export-get-ordinal (org-export-resolve-fuzzy-link link info) info)) info t)))) @@ -1644,116 +1619,104 @@ Another text. (ref:text) '("some “paragraph") (let ((org-export-default-language "en")) (org-test-with-parsed-data "some \"paragraph" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Opening quotes: at the beginning of a paragraph. (should (equal '("“begin") (let ((org-export-default-language "en")) (org-test-with-parsed-data "\"begin" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Opening quotes: after an object. (should (equal '("“begin") (let ((org-export-default-language "en")) (org-test-with-parsed-data "=verb= \"begin" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Closing quotes: standard test. (should (equal '("some” paragraph") (let ((org-export-default-language "en")) (org-test-with-parsed-data "some\" paragraph" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Closing quotes: at the end of a paragraph. (should (equal '("end”") (let ((org-export-default-language "en")) (org-test-with-parsed-data "end\"" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Apostrophe: standard test. (should (equal '("It shouldn’t fail") (let ((org-export-default-language "en")) (org-test-with-parsed-data "It shouldn't fail" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Apostrophe: before an object. (should (equal '("a’") (let ((org-export-default-language "en")) (org-test-with-parsed-data "a'=b=" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Apostrophe: after an object. (should (equal '("’s") (let ((org-export-default-language "en")) (org-test-with-parsed-data "=code='s" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Special case: isolated quotes. (should (equal '("“" "”") (let ((org-export-default-language "en")) (org-test-with-parsed-data "\"$x$\"" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Smart quotes in secondary strings. (should (equal '("“" "”") (let ((org-export-default-language "en")) (org-test-with-parsed-data "* \"$x$\"" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Smart quotes in document keywords. (should (equal '("“" "”") (let ((org-export-default-language "en")) (org-test-with-parsed-data "#+TITLE: \"$x$\"" - (org-element-map - (plist-get info :title) 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info))))) + (org-element-map (plist-get info :title) 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info))))) ;; Smart quotes in parsed affiliated keywords. (should (equal '("“" "”" "Paragraph") (let ((org-export-default-language "en")) (org-test-with-parsed-data "#+CAPTION: \"$x$\"\nParagraph" - (org-element-map - tree 'plain-text - (lambda (s) (org-export-activate-smart-quotes s :html info)) - info nil nil t)))))) + (org-element-map tree 'plain-text + (lambda (s) (org-export-activate-smart-quotes s :html info)) + info nil nil t)))))) @@ -1769,7 +1732,7 @@ Another text. (ref:text) (should (org-export-table-has-special-column-p (org-element-map - (org-element-parse-buffer) 'table 'identity nil 'first-match)))) + (org-element-parse-buffer) 'table 'identity nil 'first-match)))) ;; 2. If the column contains anything else, it isn't special. (org-test-with-temp-text " | ! | 1 | @@ -1777,7 +1740,7 @@ Another text. (ref:text) (should-not (org-export-table-has-special-column-p (org-element-map - (org-element-parse-buffer) 'table 'identity nil 'first-match)))) + (org-element-parse-buffer) 'table 'identity nil 'first-match)))) ;; 3. Special marking characters are "#", "^", "*", "_", "/", "$" ;; and "!". (org-test-with-temp-text " @@ -1791,7 +1754,7 @@ Another text. (ref:text) (should (org-export-table-has-special-column-p (org-element-map - (org-element-parse-buffer) 'table 'identity nil 'first-match)))) + (org-element-parse-buffer) 'table 'identity nil 'first-match)))) ;; 4. A first column with only empty cells isn't considered as ;; special. (org-test-with-temp-text " @@ -1800,7 +1763,7 @@ Another text. (ref:text) (should-not (org-export-table-has-special-column-p (org-element-map - (org-element-parse-buffer) 'table 'identity nil 'first-match))))) + (org-element-parse-buffer) 'table 'identity nil 'first-match))))) (ert-deftest test-org-export/table-row-is-special-p () "Test `org-export-table-row-is-special-p' specifications." @@ -2056,10 +2019,9 @@ Another text. (ref:text) (org-test-with-parsed-data "| a | b |" (should (equal '((0 . 0) (0 . 1)) - (org-element-map - tree 'table-cell - (lambda (cell) (org-export-table-cell-address cell info)) - info)))) + (org-element-map tree 'table-cell + (lambda (cell) (org-export-table-cell-address cell info)) + info)))) ;; 2. Special column isn't counted, nor are special rows. (org-test-with-parsed-data " | / | <> | @@ -2141,11 +2103,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-cell - (lambda (cell) - (if (org-export-table-cell-starts-colgroup-p cell info) 'yes 'no)) - info))))) + (org-element-map tree 'table-cell + (lambda (cell) + (if (org-export-table-cell-starts-colgroup-p cell info) 'yes 'no)) + info))))) (ert-deftest test-org-export/table-cell-ends-colgroup-p () "Test `org-export-table-cell-ends-colgroup-p' specifications." @@ -2171,11 +2132,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-cell - (lambda (cell) - (if (org-export-table-cell-ends-colgroup-p cell info) 'yes 'no)) - info))))) + (org-element-map tree 'table-cell + (lambda (cell) + (if (org-export-table-cell-ends-colgroup-p cell info) 'yes 'no)) + info))))) (ert-deftest test-org-export/table-row-starts-rowgroup-p () "Test `org-export-table-row-starts-rowgroup-p' specifications." @@ -2188,11 +2148,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-starts-rowgroup-p row info) 'yes 'no)) - info)))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-starts-rowgroup-p row info) 'yes 'no)) + info)))) ;; 2. Special rows should be ignored when determining the beginning ;; of the row. (org-test-with-parsed-data " @@ -2204,11 +2163,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-starts-rowgroup-p row info) 'yes 'no)) - info))))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-starts-rowgroup-p row info) 'yes 'no)) + info))))) (ert-deftest test-org-export/table-row-ends-rowgroup-p () "Test `org-export-table-row-ends-rowgroup-p' specifications." @@ -2221,11 +2179,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-ends-rowgroup-p row info) 'yes 'no)) - info)))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-ends-rowgroup-p row info) 'yes 'no)) + info)))) ;; 2. Special rows should be ignored when determining the beginning ;; of the row. (org-test-with-parsed-data " @@ -2237,11 +2194,10 @@ Another text. (ref:text) (should (equal '(yes no yes) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-ends-rowgroup-p row info) 'yes 'no)) - info))))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-ends-rowgroup-p row info) 'yes 'no)) + info))))) (ert-deftest test-org-export/table-row-starts-header-p () "Test `org-export-table-row-starts-header-p' specifications." @@ -2255,11 +2211,10 @@ Another text. (ref:text) (should (equal '(yes no no no) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-starts-header-p row info) 'yes 'no)) - info)))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-starts-header-p row info) 'yes 'no)) + info)))) ;; 2. A row cannot start an header if there's no header in the ;; table. (org-test-with-parsed-data " @@ -2282,11 +2237,10 @@ Another text. (ref:text) (should (equal '(no yes no no) - (org-element-map - tree 'table-row - (lambda (row) - (if (org-export-table-row-ends-header-p row info) 'yes 'no)) - info)))) + (org-element-map tree 'table-row + (lambda (row) + (if (org-export-table-row-ends-header-p row info) 'yes 'no)) + info)))) ;; 2. A row cannot start an header if there's no header in the ;; table. (org-test-with-parsed-data " @@ -2306,18 +2260,18 @@ Another text. (ref:text) (should (equal "Success!" (let (org-export-registered-backends) - (org-export-define-backend test - ((inner-template . (lambda (contents info) "Success!")) - (headline . (lambda (h c i) "Headline")))) + (org-export-define-backend 'test + '((inner-template . (lambda (contents info) "Success!")) + (headline . (lambda (h c i) "Headline")))) (org-test-with-temp-text "* Headline" (org-export-as 'test))))) ;; Inner template is applied even in a "body-only" export. (should (equal "Success!" (let (org-export-registered-backends) - (org-export-define-backend test - ((inner-template . (lambda (contents info) "Success!")) - (headline . (lambda (h c i) "Headline")))) + (org-export-define-backend 'test + '((inner-template . (lambda (contents info) "Success!")) + (headline . (lambda (h c i) "Headline")))) (org-test-with-temp-text "* Headline" (org-export-as 'test nil nil 'body-only)))))) @@ -2326,18 +2280,18 @@ Another text. (ref:text) (should (equal "Success!" (let (org-export-registered-backends) - (org-export-define-backend test - ((template . (lambda (contents info) "Success!")) - (headline . (lambda (h c i) "Headline")))) + (org-export-define-backend 'test + '((template . (lambda (contents info) "Success!")) + (headline . (lambda (h c i) "Headline")))) (org-test-with-temp-text "* Headline" (org-export-as 'test))))) ;; Template is not applied in a "body-only" export. (should-not (equal "Success!" (let (org-export-registered-backends) - (org-export-define-backend test - ((template . (lambda (contents info) "Success!")) - (headline . (lambda (h c i) "Headline")))) + (org-export-define-backend 'test + '((template . (lambda (contents info) "Success!")) + (headline . (lambda (h c i) "Headline")))) (org-test-with-temp-text "* Headline" (org-export-as 'test nil nil 'body-only)))))) @@ -2378,7 +2332,7 @@ Another text. (ref:text) (org-element-type (org-export-get-next-element (org-element-map - (plist-get info :title) 'plain-text 'identity info t) info))))) + (plist-get info :title) 'plain-text 'identity info t) info))))) ;; Find next element in parsed affiliated keywords. (should (eq 'verbatim -- 1.8.1.4