mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
* xml.el (xml-escape-string): Don't refer to xml-entity-alist.
Fixes: debbugs:12228
This commit is contained in:
parent
d7191076ce
commit
17975d7ff9
2 changed files with 24 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-08-19 Chong Yidong <cyd@gnu.org>
|
||||||
|
|
||||||
|
* xml.el (xml-escape-string): Don't refer to xml-entity-alist
|
||||||
|
(Bug#12228).
|
||||||
|
|
||||||
2012-08-18 Chong Yidong <cyd@gnu.org>
|
2012-08-18 Chong Yidong <cyd@gnu.org>
|
||||||
|
|
||||||
* simple.el (yank-handled-properties): New defcustom.
|
* simple.el (yank-handled-properties): New defcustom.
|
||||||
|
|
26
lisp/xml.el
26
lisp/xml.el
|
@ -1011,13 +1011,25 @@ The first line is indented with the optional INDENT-STRING."
|
||||||
(defalias 'xml-print 'xml-debug-print)
|
(defalias 'xml-print 'xml-debug-print)
|
||||||
|
|
||||||
(defun xml-escape-string (string)
|
(defun xml-escape-string (string)
|
||||||
"Return STRING with entity substitutions made from `xml-entity-alist'."
|
"Convert STRING into a string containing valid XML character data.
|
||||||
(mapconcat (lambda (byte)
|
Replace occurrences of &<>'\" in STRING with their default XML
|
||||||
(let ((char (char-to-string byte)))
|
entity references (e.g. replace each & with &).
|
||||||
(if (rassoc char xml-entity-alist)
|
|
||||||
(concat "&" (car (rassoc char xml-entity-alist)) ";")
|
XML character data must not contain & or < characters, nor the >
|
||||||
char)))
|
character under some circumstances. The XML spec does not impose
|
||||||
string ""))
|
restriction on \" or ', but we just substitute for these too
|
||||||
|
\(as is permitted by the spec)."
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert string)
|
||||||
|
(dolist (substitution '(("&" . "&")
|
||||||
|
("<" . "<")
|
||||||
|
(">" . ">")
|
||||||
|
("'" . "'")
|
||||||
|
("\"" . """)))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (search-forward (car substitution) nil t)
|
||||||
|
(replace-match (cdr substitution) t t nil)))
|
||||||
|
(buffer-string)))
|
||||||
|
|
||||||
(defun xml-debug-print-internal (xml indent-string)
|
(defun xml-debug-print-internal (xml indent-string)
|
||||||
"Outputs the XML tree in the current buffer.
|
"Outputs the XML tree in the current buffer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue