class InlineProcessor(Treeprocessor): (source)
A Treeprocessor that traverses a tree, applying inline patterns.
Method | __init__ |
Undocumented |
Method | run |
Apply inline patterns to a parsed Markdown tree. |
Instance Variable | ancestors |
Undocumented |
Instance Variable | inline |
Undocumented |
Instance Variable | md |
Undocumented |
Instance Variable | parent |
Undocumented |
Instance Variable | stashed |
Undocumented |
Method | __apply |
Check if the line fits the pattern, create the necessary elements, add it to stashed_nodes. |
Method | __build |
Build the ancestor list. |
Method | __find |
Extract id from data string, start from index |
Method | __handle |
Process string with inline patterns and replace it with placeholders |
Method | __make |
Generate a placeholder |
Method | __process |
Process placeholders in Element.text or Element.tail of Elements popped from self.stashed_nodes. |
Method | __process |
Process string with placeholders and generate ElementTree tree. |
Method | __stash |
Add node to stash |
Instance Variable | __placeholder |
Undocumented |
Instance Variable | __placeholder |
Undocumented |
Instance Variable | __placeholder |
Undocumented |
Instance Variable | __placeholder |
Undocumented |
Apply inline patterns to a parsed Markdown tree. Iterate over ElementTree, find elements with inline tag, apply inline patterns and append newly created Elements to tree. If you don't want to process your data with inline patterns, instead of normal string, use subclass AtomicString: node.text = markdown.AtomicString("This will not be processed.") Arguments: * tree: ElementTree object, representing Markdown tree. * ancestors: List of parent tag names that precede the tree node (if needed). Returns: ElementTree object with applied inline patterns.
Check if the line fits the pattern, create the necessary elements, add it to stashed_nodes. Keyword arguments: * data: the text to be processed * pattern: the pattern to be checked * patternIndex: index of current pattern * startIndex: string index, from which we start searching Returns: String with placeholders instead of ElementTree elements.
Extract id from data string, start from index Keyword arguments: * data: string * index: index, from which we start search Returns: placeholder id and string index, after the found placeholder.
Process string with inline patterns and replace it with placeholders Keyword arguments: * data: A line of Markdown text * patternIndex: The index of the inlinePattern to start with Returns: String with placeholders.
Process placeholders in Element.text or Element.tail of Elements popped from self.stashed_nodes. Keywords arguments: * node: parent node * subnode: processing node * isText: bool variable, True - it's text, False - it's tail Returns: None