diff --git a/homestead.asd b/homestead.asd index 5a24937..42ddacd 100644 --- a/homestead.asd +++ b/homestead.asd @@ -5,9 +5,9 @@ :depends-on (#:cl-markdown) :components ((:module "src" :components - ((:file "main") - (:file "templates") - (:file "util")))) + ((:file "util") + (:file "templates" :depends-on ("util")) + (:file "main" :depends-on ("util" "templates"))))) :description "A static website generator" :in-order-to ((test-op (test-op "homestead/tests")))) diff --git a/resources/site/index.html b/resources/site/index.html index 6384908..4baa05f 100644 --- a/resources/site/index.html +++ b/resources/site/index.html @@ -2,3 +2,5 @@

This is a test for the site homepage.


This should get rendered in the middle of a layout.

+

{{ (include "footer.html") }}

+

Copyright 2024!

diff --git a/src/main.lisp b/src/main.lisp index 7dda95d..4eab69b 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,6 +1,5 @@ (defpackage homestead - (:use #:cl) - (:local-nicknames (#:util #:homestead/util))) + (:use #:cl)) (in-package :homestead) (defparameter *allowed-extensions* '("html" "md")) @@ -13,10 +12,11 @@ (defun load-content-file (full-permalink) "Load the contents of the file at FULL-PERMALINK and return as string" - "test") + full-permalink) (defun get-template (node) - "Get the appropriate template to render the NODE") + "Get the appropriate template to render the NODE" + (first node)) (defun process-metadata-node (node children full-permalink) (let* ((attributes (cadr node)) diff --git a/src/templates.lisp b/src/templates.lisp index 8bd7f1c..0a9bd11 100644 --- a/src/templates.lisp +++ b/src/templates.lisp @@ -1,18 +1,21 @@ (defpackage homestead/templates - (:use #:cl)) + (:use #:cl) + (:export #:render #:include)) (in-package :homestead/templates) ;;; Templates are rendered in a html file as such: ;;; ;;;
-;;; <%= (include "footer") %> +;;; {{ (include "footer") }} ;;;
;;; ;;; This will look in the _includes directory for a file named footer.html or ;;; footer.md (or any allowed extension.) -(defun render () - "Render a full or partial template") +(defun render (template) + "Render a full or partial template" + template) -(defun include () - "Include a partial template at the location of the call") +(defun include (filename) + "Include a partial template at the location of the call" + filename) diff --git a/src/util.lisp b/src/util.lisp index 97c6ecc..25fbde5 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -1,6 +1,8 @@ (defpackage homestead/util + (:nicknames #:util) (:use #:cl) (:export #:join)) + (in-package :homestead/util) (defun join (list &optional (separator ", "))