mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-30 08:08:26 +00:00
ox: Fix test errors
* lisp/ox.el (org-export-data-with-backend): Set temporary back-end as the new back-end in local communication channel. (org-export-filter-apply-functions): Handle corner case where back-end is nil. * testing/lisp/test-ox.el: Small refactoring.
This commit is contained in:
parent
2a28def0ae
commit
cf8cc35ec5
@ -2250,9 +2250,10 @@ recursively convert DATA using BACKEND translation table."
|
||||
;; memoization.
|
||||
(org-combine-plists
|
||||
info
|
||||
(list :translate-alist (org-export-get-all-transcoders backend)
|
||||
(list :back-end backend
|
||||
:translate-alist (org-export-get-all-transcoders backend)
|
||||
;; Size of the hash table is reduced since this function
|
||||
;; will probably be used on short trees.
|
||||
;; will probably be used on small trees.
|
||||
:exported-data (make-hash-table :test 'eq :size 401)))))
|
||||
|
||||
(defun org-export--interpret-p (blob info)
|
||||
@ -2754,7 +2755,8 @@ VALUE is ignored.
|
||||
Call is done in a LIFO fashion, to be sure that developer
|
||||
specified filters, if any, are called first."
|
||||
(catch 'exit
|
||||
(let ((backend-name (org-export-backend-name (plist-get info :back-end))))
|
||||
(let* ((backend (plist-get info :back-end))
|
||||
(backend-name (and backend (org-export-backend-name backend))))
|
||||
(dolist (filter filters value)
|
||||
(let ((result (funcall filter value backend-name info)))
|
||||
(cond ((not result) value)
|
||||
|
@ -2246,51 +2246,48 @@ Another text. (ref:text)
|
||||
|
||||
(ert-deftest test-org-export/table-cell-alignment ()
|
||||
"Test `org-export-table-cell-alignment' specifications."
|
||||
(let ((org-table-number-fraction 0.5)
|
||||
(org-table-number-regexp "^[0-9]+$"))
|
||||
;; 1. Alignment is primarily determined by alignment cookies.
|
||||
(org-test-with-temp-text "| <l> | <c> | <r> |"
|
||||
(let* ((tree (org-element-parse-buffer))
|
||||
(info `(:parse-tree ,tree)))
|
||||
(should
|
||||
(equal
|
||||
'(left center right)
|
||||
(mapcar (lambda (cell) (org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity))))))
|
||||
;; 2. The last alignment cookie has precedence.
|
||||
(org-test-with-parsed-data "
|
||||
;; 1. Alignment is primarily determined by alignment cookies.
|
||||
(should
|
||||
(equal '(left center right)
|
||||
(let ((org-table-number-fraction 0.5)
|
||||
(org-table-number-regexp "^[0-9]+$"))
|
||||
(org-test-with-parsed-data "| <l> | <c> | <r> |"
|
||||
(mapcar (lambda (cell)
|
||||
(org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity))))))
|
||||
;; 2. The last alignment cookie has precedence.
|
||||
(should
|
||||
(equal '(right right right)
|
||||
(org-test-with-parsed-data "
|
||||
| <l8> |
|
||||
| cell |
|
||||
| <r9> |"
|
||||
(should
|
||||
(equal
|
||||
'(right right right)
|
||||
(mapcar (lambda (cell) (org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity)))))
|
||||
;; 3. If there's no cookie, cell's contents determine alignment.
|
||||
;; A column mostly made of cells containing numbers will align
|
||||
;; its cells to the right.
|
||||
(org-test-with-parsed-data "
|
||||
(mapcar (lambda (cell) (org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity)))))
|
||||
;; 3. If there's no cookie, cell's contents determine alignment.
|
||||
;; A column mostly made of cells containing numbers will align
|
||||
;; its cells to the right.
|
||||
(should
|
||||
(equal '(right right right)
|
||||
(let ((org-table-number-fraction 0.5)
|
||||
(org-table-number-regexp "^[0-9]+$"))
|
||||
(org-test-with-parsed-data "
|
||||
| 123 |
|
||||
| some text |
|
||||
| 12345 |"
|
||||
(should
|
||||
(equal
|
||||
'(right right right)
|
||||
(mapcar (lambda (cell)
|
||||
(org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity)))))
|
||||
;; 4. Otherwise, they will be aligned to the left.
|
||||
(org-test-with-parsed-data "
|
||||
(mapcar (lambda (cell)
|
||||
(org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity))))))
|
||||
;; 4. Otherwise, they will be aligned to the left.
|
||||
(should
|
||||
(equal '(left left left)
|
||||
(org-test-with-parsed-data "
|
||||
| text |
|
||||
| some text |
|
||||
| \alpha |"
|
||||
(should
|
||||
(equal
|
||||
'(left left left)
|
||||
(mapcar (lambda (cell)
|
||||
(org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity)))))))
|
||||
(mapcar (lambda (cell)
|
||||
(org-export-table-cell-alignment cell info))
|
||||
(org-element-map tree 'table-cell 'identity info))))))
|
||||
|
||||
(ert-deftest test-org-export/table-cell-borders ()
|
||||
"Test `org-export-table-cell-borders' specifications."
|
||||
|
Loading…
Reference in New Issue
Block a user