# Boop! – a simple "low-tech" static site generator, for fun. ## Installation In this guide, we assume you are using Linux. First, you should clone the Boop! repository and install its dependencies. Boop! requires Python 3.6 to work (mainly because of our use of the `f-strings`). ```console $ git clone https://framagit.org/marien.fressinaud/boop.git $ cd boop $ pip3 install -r requirements.txt $ cd .. ``` Then, add the path to your `.bashrc`: ```console $ echo export PATH="$(pwd)/boop:\$PATH" >> ~/.bashrc ``` And source it so it considers the change: ```console $ source ~/.bashrc ``` ## Usage First, create a project directory: ```console $ mkdir my-website && cd my-website ``` Create a `./content` folder and execute the Boop! command: ```console $ mkdir content $ echo '

Welcome!

' > content/index.html $ boop.py Boop! ``` Now, you should have your "production-ready" website under a `./output` folder. For example, if your website consists in a single `index.html` page, you should obtain the following structure: ```console $ tree . ├── content │   └── index.html └── output └── index.html ``` Boop! basically just copied `content` files under a `output` directory. But it can convert Markdown files in HTML too. For that, you'll need a template file for articles: ```console $ mkdir theme $ echo '{{ ARTICLE_CONTENT }} theme/article.html ``` Then, you can create your Markdown file as you did with the HTML one: ```console $ echo '# Welcome!' > content/markdown-index.md $ boop.py $ echo output/markdown-index.html

Welcome!

``` You can define meta variables in the Markdown file which will be accessible then in the template. Variables are uppercased and prepended by `ARTICLE_`. For example, for the following Markdown file: ```markdown --- title: Welcome! author: Marien --- This is my article. ``` And the HTML template: ```html {{ ARTICLE_TITLE }}

{{ ARTICLE_TITLE }}

By {{ ARTICLE_AUTHOR }}

{{ ARTICLE_CONTENT }} ``` It will produce the following file: ```html Welcome!

Welcome!

By Marien

This is my article.

``` For now, you can use any valid Python expression between `{{ }}`, you have access to the variables defined in the meta header, the Python builtin functions and the `datetime` module. ## Tests There are some tests (i.e. doctests) that can be run to check that everything works smoothly. They can be executed with: ```console $ python3 -m doctest -v boop.py ```