From: bg66 Date: Mon, 10 Sep 2007 08:49:37 +0000 (+0000) Subject: * mixi.el (mixi-entity-alist): New constant. X-Git-Tag: mixi-el-1_0_0~26 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54f64fe9f93a2dedff2d79ad0309e944b30c11f9;p=elisp%2Fmixi.git * mixi.el (mixi-entity-alist): New constant. (mixi-encode-specials-string): New function. * mixi-atom.el (mixi-make-atom-entry): Use it. * mixi-atom.el (mixi-atom-self): New constant. (mixi-make-atom): Use it. --- diff --git a/ChangeLog b/ChangeLog index 572fab8..804dc68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-09-10 OHASHI Akira + + * mixi.el (mixi-entity-alist): New constant. + (mixi-encode-specials-string): New function. + * mixi-atom.el (mixi-make-atom-entry): Use it. + + * mixi-atom.el (mixi-atom-self): New constant. + (mixi-make-atom): Use it. + 2007-07-25 OHASHI Akira * mixi.el (mixi-topic-comment-list-regexp): Fix regexp. diff --git a/mixi-atom.el b/mixi-atom.el index 3c955e9..4cd250f 100644 --- a/mixi-atom.el +++ b/mixi-atom.el @@ -44,6 +44,11 @@ :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 @@ -96,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")) @@ -121,6 +127,7 @@ RANGE is the range for getting articles. If RANGE is nil, get all articles." (concat "\n" "\n" + "\n" "\n" "" mixi-atom-title "\n" "\n" diff --git a/mixi.el b/mixi.el index 01a4d6a..185a9c8 100644 --- a/mixi.el +++ b/mixi.el @@ -513,6 +513,29 @@ Increase this value when unexpected error frequently occurs." (buffer-string))) ;; stolen (and modified) from w3m.el +(defconst mixi-entity-alist '(("gt" . ">") + ("lt" . "<") + ("amp" . "&")) + "Alist of html character entities and values.") + +;; stolen (and modified) from w3m.el +(defun mixi-encode-specials-string (str) + "Encode special characters in the string STR." + (let ((pos 0) + (buf)) + (while (string-match "[<>&]" str pos) + (setq buf + (cons ";" + (cons (car (rassoc (match-string 0 str) mixi-entity-alist)) + (cons "&" + (cons (substring str pos (match-beginning 0)) + buf)))) + pos (match-end 0))) + (if buf + (apply 'concat (nreverse (cons (substring str pos) buf))) + str))) + +;; stolen (and modified) from w3m.el (defun mixi-url-encode-string (string) (apply (function concat) (mapcar