ninjadog package

Submodules

ninjadog.cli module

ninjadog v0.3.5

Render pug templates to html.

Usage:
ninjadog string [options] <string> ninjadog file [options] <file> ninjadog - [options] ninjadog -h | –help ninjadog -V | –version
Options:
-h –help show help and exit -V –version show version and exit -f –file <file> the filepath to the template -p –pretty pretty print output -c –context <context> json string to be passed as context -j –with-jinja render jinja2 syntax as well as pug -v –verbose verbose output

Strings may be passed via pipe using - argument.

i.e.

echo ‘h1 hello {{ name }}’ | ninjadog - -j -c ‘{“name”: “Sam”}’

outputs

<h1>hello Sam</h1>

ninjadog.cli.main(argv=None)[source]

Render pug template to stdout.

ninjadog.constants module

ninjadog.ninjadog module

Main module.

ninjadog.ninjadog.render(string: str = ”, file: typing.Union[pathlib.Path, str] = None, context: typing.Any = None, pretty: bool = False, pug_cli_path: str = None, with_jinja: bool = False) → str[source]

Render a pug template through the pug cli.

Parameters:
  • string – a string in pug syntax to be rendered
  • file – the path to a pug template
  • context – the data to be passed to the template
  • pretty – pretty html output
  • pug_cli_path – path to the pug cli
  • with_jinja – render jinja2 template syntax as well

Returns: rendered html

ninjadog.utils module

Module contents

Top-level package for ninjadog.