org-table: Fix :raw parameter in radio tables

* lisp/org-table.el (org-table--to-generic-cell): Use
  `org-element-interpret' data when parameter :raw is non-nil so
  pseudo elements and objects are not ignored.

* testing/lisp/test-org-table.el (test-org-table/to-latex): Add test.

Thanks to Giuseppe Lipari for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/91559
This commit is contained in:
Nicolas Goaziou 2014-10-11 17:01:59 +02:00
parent fcce67cdeb
commit 39eb7796e8
2 changed files with 18 additions and 3 deletions

View File

@ -4850,8 +4850,19 @@ information."
;; Make sure that contents are exported as Org data when :raw
;; parameter is non-nil.
,(when (and backend (plist-get params :raw))
`(setq contents (org-export-data-with-backend
(org-element-contents cell) 'org info)))
`(setq contents
;; Since we don't know what are the pseudo object
;; types defined in backend, we cannot pass them to
;; `org-element-interpret-data'. As a consequence,
;; they will be treated as pseudo elements, and
;; will have newlines appended instead of spaces.
;; Therefore, we must make sure :post-blank value
;; is really turned into spaces.
(replace-regexp-in-string
"\n" " "
(org-trim
(org-element-interpret-data
(org-element-contents cell))))))
(when contents
;; Check if we can apply `:efmt' on CONTENTS.
,(when efmt

View File

@ -1452,7 +1452,11 @@ See also `test-org-table/copy-field'."
;; Test :booktabs parameter.
(should
(org-string-match-p
"\\toprule" (orgtbl-to-latex (org-table-to-lisp "| a |") '(:booktabs t)))))
"\\toprule" (orgtbl-to-latex (org-table-to-lisp "| a |") '(:booktabs t))))
;; Test pseudo objects and :raw parameter.
(should
(org-string-match-p
"\\$x\\$" (orgtbl-to-latex (org-table-to-lisp "| $x$ |") '(:raw t)))))
(ert-deftest test-org-table/to-html ()
"Test `orgtbl-to-html' specifications."