Permalink
Browse files

Exporting necessary symbols.

  • Loading branch information...
1 parent 110fbb5 commit 0ad781ced87eff5b8680eded234ff0ac5c68f472 @gigamonkey committed Jan 13, 2012
Showing with 72 additions and 50 deletions.
  1. +20 −20 atom.lisp
  2. +17 −14 feed.lisp
  3. +7 −8 monkeylib-atom.asd
  4. +28 −8 packages.lisp
View
@@ -11,27 +11,27 @@
:category))
(defclass feed ()
- ((title :initarg :title :accessor title)
- (subtitle :initarg :subtitle :accessor subtitle)
- (updated :initarg :updated :accessor updated)
- (tag :initarg :tag :accessor tag)
- (feed-url :initarg :feed-url :accessor feed-url)
- (index-url :initarg :index-url :accessor index-url)
- (rights :initarg :rights :accessor rights)
- (default-author-name :initarg :default-author-name :accessor default-author-name)
+ ((title :initarg :title :accessor title)
+ (subtitle :initarg :subtitle :accessor subtitle)
+ (updated :initarg :updated :accessor updated)
+ (tag :initarg :tag :accessor tag)
+ (feed-url :initarg :feed-url :accessor feed-url)
+ (index-url :initarg :index-url :accessor index-url)
+ (rights :initarg :rights :accessor rights)
+ (default-author-name :initarg :default-author-name :accessor default-author-name)
(default-author-email :initarg :default-author-email :accessor default-author-email)
- (default-author-uri :initarg :default-author-uri :accessor default-author-uri)
- (canonical-host :initarg :canonical-host :accessor canonical-host)
- (full-prefix :initarg :full-prefix :accessor full-prefix)
- (entries :initarg :entries :accessor entries)))
+ (default-author-uri :initarg :default-author-uri :accessor default-author-uri)
+ (canonical-host :initarg :canonical-host :accessor canonical-host)
+ (full-prefix :initarg :full-prefix :accessor full-prefix)
+ (entries :initarg :entries :accessor entries)))
(defclass entry ()
- ((file :initarg :file :accessor file)
- (title :initarg :title :accessor title)
- (body :initarg :body :accessor body)
- (published :initarg :published :accessor published)
- (updated :initarg :updated :accessor updated)
- (categories :initarg :categories :accessor categories)))
+ ((file :initarg :file :accessor file)
+ (title :initarg :title :accessor title)
+ (body :initarg :body :accessor body)
+ (published :initarg :published :accessor published)
+ (updated :initarg :updated :accessor updated)
+ (categories :initarg :categories :accessor categories)))
(defun feed (feed)
(with-slots (title subtitle updated tag feed-url index-url rights entries) feed
@@ -74,7 +74,7 @@
(format nil "http://~a~a~a" canonical-host prefix (permalink name year month date)))
(defun permalink (name year month date)
- (format nil "~4,'0d/~2,'0d/~2,'0d/~a.html" year month date name))
+ (format nil "~4,'0d/~2,'0d/~2,'0d/~a" year month date name))
(defun timestamp (utc)
(format-iso-8601-time utc :time-zone 0))
@@ -83,4 +83,4 @@
"Generate a tag: URL as described in
http://www.taguri.org/07/draft-kindberg-tag-uri-07.html"
(format nil "tag:~a,~4,'0d~@[-~2,'0d~]~@[-~2,'0d~]:~a~@[#~a~]"
- authority-name year month date specific fragment))
+ authority-name year month date specific fragment))
View
@@ -1,4 +1,4 @@
-;;; Copyright (c) 2011, Peter Seibel.
+;;; Copyright (c) 2011, 2012 Peter Seibel.
;;; All rights reserved. See COPYING for details.
(in-package :monkeylib-atom)
@@ -9,22 +9,25 @@
(feed (apply #'make-instance 'feed init-args)))
(setf (updated feed) (file-write-date pathname))
(setf (feed-url feed) (format nil "http://~a~afeed.atom" (canonical-host feed) (full-prefix feed)))
- (setf (entries feed) (parse-entries (entries feed)))
+ (setf (entries feed) (parse-entries (merge-pathnames (entries feed) pathname)))
feed))
(defun parse-entries (pathname)
- (loop for x in (file->list pathname) collect
- (destructuring-bind (file published updated &key categories) x
- (destructuring-bind (title body) (parse-entry (merge-pathnames "./content/" file))
- (make-instance 'entry
- :file file
- :title title
- :body body
- :published published
- :updated updated
- :categories categories)))))
+ "Parse the entries specified in an entries file."
+ (let ((content-dir (merge-pathnames "content/" (merge-pathnames (parent-directory pathname)))))
+ (loop for x in (file->list pathname) collect
+ (destructuring-bind (file published updated &key categories) x
+ (setf file (merge-pathnames content-dir file))
+ (destructuring-bind (title body) (parse-entry file)
+ (make-instance 'entry
+ :file file
+ :title title
+ :body body
+ :published published
+ :updated updated
+ :categories categories))))))
(defun parse-entry (file)
- (destructuring-bind (body-tag h1 &rest body) (parse-file file)
+ (destructuring-bind (body-tag h1 &rest body) (parse-file file :parse-links-p t)
(declare (ignore body-tag))
- (list (second h1) body)))
+ (list `(:progn ,@(rest h1)) body)))
View
@@ -6,13 +6,12 @@
:author "Peter Seibel <peter@gigamonkeys.com>"
:licence "BSD"
:description "ATOM feed generation"
- :components
- ((:file "packages")
- (:file "atom" :depends-on ("packages"))
- (:file "feed" :depends-on ("packages" "atom")))
- :depends-on (:com.gigamonkeys.macro-utilities
- :com.gigamonkeys.pathnames
- :com.gigamonkeys.utilities
+ :depends-on (:com.gigamonkeys.pathnames
+ :com.gigamonkeys.utilities
+ :com.gigamonkeys.markup
:monkeylib-html
:monkeylib-text-output
- :monkeylib-text-languages))
+ :monkeylib-text-languages)
+ :components ((:file "packages")
+ (:file "atom" :depends-on ("packages"))
+ (:file "feed" :depends-on ("packages" "atom"))))
View
@@ -1,20 +1,40 @@
-;;; Copyright (c) 2011, Peter Seibel.
+;;; Copyright (c) 2011, Peter Seibel.;
;;; All rights reserved. See COPYING for details.
(in-package :cl-user)
(defpackage :monkeylib-atom
(:use :common-lisp
- :com.gigamonkeys.macro-utilities
- :com.gigamonkeys.utilities
+ :com.gigamonkeys.utilities
:com.gigamonkeys.pathnames
:com.gigamonkeys.markup
:monkeylib-html
- :monkeylib-text-output
- :monkeylib-text-languages)
+ :monkeylib-text-output
+ :monkeylib-text-languages)
(:shadow :atom)
- (:export
- :atom))
-
+ (:export :feed
+ :parse-feed
+ :permalink
+ ;; Feed slots
+ :title
+ :subtitle
+ :updated
+ :tag
+ :feed-url
+ :index-url
+ :rights
+ :default-author-name
+ :default-author-email
+ :default-author-uri
+ :canonical-host
+ :full-prefix
+ :entries
+ ;; Entry slots
+ :file
+ :title
+ :body
+ :published
+ :updated
+ :categories))

0 comments on commit 0ad781c

Please sign in to comment.