commit ca276a7ead56ecbd8b73cd2e9341aec62f8a8f74
parent 2070db3bb4df28253637ee4fcdaac91c0be4c5f2
Author: Decay <decay@todayiwilllaunchmyinfantsonintoorbit.com>
Date: Sat, 12 Sep 2020 14:46:14 -0700
Refactoring and minor new functionality for mysterious reasons
Also added very not-mysterious pubDate to the RSS feed
Diffstat:
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/content.lisp b/src/content.lisp
@@ -193,3 +193,11 @@
:tz tz))
nil)
rest-entries))))
+
+(defun gen-post (entry &key generator tz archive-date-list enable-rss)
+ "Generate a single post page"
+ (funcall (or generator (make-generator))
+ (list entry)
+ :enable-rss enable-rss
+ :archive-date-list archive-date-list
+ :tz tz))
diff --git a/src/miniblog.lisp b/src/miniblog.lisp
@@ -260,11 +260,14 @@
(user-homedir-pathname)
(make-pathname :name ".miniblog" :type "db"))))
-(defun miniblog (&key add get edit delete list start n regen-all help)
+(defun initialize ()
(init-tz)
(set-config-and-defaults)
(make-generators)
- (miniblog.db:init :sqlite3 :database-name (get-db-filename))
+ (miniblog.db:init :sqlite3 :database-name (get-db-filename)))
+
+(defun miniblog (&key add get edit delete list start n regen-all help)
+ (initialize)
(cond (add (add-new regen-all))
(get (get-post get))
(edit (edit-post edit regen-all))
diff --git a/src/packages.lisp b/src/packages.lisp
@@ -19,12 +19,14 @@
(defpackage :miniblog.content
(:use :cl :local-time :cl-emb :str)
(:export #:make-generator #:make-rss-generator
+ #:get-archive-date-list
#:year-month-of-entry #:year-month-of-latest-entry
- #:gen-all #:gen-index #:gen-month #:gen-rss-feed))
+ #:gen-all #:gen-index #:gen-month #:gen-rss-feed
+ #:gen-post))
(defpackage :miniblog
(:use :cl :command-line-arguments :local-time)
- (:export #:entry-point
+ (:export #:initialize #:entry-point
*blog-title* *blog-header* *blog-links* *blog-stylesheet*
*blog-timezone* *public-html* *root-uri*
*generator* *rss-generator*
diff --git a/src/rss.lxml b/src/rss.lxml
@@ -31,6 +31,11 @@
<category><% @var category %></category>
<% @endif %>
<% @if posts %>
+ <pubDate>
+ <% (let* ((latest (first (getf env :posts))) (pub-date (funcall (getf env :rfc-822-date-formatter) (getf latest :last-updated-at)))) %>
+ <%= pub-date %>
+ <% ) %>
+ </pubDate>
<% (loop for post in (getf env :posts) do %>
<% (destructuring-bind (&key id title content last-updated-at &allow-other-keys) post %>
<item>