origen.compiler#
Classes#
Compiler: Undocumented.JinjaRenderer: Helper class that provides a standard way to create an ABC usingMakoRenderer: Helper class that provides a standard way to create an ABC usingRenderer: Helper class that provides a standard way to create an ABC using
- class origen.compiler.Compiler(*args, **options)#
- clear()#
- property last_render#
- pop()#
- push(*args, **options)#
- render(src, *, direct_src=False, syntax=None, context={}, use_standard_context=True, renderer_opts={}, output_dir=None, output_name=None, file_to_string=False, **options)#
Direct access to compling templates.
- renderer_for(src, direct_src=False, syntax=None)#
- resolve_filename(src, *, output_dir=None, output_name=None, renderer=None)#
Resolves the output name from the source, and given options.
Resolution rules:
- if no output_dir or output_name is given, the resolved filename will end up in
<app_output_dir>/renders/<file.x>where the syntax-specific extension has been removed from the filename
- if an output name is given, the name and extension is changed to the output name, but the
output_dir remains as above.
- if the output_dir is given, the templates are written to that location. Same rules for
output_name apply
- run(*args, **options)#
- select_syntax(filename, syntax=None)#
- property supported_extensions#
- property syntaxes#
- property templates_dir#
- class origen.compiler.JinjaRenderer(compiler, renderer_opts={})#
- file_extensions = ['jinja', 'jinja2', 'j2']#
- preprocessor = []#
- render_file(src, output_file, context)#
- render_str(src, context)#
- classmethod resolve_filename(src)#
- class origen.compiler.MakoRenderer(compiler, renderer_opts={})#
- class MakoSyntax#
- ctrl_struct = re.compile('^\\s*\\%.*\\%')#
- expresions = [re.compile('\\$\\{.*\\}'), re.compile('^\\s*\\%.*\\%'), re.compile('\\<\\%\\!.*\\%\\>'), re.compile('\\<\\%.*\\>')]#
- inspect(arg)#
- module_block = re.compile('\\<\\%\\!.*\\%\\>')#
- tag = re.compile('\\<\\%.*\\>')#
- var_sub = re.compile('\\$\\{.*\\}')#
- file_extensions = ['mako']#
- preprocessor = [<function MakoRenderer.<lambda>>]#
Preprocessor to remove double newlines from Windows sources
See also
- render_file(src, output_file, context)#
- render_str(src, context)#
- classmethod resolve_filename(src)#
- syntax = <origen.compiler.MakoRenderer.MakoSyntax object>#
Exceptions#
ExplicitSyntaxRequiredError: Raised when an explicit syntax is required, but none was givenUnknownSyntaxError: Raised when an unknown syntax if given
- exception origen.compiler.ExplicitSyntaxRequiredError(src, *, direct_src)#
Raised when an explicit syntax is required, but none was given
- exception origen.compiler.UnknownSyntaxError(syntax)#
Raised when an unknown syntax if given