diff options
Diffstat (limited to 'blog/src')
-rw-r--r-- | blog/src/index.html | 14 | ||||
-rw-r--r-- | blog/src/server.lisp | 54 |
2 files changed, 0 insertions, 68 deletions
diff --git a/blog/src/index.html b/blog/src/index.html deleted file mode 100644 index 2ea07d35ade6..000000000000 --- a/blog/src/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <meta name="description" content="wpcarro.dev | blog" /> - <title>wpcarro.dev | blog</title> - <script data-ad-client="ca-pub-6018268443649487" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> - </head> - <body> - <noscript>You need to enable JavaScript to run this app.</noscript> - {{ blog }} - </body> -</html> diff --git a/blog/src/server.lisp b/blog/src/server.lisp deleted file mode 100644 index d2633a2dbd7b..000000000000 --- a/blog/src/server.lisp +++ /dev/null @@ -1,54 +0,0 @@ -(in-package #:cl-user) -(defpackage #:server - (:documentation "Robot condemned to a life of admin work for my blog.") - (:use #:cl) - (:use #:cl-ppcre) - (:import-from #:cl-arrows #:->>) - (:export :main)) -(in-package #:server) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Nix-injected dependencies -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defvar *path-to-posts* "/tmp/" - "File path pointing to the posts directory.") - -(defvar *pandoc-bin* "/usr/bin/pandoc") - -(defvar *html-template* "./index.html" - "The path to the HTML template used for the blog posts.") - -(defvar *posts* (uiop:directory-files *path-to-posts*) - "List of the paths to the blog posts.") - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Library -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; TODO: Support properly indenting the output from pandoc to nest within the -;; template. Or just use a proper templating library. -(defun render-post (path) - "Render the markdown file stored at PATH to HTML using pandoc." - (cl-ppcre:regex-replace-all - "{{ blog }}" - (uiop:read-file-string *html-template*) - (uiop:run-program (list *pandoc-bin* path "--to" "html") :output :string))) - -(hunchentoot:define-easy-handler - (get-latest :uri "/latest") () - (render-post (concatenate 'string *path-to-posts* "/" "test.md"))) - -(hunchentoot:define-easy-handler - (get-posts :uri "/posts") () - "Working!") - -(defun main () - "This is the main entrypoint for our application." - (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)) - (print "Listing on port 4242...") - (sb-thread:join-thread - (find-if (lambda (th) - (string= (sb-thread:thread-name th) - "hunchentoot-listener-*:4242")) - (sb-thread:list-all-threads)))) |