miniblog

Miniblog: A command-line static blog system in Common Lisp
Log | Files | Refs | README | LICENSE

commit 62ed6e2124716218a68c77f4da59cb2911b5d930
parent 383a1a20e25edec8dbe516b2f70c981072a9df74
Author: Decay <decay@todayiwilllaunchmyinfantsonintoorbit.com>
Date:   Wed, 26 Feb 2020 15:56:53 -0800

Make delete do basic regeneration

Diffstat:
Msrc/miniblog.lisp | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/miniblog.lisp b/src/miniblog.lisp @@ -149,9 +149,19 @@ (regenerate-all entries)))) (format t "No change, abandoning...~%"))))) -(defun delete-post (id) - (format t "Deleting post ID ~d...~%" id) - (miniblog.db:delete-entry id)) +(defun delete-post (id regen) + (miniblog.db:with-entry-id entry id + (format t "Deleting post ID ~d...~%" id) + (miniblog.db:delete-entry id) + (let* ((created-at (nth 1 entry)) + (year (timestamp-year created-at + :timezone *blog-timezone*)) + (month (timestamp-month created-at + :timezone *blog-timezone*)) + (entries (miniblog.db:get-entries))) + (if (not regen) + (regenerate-index-and-given-month entries year month) + (regenerate-all entries))))) (defun list-posts (start n) (let* ((entries (miniblog.db:get-entries)) @@ -192,7 +202,7 @@ (cond (add (add-new regen-all)) (get (get-post get)) (edit (edit-post edit regen-all)) - (delete (delete-post delete)) + (delete (delete-post delete regen-all)) (list (list-posts start n)) (regen-all (regenerate-all (miniblog.db:get-entries))) (t (show-option-help +command-line-spec+))))