Function: org-odt--remove-forbidden
org-odt--remove-forbidden is a byte-compiled function defined in
ox-odt.el.gz.
Signature
(org-odt--remove-forbidden TEXT BACKEND INFO)
Documentation
Remove forbidden and discouraged characters from TEXT.
INFO is the communication plist
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
(defun org-odt--remove-forbidden (text _backend info)
"Remove forbidden and discouraged characters from TEXT.
INFO is the communication plist"
(pcase-exhaustive (plist-get info :odt-with-forbidden-chars)
((and (pred stringp) rep)
(let ((replacements (make-hash-table :test 'equal)))
(with-temp-buffer
(insert text)
(goto-char (point-min))
(while (re-search-forward org-odt-forbidden-char-re nil t)
(cl-incf (gethash (match-string 0) replacements 0))
(replace-match rep))
(cl-loop for forbidden being the hash-keys of replacements
using (hash-values count)
do (display-warning
'(ox-odt ox-odt-with-forbidden-chars)
(format "Replaced forbidden character '%s' with '%s' %d times"
forbidden rep count)))
(buffer-string))))
(`nil
(if (string-match org-odt-forbidden-char-re text)
(error "Forbidden character '%s' found. See `org-odt-with-forbidden-chars'"
(match-string 0 text))
text))
('t text)))