Commit | Line | Data |
---|---|---|
23f87bed | 1 | ;;; html2text.el --- a simple html to plain text converter |
e84b4b86 | 2 | |
e3fe4da0 | 3 | ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
23f87bed MB |
4 | |
5 | ;; Author: Joakim Hove <hove@phys.ntnu.no> | |
6 | ||
7 | ;; This file is part of GNU Emacs. | |
8 | ||
9 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 | ;; it under the terms of the GNU General Public License as published by | |
5a9dffec | 11 | ;; the Free Software Foundation; either version 3, or (at your option) |
23f87bed MB |
12 | ;; any later version. |
13 | ||
14 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;; GNU General Public License for more details. | |
18 | ||
19 | ;; You should have received a copy of the GNU General Public License | |
20 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
3a35cf56 LK |
21 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 | ;; Boston, MA 02110-1301, USA. | |
23f87bed MB |
23 | |
24 | ;;; Commentary: | |
25 | ||
26 | ;; These functions provide a simple way to wash/clean html infected | |
27 | ;; mails. Definitely do not work in all cases, but some improvement | |
e2642250 | 28 | ;; in readability is generally obtained. Formatting is only done in |
23f87bed MB |
29 | ;; the buffer, so the next time you enter the article it will be |
30 | ;; "re-htmlized". | |
31 | ;; | |
e2642250 | 32 | ;; The main function is `html2text'. |
23f87bed MB |
33 | |
34 | ;;; Code: | |
35 | ||
36 | ;; | |
37 | ;; <Global variables> | |
38 | ;; | |
39 | ||
40 | (eval-when-compile | |
41 | (require 'cl)) | |
42 | ||
43 | (defvar html2text-format-single-element-list '(("hr" . html2text-clean-hr))) | |
44 | ||
45 | (defvar html2text-replace-list | |
01c52d31 MB |
46 | '(("´" . "`") |
47 | ("&" . "&") | |
48 | ("'" . "'") | |
49 | ("¦" . "|") | |
50 | ("¢" . "c") | |
51 | ("ˆ" . "^") | |
52 | ("©" . "(C)") | |
53 | ("¤" . "(#)") | |
54 | ("°" . "degree") | |
55 | ("÷" . "/") | |
56 | ("€" . "e") | |
57 | ("½" . "1/2") | |
58 | (">" . ">") | |
59 | ("¿" . "?") | |
60 | ("«" . "<<") | |
61 | ("&ldquo" . "\"") | |
62 | ("‹" . "(") | |
63 | ("‘" . "`") | |
64 | ("<" . "<") | |
65 | ("—" . "--") | |
66 | (" " . " ") | |
67 | ("–" . "-") | |
68 | ("‰" . "%%") | |
69 | ("±" . "+-") | |
70 |