0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-24 18:02:53 +00:00

Export: Escape HTML characters in examples.

This commit is contained in:
Carsten Dominik 2009-01-24 16:41:34 +01:00
parent 0cc3cfd680
commit da11423d21
2 changed files with 14 additions and 0 deletions

View file

@ -1,5 +1,10 @@
2009-01-24 Carsten Dominik <carsten.dominik@gmail.com>
* 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

View file

@ -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 "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n"
cols rows)
rtn "</textarea>\n</p>\n"))
(with-temp-buffer
(insert rtn)
(goto-char (point-min))
(while (re-search-forward "[<>&]" nil t)
(replace-match (cdr (assq (char-before)
'((?&."&amp;")(?<."&lt;")(?>."&gt;"))))
t t))
(setq rtn (buffer-string)))
(setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n"))))
(unless textareap
(setq rtn (org-export-number-lines rtn 'html 1 1 num