MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / run

Method run

markdown/blockprocessors.py:227–245  ·  view source on GitHub ↗
(self, parent, blocks)

Source from the content-addressed store, hash-verified

225 return bool(self.RE.search(block))
226
227 def run(self, parent, blocks):
228 block = blocks.pop(0)
229 m = self.RE.search(block)
230 if m:
231 before = block[:m.start()] # Lines before blockquote
232 # Pass lines before blockquote in recursively for parsing forst.
233 self.parser.parseBlocks(parent, [before])
234 # Remove ``> `` from begining of each line.
235 block = '\n'.join([self.clean(line) for line in
236 block[m.start():].split('\n')])
237 sibling = self.lastChild(parent)
238 if sibling and sibling.tag == "blockquote":
239 # Previous block was a blockquote so set that as this blocks parent
240 quote = sibling
241 else:
242 # This is a new blockquote. Create a new parent element.
243 quote = markdown.etree.SubElement(parent, 'blockquote')
244 # Recursively parse block with blockquote as parent.
245 self.parser.parseChunk(quote, block)
246
247 def clean(self, line):
248 """ Remove ``>`` from beginning of a line. """

Callers

nothing calls this directly

Calls 7

cleanMethod · 0.95
parseBlocksMethod · 0.80
lastChildMethod · 0.80
parseChunkMethod · 0.80
popMethod · 0.45
startMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected