From da11423d21a33aa2440bc1e2796117c2fa7cd0e5 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Jan 2009 16:41:34 +0100 Subject: [PATCH] Export: Escape HTML characters in examples. --- lisp/ChangeLog | 5 +++++ lisp/org-exp.el | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1f2c8c8d9..3267db2ac 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2009-01-24 Carsten Dominik + * org-exp.el (org-export-format-source-code-or-example): Escape + HTML characters also in examples that anre not treated with + htmlize. Also, just switch to EXAMPLE processing if we do not + have a good version of htmlize. + * org-rmail.el: Fix copyright notice. * org.el (org-activate-footnote-links): Improve footnote link diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 3ecc4c841..3fad36aa2 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2398,6 +2398,7 @@ Numbering lines works for all three major backends (html, latex, and ascii)." (require 'htmlize nil t) (when (not (fboundp 'htmlize-region-for-paste)) ;; we do not have htmlize.el, or an old version of it + (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) @@ -2423,6 +2424,14 @@ Numbering lines works for all three major backends (html, latex, and ascii)." (format "

\n\n

\n")) + (with-temp-buffer + (insert rtn) + (goto-char (point-min)) + (while (re-search-forward "[<>&]" nil t) + (replace-match (cdr (assq (char-before) + '((?&."&")(?<."<")(?>.">")))) + t t)) + (setq rtn (buffer-string))) (setq rtn (concat "
\n" rtn "
\n")))) (unless textareap (setq rtn (org-export-number-lines rtn 'html 1 1 num