Package: rost
rostA simple static site generator based onJinja2with a command line interface build usingClick.InstallationUse the following command to installrost:$python3-mpipinstallrostLiving on the edgeIf you want to work with the latest code before it’s released, install or update the code from themainbranch:$python3-mpipinstall-Ugit+https://github.com/Robert-96/rost.gitQuickstartIf you’re just looking to render simple data-less templates, you can get up and running with the command line:$ rost buildThis will recursively search./templatesfor templates (any file whose name does not start with.or_) and build them to./dist.To monitor your source directory for changes, recompile files if they change, and start a webserver use watch:$ rost watchThebuildandwatcheach take these common options:--searchpath: Sets the directory to look in for templates.--outputpath: Sets the directory to place rendered files in.--staticpath(is accepted multiple times): The directory (or directories) within searchpath where static files (such  as CSS and JavaScript) are stored.Getting help on version, available commands, arguments or option names:$ rost --version
$ rost --help
$ rost build --help
$ rost watch --helpAdvanced UsageThis part of the documentation covers some ofrost’s more advanced features.Using Custom Build ScriptsThe command line shortcut is convenient, but sometimes your project needs something different than the defaults. To change them, you can use a build script.A minimal build script looks something like this:# build.pyfromrostimportbuildif__name__=="__main__":build(searchpath="templates",outputpath="dist",staticpaths=["static"])Finally, just save the script as build.py (or something similar) and run it with your Python3 interpreter.$ python3 build.pyLoading DataThe simplest way to supply data to the template is to pass a mapping from variable names to their values (a“context”) as thecontextkeyword argument to thebuildorwatchfunctions.# build.pyfromrostimportbuild# A context that should be available all the time to all templates.context={"title":"Rost Example"}if__name__=="__main__":build(searchpath="templates",outputpath="dist",staticpaths=["static"],context=context)If you want to pass data to a specific template you can use thecontextskeyword argument off thebuildandwatchfunctions.# build.pyfromrostimportbuild# A context that should be available all the time to all templates.context={"title":"Rost Example"}# A list of "regex, context" pairs. Each context is either a dictionary or a# function that takes either no argument or or the current template as its sole# argument and returns a dictionary. The regex, if matched against a filename,# will cause the context to be used.contexts=[("*.html",{}),]if__name__=="__main__":build(searchpath="templates",outputpath="dist",staticpaths=["static"],context=context,contexts=contexts)Custom FiltersInside the templates variables can be modified byfilters. All the standard Jinja2 filters are supported (you can found the full listhere). To add your own filters, simply pass your as thefilterskeyword argument to thebuildandwatchfunctions.# build.pyfromrostimportbuildfilters={"hello":lambdax:"Hello,{}!".format(x)}if__name__=="__main__":build(searchpath="templates",outputpath="dist",staticpaths=["static"],filters=filters)Then you can use them in your template as you would expect:{{ 'World'|hello }}LicenseThis project is licensed under theMIT License.