tm 7.28.
[elisp/tm.git] / tm-html.el
1 ;;;
2 ;;; tm-html.el: a tm-view internal decoder for HTML
3 ;;;
4 ;;; by MORIOKA Tomohiko <morioka@jaist.ac.jp> (1995/09/14)
5 ;;;
6 ;;; based on tm-latex.el by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
7 ;;;
8 ;;; $Id: tm-html.el,v 7.3 1995/12/04 00:20:31 morioka Exp $
9 ;;;
10
11 (require 'tm-view)
12
13 (defun mime-article/decode-html (beg end cal)
14   (let* ((cur-buf (current-buffer))
15          new-buf
16          (name (or (cdr (assoc "name" cal))
17                    (cdr (assoc "x-name" cal))
18                    (concat (make-temp-name "tm") ".html")))
19          (encoding (cdr (assoc "encoding" cal)))
20          ;; modified by Shuhei KOBAYASHI <shuhei@cmpt01.phys.tohoku.ac.jp>
21          ;;     1995/11/17 (cf. [tm-ja:1117])
22          (html-helper-build-new-buffer nil)
23          )
24     (switch-to-buffer mime::article/preview-buffer)
25     (funcall mime/find-file-function (expand-file-name name mime/tmp-dir))
26     (if (or (<= (buffer-size) 0)
27             (y-or-n-p "Replace the existing buffer?"))
28         (progn
29           (erase-buffer)
30           (setq new-buf (current-buffer))
31           (save-excursion
32             (set-buffer cur-buf)
33             (goto-char beg)
34             (re-search-forward "^$")
35             (append-to-buffer new-buf (+ (match-end 0) 1) end)
36             )))
37     (mime/decode-region encoding (point-min)(point-max))
38     (run-hooks 'mime-article/decode-html-hook)
39     ))
40
41 (set-atype 'mime/content-decoding-condition
42            '((type . "text/html")
43              (method . mime-article/decode-html)
44              (mode . "extract")
45              ))
46
47
48 ;;; @ end
49 ;;;
50
51 (provide 'tm-html)