1 ;;; html-quote.el --- Simple quoting of html characters
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: Sun Dec 30 12:55:38 2007
6 ;; Last-Updated: Sun Dec 30 12:59:43 2007 (3600 +0100)
11 ;; Features that might be required by this library:
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;; Just simple quoting of & < > etc
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;; This program is free software; you can redistribute it and/or
29 ;; modify it under the terms of the GNU General Public License as
30 ;; published by the Free Software Foundation; either version 2, or
31 ;; (at your option) any later version.
33 ;; This program is distributed in the hope that it will be useful,
34 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 ;; General Public License for more details.
38 ;; You should have received a copy of the GNU General Public License
39 ;; along with this program; see the file COPYING. If not, write to
40 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
41 ;; Floor, Boston, MA 02110-1301, USA.
43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 (defcustom html-quote-html '((?< . "<")
50 "*Alist of char -> entity mappings used to make the text html-safe."
52 :type '(alist :key-type character
56 (defun html-quote-html-char (char)
57 "Return CHAR as string if safe, otherwise its html entity."
58 (or (cdr (assoc char html-quote-html))
59 (char-to-string char)))
61 (defun html-quote-html-string (str)
62 "Return html escaped STR."
63 (mapconcat 'html-quote-html-char
67 ;; (html-quote-html-string "is & < s")
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
71 ;;; html-quote.el ends here