X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mixi-atom.el;h=826ced9e482bc49265cb16071be98ebe3e31b2c5;hb=a9474b0c76b040501d327d56e13cca2252951a6d;hp=add935bf7de11b3352b0229ecd39b0b933addabe;hpb=1cb706d7fc9dfca40b5c795178cf25a201b0153e;p=elisp%2Fmixi.git diff --git a/mixi-atom.el b/mixi-atom.el index add935b..826ced9 100644 --- a/mixi-atom.el +++ b/mixi-atom.el @@ -18,9 +18,9 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program; if not, you can either send email to this -;; program's maintainer or write to: The Free Software Foundation, -;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -44,11 +44,21 @@ :type 'string :group 'mixi) +(defcustom mixi-atom-self "" + "*URI for retrieving Atom Feed Documents representing this Atom feed." + :type 'string + :group 'mixi) + (defcustom mixi-atom-title "Mixi Feed" "*Title for feed." :type 'string :group 'mixi) +(defcustom mixi-atom-file "~/atom.xml" + "*File name for `mixi-make-atom-file'." + :group 'mixi + :type 'string) + (defcustom mixi-atom-syndication-list '((mixi-get-diaries . 10)) "*A list of atom syndication definition. @@ -91,7 +101,8 @@ RANGE is the range for getting articles. If RANGE is nil, get all articles." " " (mixi-make-tag-uri object) "\n" " " (mixi-atom-make-date (mixi-object-time object)) "\n" - " " (mixi-remove-markup (mixi-make-content object)) + " " (mixi-encode-specials-string + (mixi-remove-markup (mixi-make-content object))) "\n" "\n")) @@ -103,20 +114,20 @@ RANGE is the range for getting articles. If RANGE is nil, get all articles." (concat entries (mixi-make-atom-entry object))) (when (mixi-parent-p object) (let ((comments (mixi-get-comments object range))) - (mapc (lambda (comment) - (setq entries - (concat entries - (mixi-make-atom-entry comment)))) - comments)))) - objects) + (while comments + (setq entries + (concat entries + (mixi-make-atom-entry (car comments)))) + (setq comments (cdr comments)))))) + objects) entries)) -;;;###autoload (defun mixi-make-atom () "Make Atom Syndication Format" - (insert "\n" "\n" + "\n" "\n" "" mixi-atom-title "\n" "\n" @@ -141,11 +152,19 @@ RANGE is the range for getting articles. If RANGE is nil, get all articles." "\n")) ;;;###autoload -(defun mixi-atom-write-file (file) +(defun mixi-atom-cgi () + (princ (concat "Content-Type: application/atom+xml; charset=" + (symbol-name mixi-atom-coding-system) "\n" + "\n" + (encode-coding-string (mixi-make-atom) + mixi-atom-coding-system)))) + +;;;###autoload +(defun mixi-atom-file () (with-temp-buffer - (mixi-make-atom) + (insert (mixi-make-atom)) (let ((coding-system-for-write mixi-atom-coding-system) - (file (expand-file-name file))) + (file (expand-file-name mixi-atom-file))) (write-region (point-min) (point-max) file)))) (provide 'mixi-atom)