miniblog

Miniblog: A command-line static blog system in Common Lisp
Log | Files | Refs | README | LICENSE

commit fc57591fbfcd5e8f7b1b3ea0047ca1354756a7ce
parent e15b75a796b25bc2a556cf655f52878bd0acef1f
Author: Decay <decaydjk@tilde.town>
Date:   Sat,  8 Feb 2020 23:57:27 +0000

Add some more configurable display elements

Also fix up the monthly page generation

Diffstat:
Msrc/content.lisp | 13+++++++++++--
Msrc/miniblog.lisp | 16+++++++++++-----
Msrc/template.lhtml | 13++++++++++---
3 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/src/content.lisp b/src/content.lisp @@ -6,13 +6,16 @@ :directory (pathname-directory this-file) :defaults this-file))) -(defun make-generator (&optional title root-uri) +(defun make-generator (&key title root-uri header links stylesheet) (lambda (entries &key year month archive-date-list tz) (execute-emb "default-template" :env (list :title title :root-uri root-uri + :header header + :links links + :stylesheet stylesheet :posts entries :year year :month month @@ -136,7 +139,8 @@ (cdr this-month)))))) (gen-month-and-earlier entries year 12 tz))) -(defun gen-month (entries year month &key archive-date-list generator tz) +(defun gen-month-impl (entries archive-date-list year month + &key generator tz) (let* ((entries-at-month (monthcdr entries year month tz)) (collected (collect-entries-for-month entries-at-month year month tz)) @@ -153,3 +157,8 @@ :tz tz)) nil) rest-entries))) + +(defun gen-month (entries year month &key generator tz) + (gen-month-impl entries (get-archive-date-list entries tz) year month + :generator generator :tz tz)) + diff --git a/src/miniblog.lisp b/src/miniblog.lisp @@ -1,5 +1,8 @@ (in-package :miniblog) +(defvar *blog-header*) +(defvar *blog-links*) +(defvar *blog-stylesheet*) (defvar *blog-title* "Miniblog") (defvar *blog-timezone* *default-timezone*) (defvar *public-html*) @@ -34,7 +37,11 @@ (uiop:getenv "USER")) (defun make-generator (&optional title) - (setf *generator* (miniblog.content:make-generator title *root-uri*))) + (setf *generator* + (miniblog.content:make-generator :title title :root-uri *root-uri* + :header *blog-header* + :links *blog-links* + :stylesheet *blog-stylesheet*))) (defun get-index-file-for-path (path) (merge-pathnames @@ -70,10 +77,9 @@ (miniblog.content:gen-index entries :generator *generator* :tz *blog-timezone*))) - (regenerate-file (list year month - (miniblog.content:gen-month entries year month - :generator *generator* - :tz *blog-timezone*)))) + (regenerate-file (car (miniblog.content:gen-month entries year month + :generator *generator* + :tz *blog-timezone*)))) (defun regenerate-all (entries) (let ((all (miniblog.content:gen-all entries diff --git a/src/template.lhtml b/src/template.lhtml @@ -9,19 +9,26 @@ </title> <style> header#miniblog-header { width :100%; } - section#miniblog-left { float: left; width: 25%; } - section#miniblog-main { float: left; width: <%= (if (getf env :links) "50%" "75%") %>; } - nav#miniblog-nav { float: left; width: 25%; } + section#miniblog-left { float: left; width: 15%; } + section#miniblog-main { float: left; width: <%= (if (getf env :links) "65%" "80%") %>; } + nav#miniblog-nav { float: left; width: 20%; } table.calendar td { width: 25%; } </style> + <% @if stylesheet %> + <link rel="stylesheet" type="text/css" href="<% @var stylesheet %>"> + <% @endif %> </head> <body> <header id="miniblog-header"> <% @if header %> + <% @includevar header %> <% @endif %> </header> <section id="miniblog-left"> <% @if links %> + <% @loop links %> + <a href="<% @var link %>"><% @var text %></a> + <% @endloop %> <% @endif %> </section> <section id="miniblog-main">