docutils.parsers.rst.directives.misc module
Miscellaneous directives.
- class Include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectiveInclude content read from a separate source file.
Content may be parsed by the parser, or included as a literal block. The encoding of the included file can be specified. Only a part of the given file argument may be included by specifying start and end line or text to match before and/or after the text to be used.
https://docutils.sourceforge.io/docs/ref/rst/directives.html#including-an-external-document-fragment
- required_arguments = 1
Number of required directive arguments.
- optional_arguments = 0
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- option_spec = {'class': <function class_option>, 'code': <function unchanged>, 'encoding': <function encoding>, 'end-before': <function unchanged_required>, 'end-line': <class 'int'>, 'literal': <function flag>, 'name': <function unchanged>, 'number-lines': <function unchanged>, 'parser': <function parser_name>, 'start-after': <function unchanged_required>, 'start-line': <class 'int'>, 'tab-width': <class 'int'>}
Mapping of option names to validator functions.
- standard_include_path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/sphinx-docutils/envs/latest/lib/python3.12/site-packages/docutils/parsers/rst/include')
- class Raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectivePass through content unchanged
Content is included in output based on type argument
Content may be included inline (content section of directive) or imported from a file or url.
- required_arguments = 1
Number of required directive arguments.
- optional_arguments = 0
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- option_spec = {'class': <function class_option>, 'encoding': <function encoding>, 'file': <function path>, 'url': <function uri>}
Mapping of option names to validator functions.
- has_content = True
May the directive have content?
- class Replace(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
Directive- has_content = True
May the directive have content?
- class Unicode(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectiveConvert Unicode character codes (numbers) to characters. Codes may be decimal numbers, hexadecimal numbers (prefixed by
0x,x,\x,U+,u, or\u; e.g.U+262E), or XML-style numeric character entities (e.g.☮). Text following “..” is a comment and is ignored. Spaces are ignored, and any other text remains as-is.- required_arguments = 1
Number of required directive arguments.
- optional_arguments = 0
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- option_spec = {'ltrim': <function flag>, 'rtrim': <function flag>, 'trim': <function flag>}
Mapping of option names to validator functions.
- comment_pattern = re.compile('( |\\n|^)\\.\\. ')
- class Class(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectiveSet a “class” attribute on the directive content or the next element. When applied to the next element, a “pending” element is inserted, and a transform does the work later.
- required_arguments = 1
Number of required directive arguments.
- optional_arguments = 0
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- has_content = True
May the directive have content?
- class Role(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
Directive- has_content = True
May the directive have content?
- argument_pattern = re.compile('((?:(?!_)\\w)+(?:[-._+:](?:(?!_)\\w)+)*)\\s*(\\(\\s*((?:(?!_)\\w)+(?:[-._+:](?:(?!_)\\w)+)*)\\s*\\)\\s*)?$')
- class DefaultRole(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectiveSet the default interpreted text role.
- optional_arguments = 1
Number of optional arguments after the required arguments.
- final_argument_whitespace = False
May the final argument contain whitespace?
- class Title(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
Directive- required_arguments = 1
Number of required directive arguments.
- optional_arguments = 0
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- class MetaBody(state_machine, debug=False)[source]
Bases:
SpecializedBody
- class Meta(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
Directive- has_content = True
May the directive have content?
- SMkwargs = {'state_classes': (<class 'docutils.parsers.rst.directives.misc.MetaBody'>,)}
- class Date(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
Directive- has_content = True
May the directive have content?
- class TestDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]
Bases:
DirectiveThis directive is useful only for testing purposes.
- optional_arguments = 1
Number of optional arguments after the required arguments.
- final_argument_whitespace = True
May the final argument contain whitespace?
- option_spec = {'option': <function unchanged_required>}
Mapping of option names to validator functions.
- has_content = True
May the directive have content?