miniblog

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

nav.lhtml (1564B)


      1 <nav id="miniblog-nav">
      2   <% @if archive-date-list %>
      3     <%
      4       (let ((arc (copy-list (getf env :archive-date-list))))
      5         (loop while arc do
      6           (format t "<table class=\"calendar\"><tr><th colspan=\"4\">~a</th></tr>~%" (caar arc))
      7           (let ((month-entries '())
      8                 (month-names '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")))
      9             (loop for cal-month downfrom 12 to 1 do
     10               (if (and arc (= cal-month (cdar arc)))
     11                 (progn
     12                   (push (format nil "~d/~2,'0d/index.html" (caar arc) (cdar arc)) month-entries)
     13                   (pop arc))
     14                 (push nil month-entries)))
     15             (loop for row from 0 to 2 do
     16               (format t "<tr>~%")
     17               (loop for cal-month from (* row 4) to (+ (* row 4) 3) do
     18                 (format t "<td>")
     19                 (if (nth cal-month month-entries)
     20                   (format t "<a href=\"~a~a\">~a</a>"
     21                                 (or (getf env :root-uri) "")
     22                                 (nth cal-month month-entries)
     23                                 (nth cal-month month-names))
     24                   (format t "~A" (nth cal-month month-names)))
     25                 (format t "</td>~%"))
     26               (format t "</tr>~%")))
     27             (format t "</table>~%"))) %>
     28   <% @endif %>
     29   <% @if enable-rss %>
     30     <div id="miniblog-rss">
     31       <a href="<% @var root-uri %>rss.xml" target="_blank">
     32         Subscribe to <%= (or (getf env :title) "Miniblog") %>
     33       </a>
     34     </div>
     35   <% @endif %>
     36 </nav>