xanadu_sphinx_theme.RelatedDemoDirective

class xanadu_sphinx_theme.RelatedDemoDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Bases: Directive

Creates a related demo and adds it to the sidebar.

add_index

final_argument_whitespace

May the final argument contain whitespace?

has_content

May the directive have content?

option_spec

Mapping of option names to validator functions.

optional_arguments

Number of optional arguments after the required arguments.

required_arguments

Number of required directive arguments.

add_index = False
final_argument_whitespace = False

May the final argument contain whitespace?

has_content = True

May the directive have content?

option_spec = None

Mapping of option names to validator functions.

optional_arguments = 0

Number of optional arguments after the required arguments.

required_arguments = 0

Number of required directive arguments.

add_name(node)

Append self.options['name'] to node['names'] if it exists.

assert_has_content()

Throw an ERROR-level DirectiveError if the directive doesn't have contents.

debug(message)

directive_error(level, message)

Return a DirectiveError suitable for being thrown as an exception.

error(message)

info(message)

run()

severe(message)

warning(message)

add_name(node)

Append self.options[‘name’] to node[‘names’] if it exists.

Also normalize the name string and register it as explicit target.

assert_has_content()

Throw an ERROR-level DirectiveError if the directive doesn’t have contents.

debug(message)
directive_error(level, message)

Return a DirectiveError suitable for being thrown as an exception.

Call “raise self.directive_error(level, message)” from within a directive implementation to return one single system message at level level, which automatically gets the directive block and the line number added.

Preferably use the debug, info, warning, error, or severe wrapper methods, e.g. self.error(message) to generate an ERROR-level directive error.

error(message)
info(message)
run()[source]
severe(message)
warning(message)