class documentation

class AdmonitionProcessor(BlockProcessor): (source)

View In Hierarchy

Undocumented

Method __init__ Initialization.
Method get_class_and_title Undocumented
Method parse_content Get sibling admonition.
Method run Run processor. Must be overridden by subclasses.
Method test Test for block type. Must be overridden by subclasses.
Constant CLASSNAME Undocumented
Constant CLASSNAME_TITLE Undocumented
Constant RE Undocumented
Constant RE_SPACES Undocumented
Instance Variable content_indent Undocumented
Instance Variable content_indention Undocumented
Instance Variable current_sibling Undocumented

Inherited from BlockProcessor:

Method detab Remove a tab from the front of each line of the given text.
Method lastChild Return the last child of an etree element.
Method looseDetab Remove a tab from front of lines but allowing dedented lines.
Instance Variable parser Undocumented
Instance Variable tab_length Undocumented
def __init__(self, parser): (source)
def get_class_and_title(self, match): (source)

Undocumented

def parse_content(self, parent, block): (source)

Get sibling admonition. Retrieve the appropriate sibling element. This can get tricky when dealing with lists.

def run(self, parent, blocks): (source)

Run processor. Must be overridden by subclasses. When the parser determines the appropriate type of a block, the parser will call the corresponding processor's ``run`` method. This method should parse the individual lines of the block and append them to the etree. Note that both the ``parent`` and ``etree`` keywords are pointers to instances of the objects which should be edited in place. Each processor must make changes to the existing objects as there is no mechanism to return new/different objects to replace them. This means that this method should be adding SubElements or adding text to the parent, and should remove (``pop``) or add (``insert``) items to the list of blocks. Keywords: * ``parent``: A etree element which is the parent of the current block. * ``blocks``: A list of all remaining blocks of the document.

def test(self, parent, block): (source)

Test for block type. Must be overridden by subclasses. As the parser loops through processors, it will call the ``test`` method on each to determine if the given block of text is of that type. This method must return a boolean ``True`` or ``False``. The actual method of testing is left to the needs of that particular block type. It could be as simple as ``block.startswith(some_string)`` or a complex regular expression. As the block type may be different depending on the parent of the block (i.e. inside a list), the parent etree element is also provided and may be used as part of the test. Keywords: * ``parent``: A etree element which will be the parent of the block. * ``block``: A block of text from the source which has been split at blank lines.

CLASSNAME: str = (source)

Undocumented

Value
'admonition'
CLASSNAME_TITLE: str = (source)

Undocumented

Value
'admonition-title'

Undocumented

Value
re.compile(r'(?:^|\n)!!! ?([\w-]+(?: +[\w-]+)*)(?: +"(.*?)")? *(?:\n|$)')
RE_SPACES = (source)

Undocumented

Value
re.compile(r'  +')
content_indent: int = (source)

Undocumented

content_indention: int = (source)

Undocumented

current_sibling = (source)

Undocumented