aboutsummaryrefslogtreecommitdiff
path: root/haunt/haunt.scm
diff options
context:
space:
mode:
authorJakob L. Kreuze2019-07-12 20:10:32 -0400
committerJakob L. Kreuze2019-07-13 19:24:32 -0400
commitc9a30e04e8603c9796fec663a2d374e41e2e6031 (patch)
tree013bb0edb1e7d7285cdc6590e16c0bd209284df4 /haunt/haunt.scm
parented1e5a14dc8c13a564b784ee0fa618cd2f63835b (diff)
Rewrite Haunt configuration.
Diffstat (limited to 'haunt/haunt.scm')
-rw-r--r--haunt/haunt.scm116
1 files changed, 12 insertions, 104 deletions
diff --git a/haunt/haunt.scm b/haunt/haunt.scm
index 1700068..c5ef247 100644
--- a/haunt/haunt.scm
+++ b/haunt/haunt.scm
@@ -14,53 +14,16 @@
;;; along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
-(use-modules (custom alias)
- (custom tag)
- (custom theme)
- (haunt asset)
+(use-modules (haunt builder assets)
(haunt builder atom)
- (haunt builder assets)
- (haunt builder blog)
- (haunt html)
- (haunt page)
(haunt post)
- (haunt reader)
(haunt site)
- (sxml simple)
+ (jakob builder blog)
+ (jakob builder htaccess)
+ (jakob builder static-pages)
+ (jakob reader html-prime)
(srfi srfi-19)
- (srfi srfi-26)
- (ice-9 match))
-
-(define (static-page title slug)
- "Return a procedure serving statically-defined SXML."
- (lambda (site posts)
- (let ((file-name (format #f "~a.html" slug))
- (body (load (format #f "~a.scm" slug))))
- (make-page file-name
- (with-layout jakob-theme site title body)
- sxml->html))))
-
-(define (make-slug post)
- "Create a post slug from the source's filename."
- (let* ((file-name (post-file-name post))
- (splice-start (1+ (string-rindex file-name (cut char=? <> #\/))))
- (splice-end (string-rindex file-name (cut char=? <> #\.))))
- (substring file-name splice-start splice-end)))
-
-;; Use a temporary reader until my patch makes it into an upstream release.
-(define (read-html-post-prime port)
- (values (read-metadata-headers port)
- (let loop ((ret '()))
- (catch 'parser-error
- (lambda ()
- (match (xml->sxml port)
- (('*TOP* sxml) (loop (cons sxml ret)))))
- (lambda (key . parameters)
- (reverse ret))))))
-
-(define html-reader-prime
- (make-reader (make-file-extension-matcher "html")
- (cut call-with-input-file <> read-html-post-prime)))
+ (srfi srfi-26))
;; Replace Haunt's default 'string->date* function with one that recognizes the
;; date format that Org uses.
@@ -72,70 +35,15 @@
(register-metadata-parser! 'date org-string->date)
-(define %collections
- `(("Recent Posts" "index.html" ,posts/reverse-chronological)))
-
-(define %aliases
- (list (cons "blog/post/Bad BEHAVIOR"
- "/reverse-engineering-babbys-first-archive-format.html")
- (cons "blog/post/First Impressions of the Rust Programming Language"
- "/first-impressions-of-the-rust-programming-language.html")
- (cons "blog/post/Duke on FluidSynth"
- "/duke-on-fluidsynth.html")
- (cons "posts/analyzing-executable-size-part-0"
- "/analyzing-executable-size-part-0.html")
- (cons "posts/backdoorctf-2017-funsignals"
- "/backdoorctf-2017-funsignals.html")
- (cons "posts/bad-behavior"
- "/bad-behavior.html")
- (cons "posts/challenges-re-writeups-1"
- "/challenges-re-writeups-1.html")
- (cons "posts/decompilation-by-hand"
- "/decompilation-by-hand.html")
- (cons "posts/duke-on-fluidsynth"
- "/duke-on-fluidsynth.html")
- (cons "posts/first-impressions-of-the-kotlin-programming-language"
- "/first-impressions-of-the-kotlin-programming-language.html")
- (cons "posts/first-impressions-of-the-rust-programming-language"
- "/first-impressions-of-the-rust-programming-language.html")
- (cons "posts/installing-gentoo-one-month-later"
- "/installing-gentoo-one-month-later.html")
- (cons "posts/making-your-own-music-player"
- "/making-your-own-music-player.html")
- (cons "posts/new-ambitions-for-a-new-year"
- "/new-ambitions-for-a-new-year.html")
- (cons "posts/plaidctf-2019"
- "/plaidctf-2019.html")
- (cons "posts/reverse-engineering-babbys-first-archive-format"
- "/reverse-engineering-babbys-first-archive-format.html")
- (cons "posts/sdl-tutorial-part-0x00"
- "/sdl-tutorial-part-0x00.html")
- (cons "posts/slime-the-world-postmortem"
- "/slime-the-world-postmortem.html")
- (cons "posts/understand-game-hacking-in-one-post"
- "/understand-game-hacking-in-one-post.html")))
-
(site #:title "Jakob's Personal Webpage"
#:domain "jakob.space"
#:default-metadata
'((author . "Jakob L. Kreuze")
(email . "zerodaysfordays@sdf.lonestar.org"))
- #:make-slug make-slug
#:readers (list html-reader-prime)
- #:builders (list (blog #:theme jakob-theme #:collections %collections)
- (article-aliases %aliases)
- (atom-feed #:file-name "atom.xml")
- (all-tags)
- (sort-by-tag)
- (static-page "About Me" "about")
- (static-page "Projects" "projects")
- (static-page "Webmention Outbox" "outbox")
- (static-page "JavaScript Web Labels" "weblabels")
- (static-directory "css")
- (static-directory "fonts")
- (static-directory "js")
- (static-directory "images")
- (lambda (site posts)
- (make-asset "other/gpg.txt" "/gpg.txt"))
- (lambda (site posts)
- (make-asset "images/favicon.ico" "/favicon.ico"))))
+ #:builders
+ (list (atom-feed)
+ (blog)
+ (htaccess #:handler-404 "pages/404.html")
+ (static-pages)
+ (static-directory "static")))

© 2015 - 2026 Jakob L. Kreuze