Improve exposed API for plugins.
This commit is contained in:
parent
ef38d2874f
commit
4e27bcf8cd
6 changed files with 26 additions and 21 deletions
|
@ -54,22 +54,23 @@ on files that match the given extension."
|
|||
(run-program "cp" `("-R" ,dir "."))))
|
||||
(render-posts)
|
||||
(render-indices))
|
||||
(deploy staging)))
|
||||
(deploy staging)
|
||||
(setf (last-published) (last-commit))))
|
||||
|
||||
(defun update-symlink (name target)
|
||||
"Update the symlink NAME to point to TARGET."
|
||||
(run-program "ln" (list "-sfn" (namestring target) name)))
|
||||
|
||||
(defun deploy (dir)
|
||||
"Deploy DIR, updating the .prev and .curr symlinks."
|
||||
(let ((new-build (app-path "generated/~a" (get-universal-time))))
|
||||
(run-program "mv" (list dir (namestring new-build)))
|
||||
(when (probe-file (app-path ".prev"))
|
||||
(delete-files (read-symlink (app-path ".prev")) :recursive t))
|
||||
(when (probe-file (app-path ".curr"))
|
||||
(update-symlink ".prev" (read-symlink (app-path ".curr"))))
|
||||
(update-symlink ".curr" new-build))
|
||||
(setf (last-published) (last-commit)))
|
||||
(defgeneric deploy (dir)
|
||||
(:documentation "Deploy DIR, updating the .prev and .curr symlinks.")
|
||||
(:method (dir)
|
||||
(let ((new-build (app-path "generated/~a" (get-universal-time))))
|
||||
(run-program "mv" (list dir (namestring new-build)))
|
||||
(when (probe-file (app-path ".prev"))
|
||||
(delete-files (read-symlink (app-path ".prev")) :recursive t))
|
||||
(when (probe-file (app-path ".curr"))
|
||||
(update-symlink ".prev" (read-symlink (app-path ".curr"))))
|
||||
(update-symlink ".curr" new-build))))
|
||||
|
||||
(defun main ()
|
||||
(load-config)
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
(domain *config*) (post-slug post))
|
||||
:title (post-title post)
|
||||
:date (post-date post)
|
||||
:contents (post-contents post)))))
|
||||
:content (render-content (post-content post)
|
||||
(post-format post))))))
|
||||
(render-page filename
|
||||
(funcall (theme-fn "INDEX")
|
||||
(list :taglinks (taglinks)
|
||||
|
|
|
@ -5,4 +5,7 @@
|
|||
#:read-symlink
|
||||
#:run-program)
|
||||
(:import-from :iolib.pathnames #:file-path-namestring)
|
||||
(:export #:main))
|
||||
(:export #:main
|
||||
#:add-injection
|
||||
#:render-content
|
||||
#:deploy))
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
(setf (gethash (post-slug post) *posts*) post))))
|
||||
(maphash #'write-post *posts*))
|
||||
|
||||
(defgeneric render-content (text format)
|
||||
(:documentation "Compile TEXT from the given FORMAT to HTML for display.")
|
||||
(:method (text (format (eql :html)))
|
||||
text))
|
||||
|
||||
(defun read-post (stream)
|
||||
"Make a POST instance based on the data from STREAM."
|
||||
)
|
||||
|
@ -31,7 +36,8 @@
|
|||
(list :title (post-title post)
|
||||
:tags (post-tags post)
|
||||
:date (post-date post)
|
||||
:content (post-content post)
|
||||
:content (render-content (post-content post)
|
||||
(post-format post))
|
||||
; TODO: Populate prev and next with links.
|
||||
:prev nil
|
||||
:next nil))))
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
(:method ((str string) location)
|
||||
(pushnew str (gethash location *injections*) :test #'string=)))
|
||||
|
||||
(defgeneric remove-injection (str location)
|
||||
(:documentation "Remove STR from the list of elements injected in LOCATION.")
|
||||
(:method ((str string) location)
|
||||
(setf (gethash location *injections*)
|
||||
(remove str (gethash location *injections*) :test #'string=))))
|
||||
|
||||
(defun theme-package (&key (name (theme *config*)))
|
||||
"Find the package matching the theme NAME."
|
||||
(find-package (string-upcase (concatenate 'string "coleslaw.theme." name))))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="article-meta">
|
||||
<a class="article-title" href="{$post.url}">{$post.title}</a>
|
||||
<div class="date"> posted on {$post.date}</div>
|
||||
<div class="article">{$post.contents |noAutoescape}</div>
|
||||
<div class="article">{$post.content |noAutoescape}</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div id="relative-nav">
|
||||
|
|
Loading…
Add table
Reference in a new issue