Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crufter/tooeasy

A static site generator in Haskell.
https://github.com/crufter/tooeasy

Last synced: 22 days ago
JSON representation

A static site generator in Haskell.

Awesome Lists containing this project

README

        

tooeasy
=======

Too Easy is an minimal static site generator which is barely more than 30 lines.

#### So what's the catch?

It only supports html as source.

#### How does it work?

It uses (part of) the [Hakit](https://github.com/recurziv/hakit) haskell web toolkit and the
[Haquery](https://github.com/recurziv/haquery) HTML manipulation and template engine.

Too Easy currently contains only two functions: one for loading the posts

```haskell
> import TooEasy
> :t loadPosts
loadPosts :: String -> IO [(Hakit.Document, Haquery.Tag)]
```

And one for loading a template file:

```haskell
> :t loadTemplate
loadTemplate :: String -> IO Haquery.Tag
```

Basically, a post looks like this:

```html
title: I am so clever I must share my wisdom on teh internetz!!!!4!
author: joe
---


I rant about sum clever things here...


```

The first part (above the "---") will get parsed to a Hakit.Document (which is basically a map, see Hakit docs), the part below that will be parsed to a
Haquery.Tag.

A template looks like this:

```html


Title placeholder


Content placeholder

```

Now, since you have a list of (metadata, html content), and a html template, and Haquery, a library which allows you to manipulate HTML,
you can easily see how we can build sites with that: insert the metadata and/or html content into the template, and write that to a file. Repeat until blog is exported.

Too easy, right?

For inspiration see the examples folder or the [source for the recurziv blog](https://github.com/recurziv/recurziv.com-src).