org-table.el: Escape some special characters when sending radio tables.

* org-table.el (orgtbl-send-table): Escape special characters.
Introduce a new parameter :no-escape to prevent escaping.

* org.texi (Radio tables): Document the :no-escape parameter.

Thanks to Alexander Willand for raising this issue.
This commit is contained in:
Bastien Guerry 2012-04-23 00:09:35 +02:00
parent 94bc01e77e
commit e9dec29bb1
2 changed files with 8 additions and 0 deletions

View File

@ -15551,6 +15551,10 @@ calculation marks, that column is automatically discarded as well.
Please note that the translator function sees the table @emph{after} the
removal of these columns, the function never knows that there have been
additional columns.
@item :no-escape t
When non-nil, do not escape special characters @code{&%#_^} when exporting
the table. The default value is nil.
@end table
@noindent

View File

@ -4296,11 +4296,15 @@ this table."
(params (plist-get dest :params))
(skip (plist-get params :skip))
(skipcols (plist-get params :skipcols))
(no-escape (plist-get params :no-escape))
beg
(lines (org-table-clean-before-export
(nthcdr (or skip 0)
(org-split-string txt "[ \t]*\n[ \t]*"))))
(i0 (if org-table-clean-did-remove-column 2 1))
(lines (if no-escape lines
(mapcar (lambda(l) (replace-regexp-in-string
"\\([&%#_^]\\)" "\\\\\\1{}" l)) lines)))
(table (mapcar
(lambda (x)
(if (string-match org-table-hline-regexp x)