ox-html: Properly escape ampersands in links

* lisp/ox-html.el (org-html-link): Properly escape ampersands in
  links.
(org-html-encode-plain-text): Small refactoring.

Reported-by: Karl Voit <devnull@Karl-Voit.at>
<http://permalink.gmane.org/gmane.emacs.orgmode/94640>
This commit is contained in:
Nicolas Goaziou 2015-02-05 12:56:23 +01:00
parent a5c4568de5
commit 528b909fe1
1 changed files with 5 additions and 7 deletions

View File

@ -2734,8 +2734,9 @@ INFO is a plist holding contextual information. See
(path
(cond
((member type '("http" "https" "ftp" "mailto"))
(org-link-escape-browser
(org-link-unescape (concat type ":" raw-path))))
(org-html-encode-plain-text
(org-link-escape-browser
(org-link-unescape (concat type ":" raw-path)))))
((string= type "file")
;; Treat links to ".org" files as ".html", if needed.
(setq raw-path
@ -2981,11 +2982,8 @@ contextual information."
(defun org-html-encode-plain-text (text)
"Convert plain text characters from TEXT to HTML equivalent.
Possible conversions are set in `org-html-protect-char-alist'."
(mapc
(lambda (pair)
(setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))
org-html-protect-char-alist)
text)
(dolist (pair org-html-protect-char-alist text)
(setq text (replace-regexp-in-string (car pair) (cdr pair) text t t))))
(defun org-html-plain-text (text info)
"Transcode a TEXT string from Org to HTML.