commit
c7d418b896
4 changed files with 22 additions and 23 deletions
|
@ -7,6 +7,10 @@
|
||||||
(:import-from :cl-fad #:file-exists-p)
|
(:import-from :cl-fad #:file-exists-p)
|
||||||
(:import-from :closure-template #:compile-template)
|
(:import-from :closure-template #:compile-template)
|
||||||
(:import-from :local-time #:format-rfc1123-timestring)
|
(:import-from :local-time #:format-rfc1123-timestring)
|
||||||
|
(:import-from :uiop #:getcwd
|
||||||
|
#:chdir
|
||||||
|
#:ensure-directory-pathname
|
||||||
|
#:directory-exists-p)
|
||||||
(:export #:main
|
(:export #:main
|
||||||
#:preview
|
#:preview
|
||||||
#:*config*
|
#:*config*
|
||||||
|
|
|
@ -30,33 +30,28 @@ BODY on files that match the given extension."
|
||||||
#',extension-p
|
#',extension-p
|
||||||
(constantly t))))))
|
(constantly t))))))
|
||||||
|
|
||||||
|
(define-condition directory-does-not-exist (error)
|
||||||
|
((directory :initarg dir :reader dir))
|
||||||
|
(:report (lambda (c stream)
|
||||||
|
(format stream "The directory '~A' does not exist" (dir c)))))
|
||||||
|
|
||||||
|
(defun (setf getcwd) (path)
|
||||||
|
"Change the operating system's current directory to PATH."
|
||||||
|
(setf path (ensure-directory-pathname path))
|
||||||
|
(or (and (directory-exists-p path)
|
||||||
|
(chdir path))
|
||||||
|
(error 'directory-does-not-exist :dir path))
|
||||||
|
path)
|
||||||
|
|
||||||
(defmacro with-current-directory (path &body body)
|
(defmacro with-current-directory (path &body body)
|
||||||
"Change the current directory to PATH and execute BODY in
|
"Change the current directory to PATH and execute BODY in
|
||||||
an UNWIND-PROTECT, then change back to the current directory."
|
an UNWIND-PROTECT, then change back to the current directory."
|
||||||
(alexandria:with-gensyms (old)
|
(alexandria:with-gensyms (old)
|
||||||
`(let ((,old (current-directory)))
|
`(let ((,old (getcwd)))
|
||||||
(unwind-protect (progn
|
(unwind-protect (progn
|
||||||
(setf (current-directory) ,path)
|
(setf (getcwd) ,path)
|
||||||
,@body)
|
,@body)
|
||||||
(setf (current-directory) ,old)))))
|
(setf (getcwd) ,old)))))
|
||||||
|
|
||||||
(defun current-directory ()
|
|
||||||
"Return the operating system's current directory."
|
|
||||||
#+sbcl (sb-posix:getcwd)
|
|
||||||
#+ccl (ccl:current-directory)
|
|
||||||
#+ecl (si:getcwd)
|
|
||||||
#+cmucl (unix:unix-current-directory)
|
|
||||||
#+clisp (ext:cd)
|
|
||||||
#-(or sbcl ccl ecl cmucl clisp) (error "Not implemented yet."))
|
|
||||||
|
|
||||||
(defun (setf current-directory) (path)
|
|
||||||
"Change the operating system's current directory to PATH."
|
|
||||||
#+sbcl (sb-posix:chdir path)
|
|
||||||
#+ccl (setf (ccl:current-directory) path)
|
|
||||||
#+ecl (si:chdir path)
|
|
||||||
#+cmucl (unix:unix-chdir (namestring path))
|
|
||||||
#+clisp (ext:cd path)
|
|
||||||
#-(or sbcl ccl ecl cmucl clisp) (error "Not implemented yet."))
|
|
||||||
|
|
||||||
(defun exit ()
|
(defun exit ()
|
||||||
"Exit the lisp system returning a 0 status code."
|
"Exit the lisp system returning a 0 status code."
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="tags">{\n}
|
<div class="tags">{\n}
|
||||||
{if $post.tags}
|
{if $post.tags}
|
||||||
Tagged as {foreach $tag in $post.tags}
|
Tagged as {foreach $tag in $post.tags}
|
||||||
<a href="../tag/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>{nil}
|
<a href="{$config.domain}/tag/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>{nil}
|
||||||
{if not isLast($tag)},{sp}{/if}
|
{if not isLast($tag)},{sp}{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<p>
|
<p>
|
||||||
{if $post.tags}
|
{if $post.tags}
|
||||||
Tagged as {foreach $tag in $post.tags}
|
Tagged as {foreach $tag in $post.tags}
|
||||||
<a href="../tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
|
<a href="{$config.domain}/tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
|
||||||
{if not isLast($tag)},{sp}{/if}
|
{if not isLast($tag)},{sp}{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Add table
Reference in a new issue