diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | blog/archetypes/default.md | 6 | ||||
-rw-r--r-- | blog/config.toml | 25 | ||||
-rw-r--r-- | blog/content/english/my-first-post.md | 14 | ||||
-rw-r--r-- | blog/default.nix | 21 | ||||
-rw-r--r-- | blog/deploy.nix | 11 | ||||
-rw-r--r-- | blog/posts/test.md | 4 | ||||
-rw-r--r-- | blog/src/index.html | 14 | ||||
-rw-r--r-- | blog/src/server.lisp | 54 |
9 files changed, 46 insertions, 104 deletions
diff --git a/.gitignore b/.gitignore index b14944eda176..2536625dff4b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ __pycache__ node_modules/ /configs/.config/fish/config.fish /configs/.config/fish/fish_variables +/blog/public/ diff --git a/blog/archetypes/default.md b/blog/archetypes/default.md new file mode 100644 index 000000000000..00e77bd79be4 --- /dev/null +++ b/blog/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/blog/config.toml b/blog/config.toml new file mode 100644 index 000000000000..de67cf19cc69 --- /dev/null +++ b/blog/config.toml @@ -0,0 +1,25 @@ +baseURL = "https://blog.wpcarro.dev" +disqusShortname = "wpcarro" +languageCode = "en-us" +title = "blog.wpcarro.dev" +theme = "tailwind" +pygmentsCodeFences = true +pygmentsUseClasses = true + +[taxonomies] + tag = "tags" + +[permalinks] + posts = "/posts/:year/:month/:title/" + +[params] + author = "William Carroll" + description = "Loosely structured streams of consciousness" + tagline = "Loosely structured streams of consciousness" + +[languages] + [languages.en] + contentDir = "content/english" + languageCode = "en-us" + languageName = "English" + weight = 1 \ No newline at end of file diff --git a/blog/content/english/my-first-post.md b/blog/content/english/my-first-post.md new file mode 100644 index 000000000000..266cc3ab2282 --- /dev/null +++ b/blog/content/english/my-first-post.md @@ -0,0 +1,14 @@ +--- +title: "Professional Emacs" +date: 2020-03-09T11:50:28Z +draft: false +--- +# Professional Emacs + +Some people don't think it's possible. Is it possible? + +## Elisp + +```elisp +(defvar answer 'yes) +``` diff --git a/blog/default.nix b/blog/default.nix deleted file mode 100644 index fd35570a322a..000000000000 --- a/blog/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, depot, briefcase, ... }: - -let - injections = pkgs.writeText "injections.lisp" '' - (in-package #:server) - (setq *path-to-posts* "${./posts}") - (setq *pandoc-bin* "${pkgs.pandoc}/bin/pandoc") - (setq *html-template* "${./src/index.html}") - ''; -in depot.nix.buildLisp.program { - name = "server"; - deps = with depot.third_party.lisp; with briefcase.third_party.lisp; [ - hunchentoot - cl-arrows - cl-ppcre - ]; - srcs = [ - ./src/server.lisp - injections - ]; -} diff --git a/blog/deploy.nix b/blog/deploy.nix deleted file mode 100644 index 5add7f7c6ecb..000000000000 --- a/blog/deploy.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, briefcase, ... }: - -pkgs.dockerTools.buildLayeredImage { - name = "blog"; - tag = "latest"; - config.ExposedPorts = { - "4242" = {}; - }; - config.Cmd = [ "${briefcase.blog}/bin/server" ]; - maxLayers = 120; -} diff --git a/blog/posts/test.md b/blog/posts/test.md deleted file mode 100644 index ec2e030b2824..000000000000 --- a/blog/posts/test.md +++ /dev/null @@ -1,4 +0,0 @@ -# Testing - -The goal here is to be able to write markdown files and have a server that can -render the markdown into HTML and serve them to the clients. 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)))) |