# bUwUma **Bu**ild **W**ebsites **U**sing **Ma**ke ## Overview `bUwUma` is a build system that uses **GNU make** and a **preprocessor** written in python to build **static**, **multilingual** websites. This readme only documents the preprocessor. For more information and a quickstart guide on how to use `bUwUma`, please refer to the article [on my website](https://quintern.xyz/en/software/buwuma.html). # HTML Preprocessor Documentation ## Markdown support Using the `#include` command (see below) you can include markdown files, which will be automatically converted to html using [mdtex2html](https://pypi.org/project/mdtex2html), which also supports converting LaTeX to MathML. If mdtex2html is not installed `python-markdown` will be used instead. Preprocessor commands in included markdown files will be handled as well. ## Syntax ### Commands - All commands must be located within a html comment that starts with ``. - Commands start with a `#` character, the command must follow the `#` immediately. - Everything after the command until the end of the comment or a newline character are considered the argument of the command. ```html ``` - All commands return a string, which can be empty. - If a comment contains a command, the entire comment will replaced with the return value of the command. - If there are multiple commands in a comment, it will be replaced by all the return values added together. ### Variables - Variable names must only consist of these characters: `a-zA-Z0-9_` - A variable with name `varname` can be used like this: `#$(varname)` - A variable usage will be replaced by the value of the variable - Any variable that has is not defined has empty string as value ### General - Whitespaces around a token are ignored, so `` is the same as `` - If a command-comment takes up a whole line, the whole line including the newline character is replaced. ## Commands ### include Include the content of a file (or only a specific section in that file) at the position of the command. **Synopsis**: `` `` **Argument**: A absolute or relative path to a text file [ + section name ] **Return Value**: The content of the file or `` empty string if the file can not be opened. --- ### section Start a section in a file. The section is only used by the `include` command to determine the start and end of a section **Synopsis**: `` **Argument**: Name of the section **Return Value**: Empty String --- ### set Set the value of a variable **Synopsis**: Set the value of `varname` to `this is the value`: `` Set the value of `varname` depending on the value of `othervar`: `` **Argument**: Name of the variable **Return Value**: Empty string --- ### comment Comment the arguemnts. **Synopsis**: `` **Argument**: Any string **Return Value**: The argument in comment tags ### uncomment Uncomment the comment. **Synopsis**: `` **Argument**: Any string **Return Value**: The argument This can be useful when you want to look at the unprocessed html without variables or when your syntax highlighting gets confused by a variable. --- ### conditionals To turn on or off entire blocks, `if`, `elif` can `else` be used. These commands can not be nested. Logical and `&&` and logical or `||` can be used to chain conditions. If a condition is true, the corresponding block is included while all other blocks are deleted. **Synopsis** ``` ... ... ... ``` **Argument** Condition for `if` and `elif`, ignored for `else` and `endif` **Return Value** Empty String --- ### sidenav Manage the generation of a content menu which contains links to all headings in your html that have an id. The menu is called sidenav here. An entry is a html heading with a id: `