Add docs and further RSS tweaks.

This commit is contained in:
Brit Butler 2012-08-22 00:11:33 -04:00
parent 4752370bd5
commit b3455146ae
5 changed files with 111 additions and 7 deletions

6
README
View file

@ -1,16 +1,18 @@
Coleslaw aims to be flexible blog software suitable for replacing a single-user static site compiler such as Jekyll. Coleslaw aims to be flexible blog software suitable for replacing a single-user static site compiler such as Jekyll.
Full docs coming soon...
Features: Features:
* Git for storage * Git for storage
* RSS feeds!
* Plugins to... * Plugins to...
** Import from wordpress ** Import from wordpress
** Use Mathjax/LaTeX ** Use Mathjax/LaTeX
** Host on Amazon S3
Forthcoming: Forthcoming:
* Markdown support * Markdown support
* RST support * RST support
* Atom or RSS feeds * Host on Amazon S3
* Code highlighting * Code highlighting
References: References:

99
docs/coleslaw.html Normal file
View file

@ -0,0 +1,99 @@
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>API for COLESLAW</title>
<style type="text/css" media="all">
body {margin: 0 2em .5em 2em;font-family: Verdana,Arial,sans-serif;}
.package {background: #efefef;
padding: 1.5em 0 1em 0;
text-align: center;
font-size: x-large;}
.definition {background: #efefef; padding: .3em 1em;}
a.symbolname, a:visited.symbolname {font-weight: bold;}
.initargs {font-size: small;}
.slots {font-size: small;}
div.label {border-bottom: 1px solid #efefef; margin-bottom: .5em}
.symboldecl, .footer {margin: 0 2em 2em 2em;}
.symbolname {font-weight: bold; color: gray;}
.symboltype {font-style: italic;margin-left: 1.5em; font-size: smaller;}
.documentation {color: gray; font-family: Fixed,monospace;margin: 0 0 1.5em 0.5em;}
.packagedocumentation {color: gray;
font-family: Fixed,monospace;
margin: 0 0 1.5em 0;
border: 1px solid #efefef;
padding-left: 1.5em;}
.symbolcomments span {font-weight: bold;}
.footer {font-size: x-small; text-align: right; margin-top: 2em; padding-top: 1em; border-top: 1px solid gray;}
.undocumented {color: red; font-weight: bold;}
a, a:visited {font-weight: bold; color: gray; text-decoration: none; font-weight: normal;}
a:hover {border-bottom: 1px solid gray; }
.label {font-weight: bold; font-style: italic;color: gray;}
.labeltitle {font-weight: bold; font-style: italic;color: gray; border: 1px solid #efefef; padding: .25em;margin-bottom: .5em}
.frame {marin-top: 1.5em}
.expander {border: 2px solid #efefef; color: gray;
font-weight: bold;
font-family: Fixed,monospace;
margin-right: .25em; padding: 0 .25em;cursor: pointer;}
</style>
<script type="text/javascript">
function expand (expander, id) {
var text = expander.innerHTML;
if (text == '-')
{
expander.innerHTML = '+';
document.getElementById(id).style.display = 'none';
}
else
{
expander.innerHTML = '-';
document.getElementById(id).style.display = '';
}
}</script></head>
<body>
<div class="package">
<div class="definition">API for package:
<a class="symbolname" name="coleslaw_package" href="#coleslaw_package">coleslaw</a></div></div>
<div class="packagedocumentation">
<pre>Homepage: <a href="http://github.com/redline6561/coleslaw">Github</a></pre></div>
<div class="frame">
<div class="labeltitle">
<span class="expander" onclick="expand(this, 'functions');">-</span>Functions</div>
<div id="functions">
<div class="symboldecl">
<div class="definition">
<a class="symbolname" name="add-injection_func" href="#add-injection_func">add-injection</a>
<span class="lambdalist">str location</span>
<span class="symboltype">standard-generic-function</span></div>
<div class="documentation">
<pre>Add STR to the list of elements injected in LOCATION.</pre></div></div>
<div class="symboldecl">
<div class="definition">
<a class="symbolname" name="deploy_func" href="#deploy_func">deploy</a>
<span class="lambdalist">dir</span>
<span class="symboltype">standard-generic-function</span></div>
<div class="documentation">
<pre>Deploy DIR, updating the .prev and .curr symlinks.</pre></div></div>
<div class="symboldecl">
<div class="definition">
<a class="symbolname" name="main_func" href="#main_func">main</a>
<span class="lambdalist"></span>
<span class="symboltype">function</span></div>
<div class="documentation">
<pre>:undocumented</pre></div></div>
<div class="symboldecl">
<div class="definition">
<a class="symbolname" name="render-content_func" href="#render-content_func">render-content</a>
<span class="lambdalist">text format</span>
<span class="symboltype">standard-generic-function</span></div>
<div class="documentation">
<pre>Compile TEXT from the given FORMAT to HTML for display.</pre></div></div>
<div class="symboldecl">
<div class="definition">
<a class="symbolname" name="render-feed_func" href="#render-feed_func">render-feed</a>
<span class="lambdalist"></span>
<span class="symboltype">function</span></div>
<div class="documentation">
<pre>Render and write the feed for the site.</pre></div></div></div></div>
<div class="footer">Generated by:
<a href="http://common-lisp.net/project/cl-api">CL-API</a></div></body></html>

View file

@ -25,8 +25,9 @@ on files that match the given extension."
`,body)) `,body))
(list-directory ,path)))) (list-directory ,path))))
(defun render-page (path html) (defun render-page (path html &optional raw)
"Populate the base template with the provided HTML and write it out to PATH." "Populate the base template with the provided HTML and write it out to PATH.
If RAW is non-nil, write the content without wrapping it in the base template."
(let ((filepath (merge-pathnames path (staging *config*)))) (let ((filepath (merge-pathnames path (staging *config*))))
(ensure-directories-exist filepath) (ensure-directories-exist filepath)
(with-open-file (out filepath (with-open-file (out filepath
@ -43,7 +44,7 @@ on files that match the given extension."
(gethash :body *injections*)) (gethash :body *injections*))
:license (license *config*) :license (license *config*)
:credits (author *config*))))) :credits (author *config*)))))
(write-line content out))))) (write-line (if raw html content) out)))))
(defun compile-blog () (defun compile-blog ()
"Compile the blog to a staging directory in /tmp." "Compile the blog to a staging directory in /tmp."

View file

@ -20,7 +20,7 @@
(format nil "<![CDATA[ ~A ]]>" string)) (format nil "<![CDATA[ ~A ]]>" string))
(defun render-feed () (defun render-feed ()
"Render and write the RSS feed for the site." "Render and write the feed for the site."
(let* ((posts (subseq (by-date (hash-table-values *posts*)) 0 10)) (let* ((posts (subseq (by-date (hash-table-values *posts*)) 0 10))
(content (loop for post in posts (content (loop for post in posts
collect (list :title (post-title post) collect (list :title (post-title post)
@ -34,4 +34,4 @@
:title (title *config*) :title (title *config*)
:siteroot (domain *config*) :siteroot (domain *config*)
:author (author *config*) :author (author *config*)
:posts content)))) :posts content)) t))

View file

@ -1,4 +1,5 @@
(defpackage :coleslaw (defpackage :coleslaw
(:documentation "Homepage: <a href=\"http://github.com/redline6561/coleslaw\">Github</a>")
(:use :cl :closure-template) (:use :cl :closure-template)
(:import-from :cl-fad #:delete-directory-and-files (:import-from :cl-fad #:delete-directory-and-files
#:list-directory) #:list-directory)
@ -10,4 +11,5 @@
(:export #:main (:export #:main
#:add-injection #:add-injection
#:render-content #:render-content
#:render-feed
#:deploy)) #:deploy))