ninjadog package — ninjadog 0.5.1 documentation

# ninjadog package

## Subpackages

- ninjadog.ext package
  - Submodules
  - ninjadog.ext.pyramid module
  - Module contents

## Submodules

## ninjadog.cli module

ninjadog v0.5.1

Render pug templates to html.

Usage:
  ninjadog string [options] <string> ninjadog file [options] <file> ninjadog dir [options] <source> [<destination>] 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 -n –dry-run verbose output and exit without executing <destination> destination directory to render pug files to

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: typing.Union[typing.Iterable, NoneType] = None)

  Render pug template to stdout.

`ninjadog.cli.` `render_directory`(source: pathlib.Path, destination: pathlib.Path = None, **kwargs)

  Render a directory of pug templates.

  Parameters: | source – the source directory destination – the destination directory [default: source] kwargs – arguments that will be passed to the ninjadog renderer

  Returns: None

## ninjadog.constants module

## ninjadog.decorators module

`ninjadog.decorators.` `idempotent`(func)

  Ensure the function runs only once.

## 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

  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.