summaryrefslogtreecommitdiff
path: root/README.md
blob: 088478896bae7b42a963b421b6f28eae18b26139 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
argent
================================

*a super-simple static site generator*

Argent is a static site generator written in C and using Lua 5.1 for scripting. I wrote it because many other static site generators I experimented with were either very rigid and complex or had been written for old versions of their chosen language and no longer worked in the modern version. Argent brings its own Lua interpreter and is written in C99, and so it should run just about anywhere that you can compile POSIX programs.

installation
--------------------------------

```
git clone https://sanine.net/git/argent
mkdir argent/build
cd argent/build
cmake ..
make
```

Move the resulting `argent` binary to somewhere on your PATH (probably `~/bin`).


using argent
--------------------------------

You need to provide Argent with a configuration file. By default this file is `argent.lua` in the current working directory; you can override that with the `-c [config_file]` command-line option. The configuration file should be a Lua script that returns a table. The keys for this table are listed below. None of these are mandatory, and if they are omitted their default values will be used.

| Key              | Type   | Default | Meaning                                                                                                                                                                                                                              |
|------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| site_name        | string | (nil)   | the name of the site (used for RSS feeds, and may be used by layouts)                                                                                                                                                                |
| site_address     | string | (nil)   | the web address of the site root. required for RSS.                                                                                                                                                                                  |
| site_description | string | (nil)   | a description of the site, used for RSS                                                                                                                                                                                              |
| site_copyright   | string | (nil)   | copyright message for RSS.                                                                                                                                                                                                           |
| site_directory   | string | site    | name of the directory where the site files are located                                                                                                                                                                               |
| output_directory | string | public  | name of the directory to store the output in                                                                                                                                                                                         |
| layout_directory | string | (nil)   | filename of the directory where layouts are located                                                                                                                                                                                  |
| plugin_directory | string | (nil)   | directory to add to `package.path`                                                                                                                                                                                                   |
| exclude          | table  | (nil)   | array of patterns. if a file in `site_directory` matches one of the patterns, it will be excluded from the output.                                                                                                                   |
| include          | table  | (nil)   | array of patterns. if a file in `site_directory` matches one of the patterns, it will be included, even if it matches an exclusion pattern. (This is useful for things like `.htaccess` files, since dotfiles are normally excluded) |
| keep             | table  | (nil)   | array of files and directories in the public result to not touch during site generation.                                                                                                                                             |
| noprocess        | table  | (nil)   | array of patterns. if a file in `site_directory` matches one of the patterns, it will not be processed but instead copied into the output. (This is useful for .lua files you would like to include in the output.)                  |
| rss_include      | table  | (nil)   | array of patterns. if set, the site will create an RSS feed and include matching files in it.                                                                                                                                        |

### site directory

This is the directory that will be compiled into the public site. All of the files within it are copied verbatim to the output directory, with the exception of `.lua` files, which should return tables with at least a markup key. They can also contain any other arbitrary keys, which will be passed on the the layout function. Certain non-markup keys are always present, and have a default value which can be overridden by the page table.

| Key      | Type   | Meaning                                                                                                                                                     |
|----------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| markdown | string | A markup key -- will be converted to HTML                                                                                                                   |
| html     | string | A markup key -- will be inserted into the resulting HTML file                                                                                               |
| layout   | string | Should match one of the layout files' filename (e.g. `layout1.lua` -> `layout='layout1'`) -- specifies a layout function for postprocessing. (default: nil) |
| title    | string | The content of the <title> tag. (default: the bare filename)                                                                                                |
| date     | string | A date for the page, which can be used by the layout function. (default: the file's actual modification date.)                                              |


### layouts

A layout is simply a `.lua` file that returns a function, taking as input `(string, table)`, where the string is the target page's HTML, and the table contains any non-markup keys from the target page's table. This table is guaranteed to contain a `title` and `date` key.

### rss

If the `rss_include` key in the configuration table is non-nil, then an `rss.xml` file will be generated in the output root, containing all of the pages specified by `rss_include` and sorted by date.


license
--------------------------------

This software is licensed under the [Anti-Capitalist Software License](https://anticapitalist.software)