;;; html2text.el --- a simple html to plain text converter
-;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Joakim Hove <hove@phys.ntnu.no>
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
(defvar html2text-format-single-element-list '(("hr" . html2text-clean-hr)))
(defvar html2text-replace-list
- '((" " . " ") (">" . ">") ("<" . "<") (""" . "\"")
- ("&" . "&") ("'" . "'"))
+ '(("´" . "`")
+ ("&" . "&")
+ ("'" . "'")
+ ("¦" . "|")
+ ("¢" . "c")
+ ("ˆ" . "^")
+ ("©" . "(C)")
+ ("¤" . "(#)")
+ ("°" . "degree")
+ ("÷" . "/")
+ ("€" . "e")
+ ("½" . "1/2")
+ (">" . ">")
+ ("¿" . "?")
+ ("«" . "<<")
+ ("&ldquo" . "\"")
+ ("‹" . "(")
+ ("‘" . "`")
+ ("<" . "<")
+ ("—" . "--")
+ (" " . " ")
+ ("–" . "-")
+ ("‰" . "%%")
+ ("±" . "+-")
+ ("£" . "£")
+ (""" . "\"")
+ ("»" . ">>")
+ ("&rdquo" . "\"")
+ ("®" . "(R)")
+ ("›" . ")")
+ ("’" . "'")
+ ("§" . "§")
+ ("¹" . "^1")
+ ("²" . "^2")
+ ("³" . "^3")
+ ("˜" . "~"))
"The map of entity to text.
This is an alist were each element is a dotted pair consisting of an
This is a list of tags which should be removed, without any
formatting. Note that tags in the list are presented *without*
-any \"<\" or \">\". All occurences of a tag appearing in this
+any \"<\" or \">\". All occurrences of a tag appearing in this
list are removed, irrespective of whether it is a closing or
opening tag, or if the tag has additional attributes. The
deletion is done by the function `html2text-remove-tags'.
(setq refill-start (point))
(goto-char p2)
(re-search-backward ".+[^<][^b][^r][^>]$" refill-start t)
- (next-line 1)
+ (forward-line 1)
(end-of-line)
;; refill-stop should ideally be adjusted to
;; accomodate the "<br>" strings which are removed
(p3) (p4))
(search-backward "<" (point-min) t)
(setq p1 (point))
- (search-forward (format "</%s>" tag) (point-max) t)
+ (unless (search-forward (format "</%s>" tag) (point-max) t)
+ (goto-char p2)
+ (insert (format "</%s>" tag)))
(setq p4 (point))
(search-backward "</" (point-min) t)
(setq p3 (point))