def run(self):

        env = self.state.document.settings.env
        app = env.app

        template_path = self.arguments[0]
        module_path, template_name = template_path.rsplit('.', 1)

        try:
            module = importlib.import_module(module_path)
        except ImportError:
            msg = "Unable to import Bokeh template module: %s" % module_path
            app.warn(msg)
            node = nodes.error(None,
                               nodes.paragraph(text=msg),
                               nodes.paragraph(text=str(sys.exc_info()[1])))
            return [node]

        template = getattr(module, template_name, None)
        if template is None:
            msg = "Unable to find Bokeh template: %s" % template_path
            app.warn(msg)
            node = nodes.error(None, nodes.paragraph(text=msg))
            return [node]

        template_text = open(template.filename).read()
        m = DOCPAT.match(template_text)
        if m: doc = m.group(1)
        else: doc = None

        filename = basename(template.filename)
        rst_text = JINJA_TEMPLATE.render(
            name=template_name,
            module=module_path,
            objrepr=repr(template),
            doc="" if doc is None else textwrap.dedent(doc),
            lang=filename.rsplit('.', 1)[-1],
            filename=filename,
            template_text=DOCPAT.sub("", template_text),
        )

        result = ViewList()
        for line in rst_text.split("\n"):
            result.append(line, "<bokeh-jinja>")
        node = nodes.paragraph()
        node.document = self.state.document
        nested_parse_with_titles(self.state, result, node)
        return node.children
dataset/ETHPy150Open bokeh/bokeh/bokeh/sphinxext/bokeh_jinja.py/BokehJinjaDirective.run/original