Statin is a python command line utility to generate static html websites. It implements SSI (Server Side Includes) directives to generate the static files for deployment.
The name statin is a portmanteau of the words static includes.
Statin is available on PyPI. You can install it with pip by simply running the command pip install statin
. You may need superuser permission depending on your system.
Alternatively you can download the package and extract it on your computer. Then you can install the package by running python setup.py install
from inside the extracted package directory. You may require superuser persmission. You can also clone the repository to your computer and execute the script named run
.
You need to have Python 3 installed in order to use the script.
Create your website in html. The files containing SSI directives should have the extension ".shtml"
, ".shtm"
, or ".sht"
. After creating the website change directory to the document root of the site and run the script. By default the static site will be generated in a subdirectory named statin-output.
The command line usage is follows:
statin [-h] [-q | -v] [-s] [-r] [-l LEVEL] [-p PATTERN] [-o OUTPUT] [files [files ...]]
Positional arguments: | |
---|---|
files | List of files to be processed |
Optional arguments: | |
-h, --help | show this help message and exit |
-q, --quiet | Suppress text output to console |
-v, --verbose | Verbose text output to console |
-s, --safe | Disable python eval of strings |
-r, --recursive | Process files recursively |
-l LEVEL, --level LEVEL | Maximum recursion level |
-c COMMAND, --after COMMAND | Run a command on each file after they are processed. The content of the file is supplied through the stdin and the output is read from the stdout . |
-C COMMAND, --before COMMAND | Run a command on each file before they are processed. The content of the file is supplied through the stdin and the output is read from the stdout . |
-p PATTERN, --pattern PATTERN | Filename patterns to be processed |
-o OUTPUT, --output OUTPUT | Specify the output directory |
A directive is written as <!--#directive parameter="value" -->
The supported directives and parameters are listed below:
Directives | Parameters | Description |
---|---|---|
include | file / virtual | Allows embedding another file inside a document. Example — <!--#include file="navbar.html" --> 'file' specifies the path relative to the referencing file and 'virtual' specifies the path relative to the current working directory. |
exec | cgi / cmd | Executes the specified command and embeds the result. |
echo | var | Prints the value of a variable. |
config | timefmt / sizefmt / errmsg | Configures the display format.(timefmt - time format, sizefmt - filesize format, errmsg - displayed error message) |
flastmod | file / virtual | Displayes the last modification date of a file. |
fsize | file / virtual | Displays the size of a file |
printenv | (none) | Outputs the values of all variables. |
if | expr | Used for writing conditional statements. |
elif | expr | |
else | (none) | |
endif | (none) | |
set | var & value | Sets the value of a variable |
The default configuration is stored in the file conf.py. Available configuration options are:
Copyright © 2018-2024 Dr. Agnibho Mondal
All rights reserved
Statin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Agnibho Mondal
mondal@agnibho.com
www.agnibho.com
Softwares of Agnibho
Copyright © 2013-2024 Dr. Agnibho Mondal
www.agnibho.com