--- a/Makefile Thu Mar 07 14:42:49 2024 -0500
+++ b/Makefile Tue Mar 12 10:24:34 2024 -0400
@@ -2,5 +2,5 @@
all: mw
-mw: mw.lisp static/style.css
+mw: mw.lisp style.css
sbcl --load mw.lisp --eval '(mw:build)'
--- a/README.markdown Thu Mar 07 14:42:49 2024 -0500
+++ b/README.markdown Tue Mar 12 10:24:34 2024 -0400
@@ -31,10 +31,12 @@
Pages can have `extra-titles` and `extra-slugs`, so you can alias really common
pages to avoid typing.
+Anything in `static` will be copied over verbatim, e.g. for images and such.
+
The output will be static, vanilla HTML files that can be served with anything.
No Javascript required.
## TODO
-* Static files (e.g. images) in a folder should get copied over.
+* Check for deleted files and delete them from build directory?
* Maybe an actual CLI?
--- a/mw.lisp Thu Mar 07 14:42:49 2024 -0500
+++ b/mw.lisp Tue Mar 12 10:24:34 2024 -0400
@@ -53,17 +53,23 @@
;;;; Static -------------------------------------------------------------------
-(defparameter *static/style.css*
- (alexandria:read-file-into-string "static/style.css"))
+(defparameter *style.css*
+ (alexandria:read-file-into-string "style.css"))
(defun write-stylesheet ()
- (with-open-file (s "build/static/style.css" :direction :output :if-exists :supersede)
- (write-string *static/style.css* s)
+ (with-open-file (s "build/style.css" :direction :output :if-exists :supersede)
+ (write-string *style.css* s)
(format s "~2%:root {~%")
(when (link-color *config*)
(format s " --link-color: ~A;~%" (link-color *config*)))
(write-line "}" s)))
+(defun has-static-p ()
+ (uiop:directory-exists-p "static"))
+
+(defun copy-static-directory ()
+ (sh '("rsync" "-a" "static/" "build/static/")))
+
;;;; Utils --------------------------------------------------------------------
(defmacro delay (&body body)
@@ -331,7 +337,7 @@
(:title (esc (if page-title
(format nil "~A / ~A" page-title wiki-title)
wiki-title)))
- (:link :href "static/style.css" :rel "stylesheet" :type "text/css")
+ (:link :href "style.css" :rel "stylesheet" :type "text/css")
(:link :rel "icon" :href "data:;base64,iVBORw0KGgo="))
(:body
(:header
@@ -383,7 +389,9 @@
(defun toplevel ()
(let ((*config* (read-config)))
(ensure-directories-exist "build/" :verbose t)
- (ensure-directories-exist "build/static/" :verbose t)
+ (when (has-static-p)
+ (ensure-directories-exist "build/static/" :verbose t)
+ (copy-static-directory))
(write-stylesheet)
(let* ((pages (walk "."))
(*title-table* (build-title-table pages))
--- a/static/style.css Thu Mar 07 14:42:49 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-:root {
- --text-color: black;
- --link-color: brown;
-}
-
-
-header, main, footer {
- max-width: 1200px;
- margin: 0 auto;
-}
-
-header, footer {
- padding: 10px 0;
-}
-
-main {
- padding: 10px 0;
-}
-
-header {
- border-bottom: 1px solid #ccc;
-}
-
-header nav {
- float: right;
-}
-
-footer {
- margin-top: 10px;
- border-top: 1px solid #ccc;
- text-align: center;
-}
-
-body {
- font-size: 16px;
- line-height: 1.6;
-}
-
-a {
- color: var(--link-color);
-}
-
-h1 { font-size: 28px; font-weight: bold; line-height: 1.2; }
-h2 { font-size: 24px; font-weight: bold; line-height: 1.2; }
-h3 { font-size: 20px; font-weight: bold; line-height: 1.4; }
-h4 { font-size: 18px; font-weight: bold; line-height: 1.4; }
-h5 { font-size: 16px; font-weight: bold; line-height: 1.6; }
-h6 { color: red; } /* no */
-
-details.table-of-contents {
- max-width: 400px;
- float: right;
- padding: 0 0 10px 10px;
-}
-
-h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
- color: var(--text-color);
- text-decoration: none;
-}
-
-h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
- color: var(--link-color);
-}
-
-a.broken {
- color: red;
- font-style: italic;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/style.css Tue Mar 12 10:24:34 2024 -0400
@@ -0,0 +1,68 @@
+:root {
+ --text-color: black;
+ --link-color: brown;
+}
+
+
+header, main, footer {
+ max-width: 1200px;
+ margin: 0 auto;
+}
+
+header, footer {
+ padding: 10px 0;
+}
+
+main {
+ padding: 10px 0;
+}
+
+header {
+ border-bottom: 1px solid #ccc;
+}
+
+header nav {
+ float: right;
+}
+
+footer {
+ margin-top: 10px;
+ border-top: 1px solid #ccc;
+ text-align: center;
+}
+
+body {
+ font-size: 16px;
+ line-height: 1.6;
+}
+
+a {
+ color: var(--link-color);
+}
+
+h1 { font-size: 28px; font-weight: bold; line-height: 1.2; }
+h2 { font-size: 24px; font-weight: bold; line-height: 1.2; }
+h3 { font-size: 20px; font-weight: bold; line-height: 1.4; }
+h4 { font-size: 18px; font-weight: bold; line-height: 1.4; }
+h5 { font-size: 16px; font-weight: bold; line-height: 1.6; }
+h6 { color: red; } /* no */
+
+details.table-of-contents {
+ max-width: 400px;
+ float: right;
+ padding: 0 0 10px 10px;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+ color: var(--text-color);
+ text-decoration: none;
+}
+
+h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
+ color: var(--link-color);
+}
+
+a.broken {
+ color: red;
+ font-style: italic;
+}