Commit | Line | Data |
---|---|---|
23f87bed | 1 | ;;; html2text.el --- a simple html to plain text converter |
e84b4b86 | 2 | |
73b0cd50 | 3 | ;; Copyright (C) 2002-2011 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 | ||
5e809f55 | 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
23f87bed | 10 | ;; it under the terms of the GNU General Public License as published by |
5e809f55 GM |
11 | ;; the Free Software Foundation, either version 3 of the License, or |
12 | ;; (at your option) any later version. | |
23f87bed MB |
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 | |
5e809f55 | 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23f87bed MB |
17 | ;; GNU General Public License for more details. |
18 | ||
19 | ;; You should have received a copy of the GNU General Public License | |
5e809f55 | 20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
23f87bed MB |
21 | |
22 | ;;; Commentary: | |
23 | ||
24 | ;; These functions provide a simple way to wash/clean html infected | |
25 | ;; mails. Definitely do not work in all cases, but some improvement | |
e2642250 | 26 | ;; in readability is generally obtained. Formatting is only done in |
23f87bed MB |
27 | ;; the buffer, so the next time you enter the article it will be |
28 | ;; "re-htmlized". | |
29 | ;; | |
e2642250 | 30 | ;; The main function is `html2text'. |
23f87bed MB |
31 | |
32 | ;;; Code: | |
33 | ||
34 | ;; | |
35 | ;; <Global variables> | |
36 | ;; | |
37 | ||
38 | (eval-when-compile | |
39 | (require 'cl)) | |
40 | ||
41 | (defvar html2text-format-single-element-list '(("hr" . html2text-clean-hr))) | |
42 | ||
43 | (defvar html2text-replace-list | |
01c52d31 MB |
44 | '(("´" . "`") |
45 | ("&" . "&") | |
46 | ("'" . "'") | |
47 | ("¦" . "|") | |
48 | ("¢" . "c") | |
49 | ("ˆ" . "^") | |
50 | ("©" . "(C)") | |
51 | ("¤" . "(#)") | |
52 | ("°" . "degree") | |
53 | ("÷" . "/") | |
54 | ("€" . "e") | |
55 | ("½" . "1/2") | |
56 | (">" . ">") | |
57 | ("¿" . "?") | |
58 | ("«" . "<<") | |
59 | ("&ldquo" . "\"") | |
60 | ("‹" . "(") | |
61 | ("‘" . "`") | |
62 | ("<" . "<") | |
63 | ("—" . "--") | |
64 | (" " . " ") | |
65 | ("–" . "-") | |
66 | ("‰" . "%%") | |
67 | ("±" . "+-") | |
68 |