fgen.jinja_environment#
Jinja environment to use while generating wrappers
JINJA_ENV#
- JINJA_ENV = <jinja2.environment.Environment object>#
Jinja2 environment to use for template rendering
ensure_indent#
strip_empty_lines#
- strip_empty_lines(inp)[source]#
Strip empty lines
More specifically, turn lines that only have whitespace into a single newline character. This is a workaround until we start formatting our Fortran as part of the generation process (magicc/fgen#26).
get_template_in_directory#
- get_template_in_directory(template_name, template_directory, env)[source]#
Get template that is in the directory specified by
file_dunder
- Parameters:
template_name (
str
) – Name of the template to gettemplate_directory (
pathlib.Path
) –The directory from which to retrieve the template.
If you want to retrieve a template in the same directory as the file that is calling this function, call
get_template_in_directory(template_name, Path(__file__).parent), env)
.env (
jinja2.environment.Environment
) – Jinja2 environment to use when loading the template. This must be using ajinja2.loaders.FileSystemLoader
loader. The loader must only have one search path.
- Returns:
jinja2.environment.Template
– Loaded template