annotate lisp/tm/tm-html.el @ 10:49a24b4fd526 r19-15b6

Import from CVS: tag r19-15b6
author cvs
date Mon, 13 Aug 2007 08:47:52 +0200
parents 4b173ad71786
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2 ;;; tm-html.el: a tm-view internal decoder for HTML
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8 ;;; Created: 1995/9/14
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;;; based on tm-latex.el by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;;; Version:
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
11 ;;; $Id: tm-html.el,v 1.3 1996/12/29 00:15:14 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;;; Keywords: mail, news, MIME, multimedia, HTML, WWW
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;;; This file is part of tm (Tools for MIME).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;;; published by the Free Software Foundation; either version 2, or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;;; (at your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;;; This program is distributed in the hope that it will be useful,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;;; along with This program. If not, write to the Free Software
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'tm-view)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (defun mime-article/decode-html (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 (let* ((cur-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 new-buf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (name (or (cdr (assoc "name" cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (cdr (assoc "x-name" cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (concat (make-temp-name "tm") ".html")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 (encoding (cdr (assq 'encoding cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 ;; modified by Shuhei KOBAYASHI <shuhei@cmpt01.phys.tohoku.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ;; 1995/11/17 (cf. [tm-ja:1117])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (html-helper-build-new-buffer nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 (switch-to-buffer mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (funcall mime/find-file-function (expand-file-name name mime/tmp-dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 (if (or (<= (buffer-size) 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 (y-or-n-p "Replace the existing buffer?"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (setq new-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (set-buffer cur-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (re-search-forward "^$")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (append-to-buffer new-buf (+ (match-end 0) 1) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (mime-decode-region (point-min)(point-max) encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (run-hooks 'mime-article/decode-html-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (set-atype 'mime/content-decoding-condition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 '((type . "text/html")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 (method . mime-article/decode-html)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (mode . "extract")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (provide 'tm-html)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 ;;; end of tm-html.el