<commit_before>Halwa - A Static Site Generator
=================================

Halwa is a single file static site generator written in Python. It's light-weight and the only dependencies are jinja2, hamlish-jinja, and markdown.

Usage
-----

Using Halwa is as easy as it should be; create a configuration file and point Halwa to it:

> python halwa.py config.py

Overview
--------

Halwa is organized around two main things, *content* and *processors*. A piece of content is a data source (static HTML, HAML, or Markdown) which is eventually converted into an output page (or pages). Halwa uses the following workflow:

1. Initialize a global data dictionary.
2. Load each piece of content specified in *sources*.
3. Run each of the processors specified in *processors*, generating output that goes into the data dictionary.
4. Update each piece of content with the contents of the data dictionary.
5. Render each piece of content, writing it out to the output folder.

A sample configuration is available at [https://github.com/mhlakhani/mhlakhani-com](https://github.com/mhlakhani/mhlakhani-com).

Configuration
-------------

The configuration file is a pure python file. The following variables must be set:

### directories
This is a dictionary that must contain two keys, one for the the *templates* directory, and another for the *output* directory.

### routes
A dictionary containing route definitions for various pieces of content. The key is the route name, and the value is a format string (which will be filled in by the content's metadata). For example, the route '/blog/{tag}' will have '{tag}' replaced by the tag field in the content's metadata.

### sources
A list of 4-tuples, each describing a piece of content. A sample source tuple is below:

> ('Page', 'content/blog*.haml', {'blogsidebar' : 'sidebar'}, ['tags'])

The entries are as follows:<commit_msg>Updated README to reflect installation instructions.<commit_after>Halwa - A Static Site Generator
=================================

Halwa is a single file static site generator written in Python. It's light-weight and the only dependencies are jinja2, hamlish-jinja, and markdown.

Usage
-----

Using Halwa is as easy as it should be; install it, then create a configuration file and point Halwa to it:

> pip install halwa
> python -m halwa config.py

Overview
--------

Halwa is organized around two main things, *content* and *processors*. A piece of content is a data source (static HTML, HAML, or Markdown) which is eventually converted into an output page (or pages). Halwa uses the following workflow:

1. Initialize a global data dictionary.
2. Load each piece of content specified in *sources*.
3. Run each of the processors specified in *processors*, generating output that goes into the data dictionary.
4. Update each piece of content with the contents of the data dictionary.
5. Render each piece of content, writing it out to the output folder.

A sample configuration is available at [https://github.com/mhlakhani/mhlakhani-com](https://github.com/mhlakhani/mhlakhani-com).

Configuration
-------------

The configuration file is a pure python file. The following variables must be set:

### directories
This is a dictionary that must contain two keys, one for the the *templates* directory, and another for the *output* directory.

### routes
A dictionary containing route definitions for various pieces of content. The key is the route name, and the value is a format string (which will be filled in by the content's metadata). For example, the route '/blog/{tag}' will have '{tag}' replaced by the tag field in the content's metadata.

### sources
A list of 4-tuples, each describing a piece of content. A sample source tuple is below:

> ('Page', 'content/blog*.haml', {'blogsidebar' : 'sidebar'}, ['tags'])

The entries are as follows:
{'fraction_non_alphanumeric': 0.09984358706986445, 'fraction_numerical': 0.0036496350364963502, 'mean_word_length': 4.2062415196743554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5138455', 'n_tokens_mistral': 979, 'n_tokens_neox': 952, 'n_words': 545}