summaryrefslogtreecommitdiff
path: root/README.md
blob: 89e3781f755a5a9d31b4a875c162256fb5a6fe75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Loom - Minimal site "generator"
Loom is a single file haskell program that generates a static html site from a given set of framgents. It is heavily inspired by (node)[https://git.sr.ht/~tagglink/node]. 

## Building Loom
Loom requires a Haskell2010 compiler and the following packages:
- text
- filepath
- directory

GHC should work if it's decently recent. MHS likely is also workable but untested.

## Using Loom
Simply make a directory of html fragments such as:
```
testbak/
├── a.html
├── b
│   ├── c.frag
│   ├── d
│   │   ├── e.html
│   │   └── index.html
│   └── index.html
└── index.html
```
where `.frag` and `.html` are equivalent, and invoke loom:
```
loom -r {root path} -o {output path} [-s {static path}]
```

Each fragment will generate a html page in the output directory in the same structure. The generated page will be composed of a header and footer with the text of the fragment placed in `<main>`. The header also conatins the title of the page, which can be specified by placing a line
```
<!-- == title={title} -->
```
on the first line of the fragment file. The title cannot contain newlines or the vertical bar character. If unspecified it will default to the basename of the fragment file.

The header will also include a `<nav>` which produces a tree featuring the spine from the current page to the root, all descendants of the current page, and any sibling or sibling of an ancestor of the current page. The tree is sorted by file name, should you wish for the tree order and page title to differ.

A static path, if specified, is simply recursively copied into the output directory after generation occurs.

## Limitations compared to node
- No markdown conversion
- No in-page table of contents generation
- Requires a functional Haskell ecosystem