summaryrefslogtreecommitdiff
path: root/README.md
blob: 158c03229f18f79f657200be8b675151f6befaa8 (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
45
46
47
48
49
# 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} -e {header template} -f {footer template} [-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 footer should be a simple html file concatenated to all pages. The header is a template where the string "%t" is replaced by the page title and "%n" by the nav bar contents (not including the nav tag itself).

The generated `<nav>` 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

## Remaining work
- Better error messages
- More safety checks. Particularly checking that every generated link is either an absolute path to an extant file or is a proper link out with https and all.