From a4e8b49e3d5f21d416b554d935a66d52f3cd08c0 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Thu, 8 Oct 2009 19:17:53 +0200 Subject: Add missing Atom publishing functionality. Ignore-this: 854e1b167c18c61a8faf29bd05594180 darcs-hash:651ba98e3341e180f1a21e9c432f69280458a501 --- journal.lisp | 17 +++++++++++++---- main.lisp | 5 ++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/journal.lisp b/journal.lisp index 75a7afd..d8a4430 100755 --- a/journal.lisp +++ b/journal.lisp @@ -46,7 +46,7 @@ ((:edit :preview) (values "/~D/preview" post-id)) (:post-comment (values "/~D" post-id)) (:trackback (values "/~D/trackback" post-id)) - (:atom (values "/~D/atom" post-id)) + (:view-atom-entry (values "/~D/atom" post-id)) (:save (values "/~D/save" post-id)) (:moderation-page "/moderate") (:css "/../journal.css"))))) @@ -133,7 +133,7 @@ (http-send-headers "application/atom+xml; charset=UTF-8") (with-xml-output (*standard-output* :encoding "utf-8") - (show-atom-entry-xml (find-entry *post-number*) :full-content t))) + (show-atom-entry-xml (find-entry *post-number*) :full-content t :include-edit-links t))) (defun show-atom-entry-xml (journal-entry &key full-content include-edit-links) @@ -171,7 +171,7 @@ #.(restore-sql-reader-syntax-state)) -(defun show-atom-feed () +(defun show-atom-feed (&key include-edit-links) #.(locally-enable-sql-reader-syntax) (revalidate-cache-or-die "application/atom+xml; charset=UTF-8") (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) @@ -208,6 +208,10 @@ (with-tag ("link" `(("rel" "self") ("type" "application/atom+xml") ("href" ,(link-to :view-atom-feed :absolute t))))) + (when include-edit-links + (with-tag ("link" `(("rel" "service.post") + ("type" "application/atom+xml") + ("href" ,(link-to :view-atom-entry :absolute t)))))) (let ((number 0)) (dolist (journal-entry (select 'journal-entry @@ -220,7 +224,8 @@ (> (last-modification-of journal-entry) (- (get-universal-time) (* 30 24 60 60)))) - (<= number 8))) + (<= number 8)) + :include-edit-links include-edit-links) (incf number)))))) #.(restore-sql-reader-syntax-state)) @@ -410,6 +415,10 @@ :type "application/atom+xml" :href (link-to :view-comment-feed) :title "Kompottkins weiser Kommentarfeed") + (<:link :rel "service.feed" + :type "application/atom+xml" + :href (link-to :view-atom-entry) + :title "Kompottkins Weisheiten") (<:link :rel "stylesheet" :type "text/css" :href (link-to :css)) (<:link :rel "openid.server" :href "https://meinguter.name/index.php/serve") (<:link :rel "openid.delegate" :href "https://matthias.benkard.meinguter.name")) diff --git a/main.lisp b/main.lisp index f51edcd..39c4ccb 100644 --- a/main.lisp +++ b/main.lisp @@ -146,7 +146,10 @@ :av-pairs `((spam_p "t"))))) (show-moderation-page))) (:view-atom-entry - (cond ((string= *method* "GET") (show-atom-entry)) + (cond ((string= *method* "GET") + (if *post-number* + (show-atom-entry) + (show-atom-feed :include-edit-links t))) ((member *method* '("POST" "PUT") :test 'equal) (with-transaction () (let* ((entry (if (string= *method* "PUT") -- cgit v1.2.3