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

Method run

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

Source from the content-addressed store, hash-verified

190 return block.startswith(' '*markdown.TAB_LENGTH)
191
192 def run(self, parent, blocks):
193 sibling = self.lastChild(parent)
194 block = blocks.pop(0)
195 theRest = ''
196 if sibling and sibling.tag == "pre" and len(sibling) \
197 and sibling[0].tag == "code":
198 # The previous block was a code block. As blank lines do not start
199 # new code blocks, append this block to the previous, adding back
200 # linebreaks removed from the split into a list.
201 code = sibling[0]
202 block, theRest = self.detab(block)
203 code.text = markdown.AtomicString('%s\n%s\n' % (code.text, block.rstrip()))
204 else:
205 # This is a new codeblock. Create the elements and insert text.
206 pre = markdown.etree.SubElement(parent, 'pre')
207 code = markdown.etree.SubElement(pre, 'code')
208 block, theRest = self.detab(block)
209 code.text = markdown.AtomicString('%s\n' % block.rstrip())
210 if code.text.startswith('.exec\n'):
211 pre.set('class', 'exec')
212 code.text = code.text.split(".exec\n", 1)[1]
213 if theRest:
214 # This block contained unindented line(s) after the first indented
215 # line. Insert these lines as the first block of the master blocks
216 # list for future processing.
217 blocks.insert(0, theRest)
218
219
220class BlockQuoteProcessor(BlockProcessor):

Callers

nothing calls this directly

Calls 6

lastChildMethod · 0.80
popMethod · 0.45
detabMethod · 0.45
setMethod · 0.45
splitMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected