sphinx_nbexamples/__init__.py
def from_sphinx(cls, app):
        """Class method to create a :class:`Gallery` instance from the
        configuration of a sphinx application"""
        app.config.html_static_path.append(os.path.join(
            os.path.dirname(__file__), '_static'))
        config = app.config.example_gallery_config

        insert_bokeh = config.get('insert_bokeh')
        if insert_bokeh:
            if not isstring(insert_bokeh):
                import bokeh
                insert_bokeh = bokeh.__version__
            app.add_stylesheet(
                NotebookProcessor.BOKEH_STYLE_SHEET.format(
                    version=insert_bokeh))
            app.add_javascript(
                NotebookProcessor.BOKEH_JS.format(version=insert_bokeh))

        insert_bokeh_widgets = config.get('insert_bokeh_widgets')
        if insert_bokeh_widgets:
            if not isstring(insert_bokeh_widgets):
                import bokeh
                insert_bokeh_widgets = bokeh.__version__
            app.add_stylesheet(
                NotebookProcessor.BOKEH_WIDGETS_STYLE_SHEET.format(
                    version=insert_bokeh_widgets))
            app.add_javascript(
                NotebookProcessor.BOKEH_WIDGETS_JS.format(
                    version=insert_bokeh_widgets))

        if not app.config.process_examples:
            return
        cls(**app.config.example_gallery_config).process_directories()
def from_sphinx(cls, app):
        """Class method to create a :class:`Gallery` instance from the
        configuration of a sphinx application"""
        app.config.html_static_path.append(os.path.join(
            os.path.dirname(__file__), '_static'))
        config = app.config.example_gallery_config

        insert_bokeh = config.get('insert_bokeh')
        if insert_bokeh:
            if not isstring(insert_bokeh):
                import bokeh
                insert_bokeh = bokeh.__version__
            app.add_stylesheet(
                NotebookProcessor.BOKEH_STYLE_SHEET.format(
                    version=insert_bokeh))
            app.add_javascript(
                NotebookProcessor.BOKEH_JS.format(version=insert_bokeh))

        insert_bokeh_widgets = config.get('insert_bokeh_widgets')
        if insert_bokeh_widgets:
            if not isstring(insert_bokeh_widgets):
                import bokeh
                insert_bokeh_widgets = bokeh.__version__
            app.add_stylesheet(
                NotebookProcessor.BOKEH_WIDGETS_STYLE_SHEET.format(
                    version=insert_bokeh_widgets))
            app.add_javascript(
                NotebookProcessor.BOKEH_WIDGETS_JS.format(
                    version=insert_bokeh_widgets))

        if not app.config.process_examples:
            return
        cls(**app.config.example_gallery_config).process_directories()
Class method to create a :class:`Gallery` instance from the
        configuration of a sphinx application