Sphinx ScyllaDB Theme 1.0 is now released 🥳
Learn more
Menu

Custom Extensions

Submodules

sphinx_scylladb_theme.extensions.hero_box module

Sphinx directive for HTML Hero Components.

class sphinx_scylladb_theme.extensions.hero_box.HeroBox(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: docutils.parsers.rst.Directive

has_content = True
option_spec = {'button_icon': <function path>, 'button_text': <function path>, 'button_url': <function path>, 'image': <function path>, 'text': <function unchanged_required>, 'title': <function unchanged_required>}
run()
sphinx_scylladb_theme.extensions.hero_box.setup(app)

sphinx_scylladb_theme.extensions.multiversion module

sphinx_scylladb_theme.extensions.multiversion.add_gh_pages_support(app, exception)

Copies CNAME and .nojekyll files in the root of the output directory.

Parameters
  • app (sphinx.application.Sphinx) – Sphinx Application

  • exception (sphinx.error.SphinxError) – Sphinx Error

sphinx_scylladb_theme.extensions.multiversion.add_notfound_support(app, exception)

Creates a 404.html in the root of the output directory.

Parameters
  • app (sphinx.application.Sphinx) – Sphinx Application

  • exception (sphinx.error.SphinxError) – Sphinx Error

sphinx_scylladb_theme.extensions.multiversion.add_notfound_support_dirhtml(app, exception)

Creates a 404.html in the root of the output directory.

Parameters
  • app (sphinx.application.Sphinx) – Sphinx Application

  • exception (sphinx.error.SphinxError) – Sphinx Error

sphinx_scylladb_theme.extensions.multiversion.create_redirect_to_latest_version(app, exception)

When multiversion is enabled, creates a redirect to the smv_latest_version defined in conf.py.

Parameters
  • app (sphinx.application.Sphinx) – Sphinx Application

  • exception (sphinx.error.SphinxError) – Sphinx Error

sphinx_scylladb_theme.extensions.multiversion.setup(app)

sphinx_scylladb_theme.extensions.navigation module

Extensions for Sphinx which generate the navigation tree from Sphinx’s toctree function’s output.

Copyright (c) 2020 Pradyun Gedam Licensed under the MIT License

Adapted from https://github.com/pradyunsg/furo for ScyllaDB.

sphinx_scylladb_theme.extensions.navigation.get_navigation_tree

Modify the given navigation tree, with furo-specific elements. Adds a checkbox + corresponding label to <li>s that contain a <ul> tag, to enable the I-spent-too-much-time-making-this-CSS-only collapsing sidebar tree.

sphinx_scylladb_theme.extensions.navigation.side_nav_has_one_item

Check if the toc has exactly one list item.

sphinx_scylladb_theme.extensions.panel_box module

Sphinx directive for HTML Panel Box Components.

class sphinx_scylladb_theme.extensions.panel_box.PanelBox(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: docutils.parsers.rst.Directive

has_content = True
option_spec = {'class': <function unchanged>, 'id': <function unchanged>, 'title': <function unchanged_required>}
run()
sphinx_scylladb_theme.extensions.panel_box.setup(app)

sphinx_scylladb_theme.extensions.redirects module

Sphinx extension for generating JavaScript-driven redirects for moved pages.

sphinx_scylladb_theme.extensions.redirects.create_redirects(app, exception)

Creates redirections for all the paths listed in the redirects_file defined in conf.py.

The file should contain a dictionary of redirections formatted as:

>>> old path: new path
Parameters
  • app (sphinx.application.Sphinx) – Sphinx Application

  • exception (sphinx.error.SphinxError) – Sphinx Error

sphinx_scylladb_theme.extensions.redirects.setup(app)

sphinx_scylladb_theme.extensions.substitutions module

Extensions for Sphinx which allow substitutions in code blocks.

Copyright 2014-2016 ClusterHQ Licensed under the Apache License, Version 2.0.

Adapted from https://github.com/adamtheturtle/sphinx-substitution-extensions for ScyllaDB.

class sphinx_scylladb_theme.extensions.substitutions.SubstitutionCodeBlock(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: sphinx.directives.code.CodeBlock

Similar to CodeBlock but replaces placeholders with variables.

option_spec = {'caption': <function unchanged_required>, 'class': <function class_option>, 'dedent': <class 'int'>, 'emphasize-lines': <function unchanged_required>, 'force': <function flag>, 'lineno-start': <class 'int'>, 'linenos': <function flag>, 'name': <function unchanged>, 'substitutions': <function flag>}
run() → List

Replace placeholders with given variables.

sphinx_scylladb_theme.extensions.substitutions.setup(app: sphinx.application.Sphinx) → None

Add the custom directives to Sphinx.

sphinx_scylladb_theme.extensions.substitutions.substitution_code_role(typ: str, rawtext: str, text: str, lineno: int, inliner: docutils.parsers.rst.states.Inliner, options: Dict = {}, content: List[str] = []) → Tuple[List[docutils.nodes.Node], List[docutils.nodes.system_message]]

Replace placeholders with given variables.

sphinx_scylladb_theme.extensions.topic_box module

Sphinx directive for HTML Topic Box Components.

class sphinx_scylladb_theme.extensions.topic_box.TopicBox(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: docutils.parsers.rst.Directive

has_content = True
option_spec = {'anchor': <function path>, 'class': <function unchanged>, 'icon': <function path>, 'icon_color': <function path>, 'image': <function path>, 'link': <function path>, 'title': <function unchanged_required>}
run()
sphinx_scylladb_theme.extensions.topic_box.setup(app)

sphinx_scylladb_theme.extensions.utils module

sphinx_scylladb_theme.extensions.utils.build_redirect_body(path)

Builds the contents of the redirection file.

Parameters

path (str) – Path to redirect to.

Returns

HTML body of the redirection.

Return type

str

sphinx_scylladb_theme.extensions.utils.copy(src, dest)

Copies a file or a folder from src to dest.

Parameters
  • src (str) – The path of the file to copy.

  • dest (str) – The destination path.

sphinx_scylladb_theme.extensions.utils.generate_template(template, **vars)

Replaces variables inside a template.

Parameters

template – Text with variables between brackets {}.

sphinx_scylladb_theme.extensions.utils.is_url(path)

Checks if a path is an external url or a relative path.

Parameters

path (str) – Path to evaluate.

Returns

True if path is an external url.

Return type

bool

Module contents