summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry J. Webster <hwebs@hwebs.info>2026-08-15 10:32:46 -0500
committerHenry J. Webster <hwebs@hwebs.info>2026-08-15 10:32:46 -0500
commit5ddceabece8367ee5487dc93ebe89b742c5258e6 (patch)
treee4c8bec7ade91363fffb9b39e42c99d4efa16207
parent533fb6bd336ae32f109712e9e2d59f18159736e3 (diff)
Add games page
-rw-r--r--games.scm6
-rw-r--r--haunt.scm4
-rw-r--r--theme.scm20
3 files changed, 28 insertions, 2 deletions
diff --git a/games.scm b/games.scm
new file mode 100644
index 0000000..78d89c8
--- /dev/null
+++ b/games.scm
@@ -0,0 +1,6 @@
+(define-module (games)
+ #:use-module (theme)
+ #:export (color-quiz-page))
+
+(define color-quiz-page
+ (game-page "Color Quiz" "cq.js" "cq.html"))
diff --git a/haunt.scm b/haunt.scm
index 4958e17..b749902 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -11,7 +11,8 @@
(haunt html)
(haunt publisher rsync)
(theme)
- (reader))
+ (reader)
+ (games))
(define post-prefix "post")
@@ -53,6 +54,7 @@
#:blog-prefix "/blog/post")
(flat-pages #:template flat-page-template)
(static-directory "images")
+ color-quiz-page
(lambda (site posts)
(list (verbatim-artifact "style.css" "style.css"))))
#:publishers (list (rsync-publisher #:destination "/usr/local/www/www-personal")))
diff --git a/theme.scm b/theme.scm
index 7eb63a3..0a2668e 100644
--- a/theme.scm
+++ b/theme.scm
@@ -2,11 +2,13 @@
#:use-module (haunt html)
#:use-module (haunt site)
#:use-module (haunt post)
+ #:use-module (haunt artifact)
#:use-module (haunt builder blog)
#:use-module (sxml xpath)
#:export (hwebs-theme-blog
hwebs-theme-now
- flat-page-template))
+ flat-page-template
+ game-page))
(define (post-uri post site prefix)
(string-append "/" (or prefix "") "/"
@@ -110,3 +112,19 @@
((header "updated " (time ,(date->string*(post-date post))))
,(post-sxml post)))))
posts)))))
+
+
+;;; GAMES
+(define (static-page title file-name body)
+ (lambda (site posts)
+ (serialized-artifact file-name
+ ;; TODO: simplify this
+ (with-layout hwebs-theme-now site title body)
+ sxml->html)))
+
+(define (game-page name js file-name)
+ (define body
+ `((h1 ,name)
+ (script (@ (src ,js)))
+ (div (@ (id "app")))))
+ (static-page name (string-append "games/" file-name) body))