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