Avoid RENDERing the text of a Post twice

Besides avoiding duplicate work the order in which we assign the values to the
slots no longer matters as excerpt doesn't read the contents from the TEXT slot
anymore.

cf. e1ab552e8f
This commit is contained in:
Javier Olaechea 2017-10-29 01:06:08 -05:00
parent d0178a7b0b
commit a6164f0bc0

View file

@ -9,14 +9,15 @@
(defmethod initialize-instance :after ((object post) &key) (defmethod initialize-instance :after ((object post) &key)
(with-slots (url title author excerpt format text) object (with-slots (url title author excerpt format text) object
(setf url (compute-url object (slugify title)) (let ((post-content (render-text text format)))
format (make-keyword (string-upcase format)) (setf url (compute-url object (slugify title))
text (render-text text format) format (make-keyword (string-upcase format))
excerpt (or excerpt excerpt (or excerpt
(first (split (excerpt-sep *config*) (first (split (excerpt-sep *config*)
(render-text text format) post-content
:limit 2))) :limit 2)))
author (or author (author *config*))))) text post-content
author (or author (author *config*))))))
(defmethod render ((object post) &key prev next) (defmethod render ((object post) &key prev next)
(funcall (theme-fn 'post) (list :config *config* (funcall (theme-fn 'post) (list :config *config*