[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5.3 Displaying an article

shimbun-article method defined in the `shimbun.el' module gets URL from Xref information of header, get a web page source from the URL, and call shimbun-make-contents in working buffer of the source. Major job of shimbun-make-contents is to process such HTML. Imagine that a working buffer has a web page source of an article. shimbun-make-contents defined in the `shimbun.el' module insert (i) header information to top of the buffer, (ii) `<html>', `<body>' and etc. right after the information, and (iii) `</body>' and `</html>' to end of the buffer. MUA displays an article as a HTML mail.

If you don't want to process an article, you don't have to define shimbun-make-contents in the `sb-foobar.el' module.

If you want to remove some part of a web page source of an article at its top and its end, set regexp to shimbun-foobar-content-start that matches content start and shimbun-foobar-content-end that matches content end.

 
(defvar shimbun-foobar-content-start "^$")
(defvar shimbun-foobar-content-end "^<\/body>$")

shimbun-clear-contents, which is called by shimbun-make-contents defined in the `shimbun.el' module, will remove HTML source from point-min to shimbun-foobar-content-start and from shimbun-foobar-content-end to point-max using the regexps. Note that it will not remove any HTML source when either of the regexp searches fails.

If you want to remove more unnecessary parts (e.x. advertisements) diligently, define shimbun-clear-contents in your new `sb-foobar.el' file as follows:

 
(luna-define-method shimbun-clear-contents :around ((shimbun shimbun-foobar)
                                                    header)
  ;; cleaning up
  (while (re-search-forward "..." nil t nil)
    (delete-region (match-beginning 0) (match-end 0)))
  (luna-call-next-method))

For more details see shimbun-make-contents in the `sb-ibm-dev.el' file.

I said in the subsection of 9.5.2 Getting web page and header information that if each article doesn't have a each unique URLs you have to ask Emacs to remember body of an article when gathering headers information, In such case you don't have to get a web page from URL of Xref in `shimbun-article' method. Just get texts from Emacs memories and put them with pretty printing. For more detail see definitions of `shimbun-article' method of `sb-palmfan.el', `sb-dennou.el' or `sb-tcup.el'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by TSUCHIYA Masatoshi on November, 3 2005 using texi2html