A dialog template renderer based on the mustache templating language.
Definition at line 31 of file scripts/mycroft/dialog/__init__.py.
def mycroft.dialog.MustacheDialogRenderer.__init__ |
( |
|
self | ) |
|
def mycroft.dialog.MustacheDialogRenderer.load_template_file |
( |
|
self, |
|
|
|
template_name, |
|
|
|
filename |
|
) |
| |
Load a template by file name into the templates cache.
Args:
template_name (str): a unique identifier for a group of templates
filename (str): a fully qualified filename of a mustache template.
Definition at line 39 of file scripts/mycroft/dialog/__init__.py.
def mycroft.dialog.MustacheDialogRenderer.render |
( |
|
self, |
|
|
|
template_name, |
|
|
|
context = None , |
|
|
|
index = None |
|
) |
| |
Given a template name, pick a template and render it using the context.
If no matching template exists use template_name as template.
Args:
template_name (str): the name of a template group.
context (dict): dictionary representing values to be rendered
index (int): optional, the specific index in the collection of
templates
Returns:
str: the rendered string
Definition at line 65 of file scripts/mycroft/dialog/__init__.py.
mycroft.dialog.MustacheDialogRenderer.templates |
The documentation for this class was generated from the following file: