Add website.

This commit is contained in:
David Thompson 2015-08-08 09:42:24 -04:00
parent ddf5b54171
commit 49a34570ce
7 changed files with 928 additions and 0 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/example/site/
/scripts/haunt
*.tar.gz
/website/site

2
website/Makefile Normal file
View File

@ -0,0 +1,2 @@
publish:
rsync -P -rvz --delete site/ blog@dthompson.us:/var/www/haunt --cvs-exclude

254
website/css/main.css Normal file
View File

@ -0,0 +1,254 @@
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
}
@media (min-width: 1200px) {
.container {
width: 1170px;
}
}
.text-center {
text-align: center;
}
.full-width {
width: 100%;
}
.center {
margin-left: auto;
margin-right: auto;
}
.navbar {
padding: 0;
min-height: 40px;
margin-bottom: 20px;
background-color: #333;
border-top: 1px solid #a1a1a1;
border-bottom: 1px solid #a1a1a1;
}
.navbar .container {
padding: 0;
position: relative;
min-height: 40px;
}
.navbar ul {
padding: 0;
height: 100%;
}
.navbar li {
display: inline;
text-decoration: none;
padding-right: 30px;
font-size: 20px;
height: 100%;
}
.navbar .logo {
float: left;
}
.navbar a {
color: #fff;
text-decoration: none;
}
.jumbotron {
padding: 30px;
margin-bottom: 30px;
color: inherit;
background-color: #eee;
font-size: 20px;
}
.row {
display: table;
margin-right: -15px;
margin-left: -15px;
width: 100%;
}
.column-logo, .column-info {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
.column-logo {
width: 40%;
float: left;
}
.column-info {
width: 50%;
float: left;
}
.big-logo {
display: block;
margin-left: auto;
margin-right: auto;
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
text-decoration: none;
}
.btn:focus,
.btn:active:focus,
.btn.active:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn:hover,
.btn:focus {
color: #286090;
text-decoration: none;
}
.btn:active,
.btn.active {
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-primary {
color: #fff;
background-color: #428bca;
border-color: #357ebd;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
color: #fff;
background-color: #3071a9;
border-color: #285e8e;
}
.btn-primary:active,
.btn-primary.active {
background-image: none;
}
.btn-lg,
.btn-group-lg > .btn {
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 6px;
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
th {
text-align: left;
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 20px;
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #ddd;
}
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > td {
border-top: 0;
}

427
website/css/reset.css Normal file
View File

@ -0,0 +1,427 @@
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

203
website/haunt.scm Normal file
View File

@ -0,0 +1,203 @@
;;; Haunt --- Static site generator for GNU Guile
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;;
;;; This file is part of Haunt.
;;;
;;; Haunt is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; Haunt is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Haunt. If not, see <http://www.gnu.org/licenses/>.
(use-modules (haunt site)
(haunt reader)
(haunt asset)
(haunt page)
(haunt post)
(haunt html)
(haunt utils)
(haunt builder blog)
(haunt builder atom)
(haunt builder assets)
(srfi srfi-19)
(ice-9 rdelim)
(ice-9 match)
(web uri))
(define %releases
'(("0.1" "1f751f234e382ed0f13d79e4c106373e9ae55c23")))
(define (tarball-url version)
(string-append "http://files.dthompson.us/haunt/haunt-"
version ".tar.gz"))
(define %download-button
(match %releases
(((version sha1) . _)
`(a (@ (class "btn btn-primary btn-lg")
(role "button")
(href ,(tarball-url version)))
"Download Haunt " ,version))))
(define (stylesheet name)
`(link (@ (rel "stylesheet")
(href ,(string-append "/css/" name ".css")))))
(define (anchor content uri)
`(a (@ (href ,uri)) ,content))
(define (logo src)
`(img (@ (class "logo") (src ,(string-append "/images/" src)))))
(define (jumbotron content)
`(div (@ (class "jumbotron"))
(div (@ (class "row"))
(div (@ (class "column-logo"))
(img (@ (class "big-logo")
(src "/images/haunt.png"))))
(div (@ (class "column-info")) ,content))))
(define %cc-by-sa-link
'(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/"))
"Creative Commons Attribution Share-Alike 4.0 International"))
(define haunt-theme
(theme #:name "Haunt"
#:layout
(lambda (site title body)
`((doctype "html")
(head
(meta (@ (charset "utf-8")))
(title ,(string-append title " — " (site-title site)))
,(stylesheet "reset")
,(stylesheet "main"))
(body
(header (@ (class "navbar"))
(div (@ (class "container"))
(ul
(li ,(anchor "home" "/"))
(li ,(anchor "downloads" "/downloads.html"))
(li ,(anchor "git"
"https://git.dthompson.us/haunt.git")))))
(div (@ (class "container"))
,body
(footer (@ (class "text-center"))
(p (small "Copyright © 2015 David Thompson"))
(p
(small "The text and images on this site are free
culture works available under the " ,%cc-by-sa-link " license.")))))))
#:post-template
(lambda (post)
`((h2 ,(post-ref post 'title))
(h3 "by " ,(post-ref post 'author)
" — " ,(date->string* (post-date post)))
(div ,(post-sxml post))))
#:collection-template
(lambda (site title posts prefix)
(define (post-uri post)
(string-append "/" (or prefix "")
(site-post-slug site post) ".html"))
`(,(jumbotron
`((p "Haunt is a simple, functional, hackable static site
generator written in Guile Scheme that gives authors the ability to
treat websites as programs.")
,%download-button))
(p "Haunt isn't your average static site generator. Its
mission is to give authors the full expressive power of Scheme to
define every aspect of their websites are generated. Haunt uses a
simple, functional build system that allows any type of web page to be
built by writing procedures that return page objects.")
(p "Haunt has no opinion about what markup language
authors should use to write posts. Just write the relevant reader
procedure and Haunt will happily work with that format. Likewise,
Haunt has no opinion about how authors structure their sites. Haunt
ships with helpful builder procedures that generate simple blogs or
Atom feeds, but authors should feel empowered to tweak them, write
replacements, or add new builders to do things that the Haunt hackers
didn't think of.")
(p "Here's what a simple Haunt configuration looks
like:")
(pre
,(call-with-input-file "../example/haunt.scm" read-string))
(p "With the above saved into a file named "
(code "haunt.scm")
" and a "
(code "posts")
" directory populated with the articles to publish,
the site can be built by running "
(code "haunt build")
". Once the site is built, running "
(code "haunt serve")
" and visiting "
(code "localhost:8080")
" in a web browser will show the results of the build
without needing to upload the generated files to a web server.")
(h2 "News")
(ul
,@(map (lambda (post)
`(li
(a (@ (href ,(post-uri post)))
,(post-ref post 'title)
" — "
,(date->string* (post-date post)))))
(posts/reverse-chronological posts)))
(h2 "Contributing")
(p "Patches to fix bugs or add new functionality are
highly encouraged. In lieu of a mailing list, please send patches
to "
(code "davet") " at " (code "gnu") " dot " (code "org")
" for now.")
(p "To get the latest version of the source code, clone
the official git repository:")
(pre "git clone git://dthompson.us/haunt.git")))))
(define (downloads-page site posts)
(define body
`(,(jumbotron
`(,%download-button
(p (small "SHA1 checksum: "
,(match %releases (((_ sha1) . _) sha1))))))
(h2 "Downloads")
(table (@ (class "table"))
(thead
(tr (th "Source") (th "SHA1")))
(tbody
,(map (match-lambda
((version sha1)
`(tr
(td (a (@ (href ,(tarball-url version)))
,(string-append "haunt-" version ".tar.gz")))
(td ,sha1))))
%releases)))))
(make-page "downloads.html"
(with-layout haunt-theme site "Downloads" body)
sxml->html))
(define %collections
`(("Home" "index.html" ,posts/reverse-chronological)))
(site #:title "Haunt"
#:domain "dthompson.us"
#:default-metadata
'((author . "David Thompson")
(email . "davet@gnu.org"))
#:readers (list sxml-reader html-reader)
#:builders (list (blog #:theme haunt-theme #:collections %collections)
(atom-feed)
(atom-feeds-by-tag)
downloads-page
(static-directory "images")
(static-directory "css")))

BIN
website/images/haunt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,41 @@
;;; -*- scheme -*-
(use-modules (haunt utils))
`((title . "Introducing Haunt")
(date . ,(string->date* "2015-08-08 10:00"))
(tags "news" "releases")
(summary . "Haunt 0.1 released")
(content
((p "I am pleased to announce the first alpha release of Haunt, yet
another static site generator. Does the world really need another one
of those? No, but Haunt is special because it is written in Guile
Scheme, a clean and elegant Lisp dialect, which allows users to
compose their websites using functional programming techniques. Using
a general-purpose, extensible programming language to build websites
allows Haunt users to view their website as not just mere data, but a
program. Haunt empowers the user to build the abstractions they need
to make a great static website without getting in the way.")
(p "At its core, Haunt is a very simple program. To build your
site, Haunt takes your posts and static assets as input, passes them
to a series of user-defined building procedures that return one or
more pages, and outputs all of the generated pages to the file system.
That's all there is to it. All of the \"good stuff\" is implemented
in the builder procedures. Haunt 0.1 comes with simple blog and Atom
feed generators.")
(p "Naturally, this website is built with Haunt. You can see its
complete source code in the "
(code "website") " directory in Haunt's "
(a (@ (href "https://git.dthompson.us/haunt.git/tree/HEAD:/website"))
"official git repository")
".")
(p "The Haunt 0.1 release tarball URL can be found on the "
(a (@ (href "/downloads.html")) "downloads page")
".")
(p "Haunt is built to be as hackable as possible, and patches to
improve it are very much welcome. In particular, new post readers for
common formats such as org-mode and Markdown are desired, along with a
more robust blog builder and theme engine. In lieu of a mailing list,
patches may be sent to "
(code "davet") " at " (code "gnu.org") ".")
(p "Happy haunting!"))))