ShellDirective

class abjadbooktools.ShellDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

An abjad-book shell directive.

Represents a shell session.

Generates a docutils literal_block node.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abjadbooktools { graph [label=abjadbooktools]; "abjad.tools.abjadbooktools.ShellDirective.ShellDirective" [color=black, fontcolor=white, group=0, label=<<B>ShellDirective</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } subgraph cluster_docutils { graph [label=docutils]; "docutils.parsers.rst.Directive" [color=3, group=2, label=Directive, shape=box]; } "builtins.object" -> "docutils.parsers.rst.Directive"; "docutils.parsers.rst.Directive" -> "abjad.tools.abjadbooktools.ShellDirective.ShellDirective"; }

Bases

  • docutils.parsers.rst.Directive
  • builtins.object

Attribute summary

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() Executes the directive.
severe(message)
warning(message)

Methods

(Directive).add_name(node)

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

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

(Directive).assert_has_content()

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

(Directive).debug(message)
(Directive).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.

(Directive).error(message)
(Directive).info(message)
ShellDirective.run()

Executes the directive.

(Directive).severe(message)
(Directive).warning(message)