Ejemplo n.º 1
0
def get_sphinx_resources(include_bokehjs_api=False):
    docs_cdn = settings.docs_cdn()

    # if BOKEH_DOCS_CDN is unset just use default CDN resources
    if docs_cdn is None:
        resources = Resources(mode="cdn")
    else:
        # "BOKEH_DOCS_CDN=local" is used for building and displaying the docs locally
        if docs_cdn == "local":
            resources = Resources(mode="server", root_url="/en/latest/")

        # "BOKEH_DOCS_CDN=test:newthing" is used for building and deploying test docs to
        # a one-off location "en/newthing" on the docs site
        elif docs_cdn.startswith("test:"):
            resources = Resources(mode="server",
                                  root_url="/en/%s/" % docs_cdn.split(":")[1])

        # Otherwise assume it is a dev/rc/full release version and use CDN for it
        else:
            resources = Resources(mode="cdn", version=docs_cdn)
    if include_bokehjs_api:
        resources.js_components.append("bokeh-api")
    return resources
Ejemplo n.º 2
0
from docutils import nodes
from docutils.parsers.rst import Directive, Parser
from docutils.parsers.rst.directives import choice, flag
from sphinx.errors import SphinxError
from sphinx.util import console, copyfile, ensuredir, status_iterator
from sphinx.util.nodes import set_source_info

from bokeh.settings import settings
from bokeh.resources import Resources
from bokeh.document import Document
from bokeh.embed import autoload_static
from bokeh.util.string import decode_utf8
from bokeh.sphinxext.example_handler import ExampleHandler
from bokeh.sphinxext.templates import PLOT_PAGE

docs_cdn = settings.docs_cdn()
if docs_cdn is None:
    resources = Resources(mode="cdn")
else:
    if docs_cdn == "local":
        # "BOKEH_DOCS_CDN=local" is used for building and displaying the docs locally
        resources = Resources(mode="server", root_url="/en/latest/")
    elif docs_cdn.startswith("test:"):
        # "BOKEH_DOCS_CDN=test:newthing" is used for building and deploying test docs to
        # a one-off location "en/newthing" on the docs site
        resources = Resources(mode="server",
                              root_url="/en/%s/" % docs_cdn.split(":")[1])
    else:
        # Otherwise assume it is a dev/rc/full release version and use CDN for it
        resources = Resources(mode="cdn", version=docs_cdn)