forked from mirrors/org-mode
ox: Fix plain text export with `org-export-with-backend'
* lisp/ox.el (org-export-with-backend): Handle arity for plain text transcoder. * testing/lisp/test-ox.el (test-org-export/with-backend): Add test.
This commit is contained in:
parent
5e30bbcd34
commit
84cb63a44a
|
@ -3699,7 +3699,9 @@ the communication channel used for export, as a plist."
|
||||||
:translate-alist all-transcoders
|
:translate-alist all-transcoders
|
||||||
:exported-data (make-hash-table :test #'eq :size 401)))))
|
:exported-data (make-hash-table :test #'eq :size 401)))))
|
||||||
;; `:internal-references' are shared across back-ends.
|
;; `:internal-references' are shared across back-ends.
|
||||||
(prog1 (funcall transcoder data contents new-info)
|
(prog1 (if (eq type 'plain-text)
|
||||||
|
(funcall transcoder data new-info)
|
||||||
|
(funcall transcoder data contents new-info))
|
||||||
(plist-put info :internal-references
|
(plist-put info :internal-references
|
||||||
(plist-get new-info :internal-references)))))))
|
(plist-get new-info :internal-references)))))))
|
||||||
|
|
||||||
|
|
|
@ -1771,12 +1771,19 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline footnote]
|
||||||
(equal "Success"
|
(equal "Success"
|
||||||
(let (org-export-registered-backends)
|
(let (org-export-registered-backends)
|
||||||
(org-export-define-backend 'test
|
(org-export-define-backend 'test
|
||||||
'((plain-text . (lambda (text contents info) "Failure"))))
|
'((verbatim . (lambda (text contents info) "Failure"))))
|
||||||
(org-export-define-backend 'test2
|
(org-export-define-backend 'test2
|
||||||
'((plain-text . (lambda (text contents info) "Success"))))
|
'((verbatim . (lambda (text contents info) "Success"))))
|
||||||
(org-export-with-backend 'test2 "Test"))))
|
(org-export-with-backend 'test2 '(verbatim (:value "=Test="))))))
|
||||||
|
;; Corner case: plain-text transcoders have a different arity.
|
||||||
|
(should
|
||||||
|
(equal "Success"
|
||||||
|
(org-export-with-backend
|
||||||
|
(org-export-create-backend
|
||||||
|
:transcoders '((plain-text . (lambda (text info) "Success"))))
|
||||||
|
"Test")))
|
||||||
;; Provide correct back-end if transcoder needs to use recursive
|
;; Provide correct back-end if transcoder needs to use recursive
|
||||||
;; calls anyway.
|
;; calls.
|
||||||
(should
|
(should
|
||||||
(equal "Success\n"
|
(equal "Success\n"
|
||||||
(let ((test-back-end
|
(let ((test-back-end
|
||||||
|
|
Loading…
Reference in New Issue