mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-03 08:30:09 +00:00
Fix up svg text encoding
* lisp/svg.el (svg--encode-text): The SVG driver doesn't like it if we use ' for apostrophe, so use our own encoding function instead of relying on the xml one.
This commit is contained in:
parent
a0e5a02125
commit
1ad56d0a6b
10
lisp/svg.el
10
lisp/svg.el
@ -161,9 +161,15 @@ otherwise. IMAGE-TYPE should be a MIME image type, like
|
||||
|
||||
(defun svg--encode-text (text)
|
||||
;; Apparently the SVG renderer needs to have all non-ASCII
|
||||
;; characters encoded.
|
||||
;; characters encoded, and only certain special characters.
|
||||
(with-temp-buffer
|
||||
(insert (xml-escape-string text))
|
||||
(insert text)
|
||||
(dolist (substitution '(("&" . "&")
|
||||
("<" . "<")
|
||||
(">" . ">")))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward (car substitution) nil t)
|
||||
(replace-match (cdr substitution) t t nil)))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(let ((char (following-char)))
|
||||
|
Loading…
Reference in New Issue
Block a user