def inject_parser_html_template(self, pluging_name, html_elt, jinja_template):
"""Allows plugins to replace the template of a given HTML element with their own
Args:
pluging_name (str): the name of the plugin responsible for the injection. Used for debug
html_elt (str): the HTML element the template is for
jinja_template (str): The jinja_template that will be used to render a given element
Return:
bool: True ok, False error
note: Due to the way plugins works a template can be overwritten many time. It is okay
"""
if not html_elt or not jinja_template or not pluging_name:
error("%s: plugin_name or html_elt or template not specified in inject_parser_template", pluging_name)
return False
self.config.parser.injected_html_templates[html_elt] = jinja_template
self.config.parser.injected_html_templates_owner[html_elt] = pluging_name
return True
评论列表
文章目录