Add `noticebox'.
[elisp/mixi.git] / mixi-atom.el
index 2ac5e12..826ced9 100644 (file)
@@ -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:
 
   :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."
          " <id>" (mixi-make-tag-uri object) "</id>\n"
          " <updated>" (mixi-atom-make-date (mixi-object-time object))
          "</updated>\n"
-         " <summary>" (mixi-remove-markup (mixi-make-content object))
+         " <summary>" (mixi-encode-specials-string
+                       (mixi-remove-markup (mixi-make-content object)))
          "</summary>\n"
          "</entry>\n"))
 
@@ -116,12 +122,12 @@ RANGE is the range for getting articles.  If RANGE is nil, get all articles."
            objects)
     entries))
 
-;;;###autoload
 (defun mixi-make-atom ()
   "Make Atom Syndication Format"
-  (insert "<?xml version=\"1.0\" encoding=\""
+  (concat "<?xml version=\"1.0\" encoding=\""
          (symbol-name mixi-atom-coding-system) "\"?>\n"
          "<feed xmlns=\"" mixi-atom-namespace "\">\n"
+         "<link rel=\"self\" href=\"" mixi-atom-self "\"/>\n"
          "\n"
          "<title>" mixi-atom-title "</title>\n"
          "<link href=\"" mixi-url "\"/>\n"
@@ -146,9 +152,17 @@ RANGE is the range for getting articles.  If RANGE is nil, get all articles."
          "</feed>\n"))
 
 ;;;###autoload
-(defun mixi-make-atom-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 mixi-atom-file)))
       (write-region (point-min) (point-max) file))))