diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/operationnull/pages.scm | 69 | ||||
-rw-r--r-- | src/operationnull/site.scm | 35 | ||||
-rw-r--r-- | src/operationnull/static.scm | 24 | ||||
-rw-r--r-- | src/operationnull/theme.scm | 125 |
4 files changed, 253 insertions, 0 deletions
diff --git a/src/operationnull/pages.scm b/src/operationnull/pages.scm new file mode 100644 index 0000000..1771c8a --- /dev/null +++ b/src/operationnull/pages.scm @@ -0,0 +1,69 @@ +(define-module (operationnull pages) + #:export (index-content + contact-content + gold-content)) + + +(define index-content + '(article (h2 "Welcome.") + (p "operationnull is a site created and run by me, bdunahu. My " + (i "real") + " name is Benjamin.") + (p "My interests often revolve around processing and manipulating text--code generation, interpreters, Norse mythology, traditional sword and sorcery, and GNU Emacs, the ultimate text-based operating system. I graduated from CSU with a B.S. in computer science in Spring 2024.") + (p "I've dabbled a bit in poetry/fiction (" + (a (@ (href "/pages/gold.html")) + "example") + "), though I am still an amateur writer. I am working on a short sword and sorcery piece (~10,000 words) about an outlandish werewolf named Gǫndul and her creator---the master-conjurer Gullveig, though I am not sure when it is likely to see the light of day. A few of my personal project can be found on my " + (a (@ (href "https://git.operationnull.com/")) + "git server") + ", all libre."))) + +(define contact-content + '(article (h2 "Contact") + (p "Contact me with inquiries about the content of this site here:") + (ul (@ (type "bullet")) + (li (b "email: ") "bdunahu @ this domain")) + (p "Additionally, these accounts are/belong to me. I am not on other platforms.") + (ul (@ (type "bullet")) + (li (b "IRC: ") "@ Isaz @ libera.chat") + (li (b "matrix: ") "@bdunahu:tchncs.de")))) + +(define gold-content + '(article (h2 "More Worthless than Gold") + (div (@ (class "date")) + "Written on Feb 12, 2024 by bdunahu") + (br) + (div (p (@ (class "verse")) + "Wilt beneath branches bent on ill-bound hope" + (br) + "our watchful wings cast petals of shadows," + (br) + "the fervent embrace of triple-knot rope" + (br) + "seldom slaughter those born of the gallows." + (br) + (br) + "In sacred wellspring bearing a kingdom," + (br) + "lowly ancients bargain poison and vice." + (br) + "Our madman need savor his wisdom;" + (br) + "to take lore for sight is a witless price." + (br) + (br) + "Wanderer impaled by most faithless knife" + (br) + "tarnished talons adrift the bleeding red," + (br) + "from the icy fibers of self-suffered life" + (br) + "our king --- " + (i "war-maker! all-hater!") + " --- has fed." + (br) + (br) + "In burst fetters terror comes to bite," + (br) + "and thus conclude the coward's futile plight." + (br))))) diff --git a/src/operationnull/site.scm b/src/operationnull/site.scm new file mode 100644 index 0000000..084bf1b --- /dev/null +++ b/src/operationnull/site.scm @@ -0,0 +1,35 @@ +(define-module (operationnull site) + #:use-module (haunt builder assets) + #:use-module (haunt builder atom) + #:use-module (haunt builder blog) + #:use-module (haunt html) + #:use-module (haunt post) + #:use-module (haunt reader) + #:use-module (haunt reader commonmark) + #:use-module (haunt site) + #:use-module (operationnull pages) + #:use-module (operationnull static) + #:use-module (operationnull theme) + #:export (main-site)) + + +(define %blog-collection + `(("Posts" "/posts/index.html" ,posts/reverse-chronological))) + +(define main-site + (site #:title "operationnull" + #:domain "operationnull.com" + #:posts-directory "content/posts" + #:build-directory "target" + #:default-metadata + '((author . "bdunahu")) + #:readers (list commonmark-reader) + #:builders (list (static-page index-content "index.html" "home") + (static-page contact-content "pages/contact.html" "contact") + (blog #:theme main-theme + #:prefix "/posts/" + #:collections %blog-collection) + (static-page gold-content "pages/gold.html" "More Worthless than Gold") + (atom-feed) + (atom-feeds-by-tag) + (static-directory "content/assets" "assets")))) diff --git a/src/operationnull/static.scm b/src/operationnull/static.scm new file mode 100644 index 0000000..25f35e2 --- /dev/null +++ b/src/operationnull/static.scm @@ -0,0 +1,24 @@ +(define-module (operationnull static) + #:use-module (haunt artifact) + #:use-module (haunt reader commonmark) + #:use-module (haunt html) + #:use-module (haunt builder blog) + #:use-module (operationnull theme) + #:export (static-page)) + + +(define* (static-page page destination title + #:key + (theme main-theme) + (reader commonmark-reader)) + "Return a builder procedure that reads FILE into SXML, adjusts it +according to the THEME and serialize to HTML and put it to +build-directory of the site. DESTINATION is a relative resulting file +path." + (lambda (site posts) + (list + (serialized-artifact + destination + (with-layout theme site title page) + sxml->html)))) + diff --git a/src/operationnull/theme.scm b/src/operationnull/theme.scm new file mode 100644 index 0000000..3129203 --- /dev/null +++ b/src/operationnull/theme.scm @@ -0,0 +1,125 @@ +(define-module (operationnull theme) + #:use-module (haunt artifact) + #:use-module (haunt builder blog) + #:use-module (haunt html) + #:use-module (haunt post) + #:use-module (haunt site) + #:use-module (ice-9 match) + #:use-module (srfi srfi-19) + #:export (main-theme)) + +(define %cc-by-sa-link + '(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/")) + "CC-BY-SA 4.0")) + +(define (first-paragraph post) + (let loop ((sxml (post-sxml post))) + (match sxml + (() '()) + (((and paragraph ('p . _)) . _) + (list paragraph)) + ((head . tail) + (cons head (loop tail)))))) + +(define (stylesheet name) + `(link (@ (rel "stylesheet") + (href ,(string-append "/assets/" name ".css"))))) + +(define main-theme + (theme #:name "bdunahu" + #:layout + (lambda (site title body) + `((doctype "html") + (head + (meta (@ (charset "utf-8"))) + (meta (@ (name "viewport") + (content "width=device-width, initial-scale=1"))) + (link (@ (rel "icon") + (type "image/x-icon") + (href "/assets/favicon.ico"))) + (title ,(string-append title " — " (site-title site))) + (link (@ (rel "alternate") + (type "application/atom+xml") + (title "Atom feed") + (href "/feed.xml"))) + ,(stylesheet "site") + ) + (body + (intro + '(div (@ (class "container")) + (img (@ (alt "raven") (class "no-border") + (src "/assets/raven.png"))) + (h1 (span (@ (class "white")) bdunahu)) + (p "cs graduate student @ " + (a (@ (href "https://www.cics.umass.edu/")) + "UMass Amherst")))) + (nav + '(div (@ (class "container")) + (ul (li (a (@ (href "https://git.operationnull.com/")) + "git")) + (li (a (@ (href "/pages/contact.html")) + "contact")) + (li (a (@ (href "/posts/")) + "rand")) + (li (a (@ (href "/")) + "home"))))) + ,body + (footer (@ (class "footer")) + "Copyright © 2024 bdunahu" + (br) + "Site content available under the " ,%cc-by-sa-link " license " + (a (@ (href "https://git.operationnull.com/operationnull.git/")) + "here") + "." + (br) + "Last updated on " + ,(date->string (current-date) "~b ~d, ~Y") + ". Generated with " + (a (@ (href "https://dthompson.us/projects/haunt.html")) + "Haunt") + " and " + (a (@ (href "https://gnu.org/software/guile")) + "Guile Scheme") + ".")))) + #:post-template + (lambda (post) + `((article + (h3 (@ (class "title")),(post-ref post 'title)) + (div (@ (class "date")) + ,(date->string (post-date post) + "~B ~d, ~Y")) + (div (@ (class "post")) + ,(post-sxml post))))) + #:collection-template + (lambda (site title posts prefix) + (define (post-uri post) + (string-append prefix "/" (site-post-slug site post) ".html")) + + `(article (h2 ,title + (a (@ (href "/feed.xml")) + (img (@ (class "feed-icon") (src "/assets/feed.png"))))) + ,(map (lambda (post) + (let ((uri (post-uri post))) + `(article (@ (class "summary")) + (h3 (a (@ (href ,uri)) + ,(post-ref post 'title))) + (div (@ (class "date")) + ,(date->string (post-date post) + "~B ~d, ~Y")) + (div (@ (class "post")) + ,(first-paragraph post)) + (a (@ (href ,uri)) "more...")))) + posts))) + #:pagination-template + (lambda (site body previous-page next-page) + `(,@body + (div (@ (class "paginator")) + ,(if previous-page + `(a (@ (class "paginator-prev") (href ,previous-page)) + "← Newer") + '()) + ,(if next-page + `(a (@ (class "paginator-next") (href ,next-page)) + "Older →") + '())))) + )) |