wersh Static site generation with POSIX shell scripts, loosely inspired by werc. USAGE wersh [input] [output] wersh takes files from input/**.w, converts them into shell scripts with wersh.awk, then sources these scripts to produce output files as output/**. Files that don't match *.w are copied directly to the output. Any files or directories that begin with _ are ignored. Files parsed with wersh.awk produce scripts. Any line prefixed with % will be added to the script, and any line without will be automatically output by the target script. Run wersh.awk < input > output to get an idea of how it works. PREPROCESSING You can use a preprocessor to convert script output into some other format. For example, to convert script output to markdown: % preprocessor="hoedown" Your script output will be piped into the preprocessor, and its output used as your script output. ENVIRONMENT When your script executes, the working directory is set to the input directory and the following variables are available: - root: top level input directory - input: path to the input file being processed - output: path to the output file - outputdir: top level output directory The wsource function is also available, which behaves like the source builtin, but it will run the file through wersh.awk first. This is useful for making templates or including files. TEMPLATES The recommended method for making templates is to overwrite the render() function in the template script and source the template script from any files that will use it. The render() function is piped the preprocessed script output and is expected to print the final output. You may use wersh.awk for your template - any output lines are printed directly during the render() function. SITE-WIDE CONFIGURATION If present, the special file _config.sh will be sourced. Note that it will not be preprocessed by wersh.awk. EXAMPLES See example/ for an example wersh site. Run the following: ./wersh example lighttpd -Df lighttpd.conf Then browse to http://localhost:8080 to check out the example site.