0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 11:46:26 +00:00

New variable org-export-html-protect-char-alist.

* org-html.el (org-export-html-protect-char-alist): New custom
variable to define characters to be HTML protected.
(org-html-protect): Use the new variable.
This commit is contained in:
Bastien Guerry 2011-02-12 12:49:50 +01:00
parent dbb46ae6b1
commit 3a04522ef1

View file

@ -523,6 +523,15 @@ a file."
:group 'org-export-html :group 'org-export-html
:type 'string) :type 'string)
(defcustom org-export-html-protect-char-alist
'(("&" . "&")
("<" . "&lt;")
(">" . "&gt;"))
"Alist of characters to be converted by `org-html-protect'."
:type '((repeat (cons (string :tag "Character")
(string :tag "HTML equivalent")))))
(defgroup org-export-htmlize nil (defgroup org-export-htmlize nil
"Options for processing examples with htmlize.el." "Options for processing examples with htmlize.el."
:tag "Org Export Htmlize" :tag "Org Export Htmlize"
@ -2218,19 +2227,15 @@ that uses these same face definitions."
(goto-char (point-min))) (goto-char (point-min)))
(defun org-html-protect (s) (defun org-html-protect (s)
"convert & to &amp;, < to &lt; and > to &gt;" "Convert characters to HTML equivalent.
(let ((start 0)) Possible conversions are set in `org-export-html-protect-char-alist'."
(while (string-match "&" s start) (let ((start 0)
(setq s (replace-match "&amp;" t t s) (cl org-export-html-protect-char-alist) c)
start (1+ (match-beginning 0)))) (while (setq c (pop cl))
(while (string-match "<" s) (while (string-match (car c) s start)
(setq s (replace-match "&lt;" t t s))) (setq s (replace-match (cdr c) t t s)
(while (string-match ">" s) start (1+ (match-beginning 0)))))
(setq s (replace-match "&gt;" t t s))) s))
; (while (string-match "\"" s)
; (setq s (replace-match "&quot;" t t s)))
)
s)
(defun org-html-expand (string) (defun org-html-expand (string)
"Prepare STRING for HTML export. Apply all active conversions. "Prepare STRING for HTML export. Apply all active conversions.